diff --git a/.github/workflows/test_pull_requests.yml b/.github/workflows/test_pull_requests.yml index 79e80de36ae..82b27b057ff 100644 --- a/.github/workflows/test_pull_requests.yml +++ b/.github/workflows/test_pull_requests.yml @@ -241,6 +241,7 @@ jobs: 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>=2.1.4 + # This will build out a ./regressions package as well as a ./regressions-plotter-{{matric.os}}.html report - name: Run Regressions if: always() && matrix.run_regressions && steps.branch_build.outcome != 'failure' # always run this step as long as we actually built id: regressions @@ -255,6 +256,15 @@ jobs: name: "regressions-${{ matrix.os }}-${{ github.event.pull_request.head.sha }}" path: "${{ github.workspace }}/regressions" + - name: Upload Regressions Plotter HTML + uses: actions/upload-artifact@v4 + id: upload_regression_plotter + if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' # only run this if regressions were encountered "failed" + with: + name: "regressions-plotter-${{ matrix.os }}" + path: "${{ github.workspace }}/regression_plotter.html" + + # This executes a Python script that reads regressions results and produces a JavaScript file meant to run on GitHub - name: Generate Regression Summary GitHub Script if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' run: > @@ -276,6 +286,7 @@ jobs: # - uses: lhotari/action-upterm@v1 + # Unfortunately I can't get forked repository runs to post onto the original PR, so this is needed to alert for regressions - name: Fail on Regressions from Forked Repository if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' && github.event.pull_request.head.repo.full_name != 'NatLabRockies/EnergyPlus' run: | diff --git a/scripts/dev/gha_regressions.py b/scripts/dev/gha_regressions.py index 1b5be298dd6..73ac7935220 100644 --- a/scripts/dev/gha_regressions.py +++ b/scripts/dev/gha_regressions.py @@ -476,6 +476,43 @@ def generate_markdown_summary(self, bundle_root: Path): """ (bundle_root / "summary.md").write_text(content) + @staticmethod + def read_csv_to_columns(file_path: Path) -> dict[str, list[str | float]]: + columns = {} + with open(file_path, 'r', newline='') as file: + reader = csv.reader(file) + header = next(reader) # Read header row + for i, col_name in enumerate(header): + columns[col_name.strip()] = [] + for row in reader: + for i, value in enumerate(row): + value = value.strip() + variable = header[i].strip() + try: + v = float(value) + columns[variable].append(v) + except ValueError: # just take the string timestamp + columns[variable].append(value) + return columns + + @staticmethod + def generate_regression_plotter(bundle_root: Path, metadata_object: dict, results_object: dict, limit: bool): + metadata_string = "metadata = " + json.dumps(metadata_object, indent=4) + ';' + results_string = "results = " + json.dumps(results_object, indent=4) + ';' + limit_string = "" + if limit: + limit_string = r"""""" + template_file = Path(__file__).resolve().parent / 'regression_plotter.in.html' + content = template_file.read_text() + patches = { + '': metadata_string, + '': results_string, + '': limit_string + } + for key, value in patches.items(): + content = content.replace(key, value) + (bundle_root / 'regression_plotter.html').write_text(content) + def check_all_regressions(self, base_testfiles: Path, mod_testfiles: Path, bundle_root: Path) -> bool: any_diffs = False bundle_root.mkdir(exist_ok=True) @@ -569,6 +606,12 @@ def check_all_regressions(self, base_testfiles: Path, mod_testfiles: Path, bundl print(f"* Diffs by Type *:\n{json.dumps(self.diffs_by_type, indent=2, sort_keys=True)}\n") if any_diffs: self.generate_markdown_summary(bundle_root) + self.generate_regression_plotter( + bundle_root, metadata_object, results_object, hit_max_limit + ) + self.generate_regression_plotter( + bundle_root.parent, metadata_object, results_object, hit_max_limit + ) # print("::warning title=Regressions::Diffs Detected") return any_diffs diff --git a/scripts/dev/regression_plotter.in.html b/scripts/dev/regression_plotter.in.html new file mode 100644 index 00000000000..337d681f9cd --- /dev/null +++ b/scripts/dev/regression_plotter.in.html @@ -0,0 +1,241 @@ + + + + EnergyPlus Regression Viewer + + + + + +
+

EnergyPlus Regression Quick Plotter

+
+ + +
+
+ + +
+ + + + +
+
+
+ + + \ No newline at end of file diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index 25f511dfeeb..d50bc3c3503 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -2907,6 +2907,10 @@ void CalcSimpleHeatingCoil(EnergyPlusData &state, if (fanOp == HVAC::FanOp::Cycling) { HeatingCoilLoad *= PartLoadRatio; + if (CapacitanceWater > 0 && + state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).LoopSide(DataPlant::LoopSideLocation::Supply).FlowRequest > 0) { + TempWaterOut = TempWaterIn - HeatingCoilLoad / CapacitanceWater; + } } // Set the outlet conditions