diff --git a/buildingspy/CHANGES.txt b/buildingspy/CHANGES.txt index 5ae70327..9b48d7c6 100644 --- a/buildingspy/CHANGES.txt +++ b/buildingspy/CHANGES.txt @@ -1,6 +1,13 @@ BuildingsPy Changelog --------------------- +Version 5.2.1, ... +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Updated pyfunnel to version 2.0.1 to fix plotting issues. + With this change, Python 2 is no longer supported. + (https://github.com/lbl-srg/BuildingsPy/issues/599) + Version 5.2.0, March 14, 2025 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/buildingspy/VERSION b/buildingspy/VERSION index 91ff5727..26d99a28 100644 --- a/buildingspy/VERSION +++ b/buildingspy/VERSION @@ -1 +1 @@ -5.2.0 +5.2.1 diff --git a/buildingspy/development/regressiontest.py b/buildingspy/development/regressiontest.py index e4a3375a..6d42a587 100644 --- a/buildingspy/development/regressiontest.py +++ b/buildingspy/development/regressiontest.py @@ -7,10 +7,6 @@ # MWetter@lbl.gov 2011-02-23 ####################################################### # -from collections import defaultdict -from contextlib import contextmanager -import difflib -import fnmatch import functools import glob import io @@ -24,19 +20,24 @@ import sys import tempfile import time -import webbrowser +from collections import defaultdict +from contextlib import contextmanager + # Third-party module or package imports. import numpy as np -import simplejson + # Code repository sub-package imports. import pyfunnel -from buildingspy.development import error_dictionary_openmodelica -from buildingspy.development import error_dictionary_optimica -from buildingspy.development import error_dictionary_dymola -from buildingspy.io.outputfile import Reader -from buildingspy.io.postprocess import Plotter + import buildingspy.io.outputfile as of import buildingspy.io.reporter as rep +from buildingspy.development import ( + error_dictionary_dymola, + error_dictionary_openmodelica, + error_dictionary_optimica, +) +from buildingspy.io.outputfile import Reader +from buildingspy.io.postprocess import Plotter def runSimulation(worDir, cmd): @@ -2237,6 +2238,13 @@ def _compareResults(self, data_idx, oldRefFulFilNam, y_sim, y_tra, refFilNam, an newStatistics = self._check_statistics( old_results, y_tra, stage, newTrajectories, newStatistics, model_name) + if newTrajectories: + if self._comp_tool == 'legacy': + print("(Close plot window to continue.)") + self._legacy_plot(y_sim, t_ref, y_ref, noOldResults, timOfMaxErr, matFilNam) + else: + self._funnel_plot(model_name) + # If the users selected "Y" or "N" (to not accept or reject any new results) in previous tests, # or if the script is run in batch mode, then don't plot the results. # If we found an error, plot the results, and ask the user to accept or @@ -2256,13 +2264,6 @@ def _compareResults(self, data_idx, oldRefFulFilNam, y_sim, y_tra, refFilNam, an print( f" update reference files with new {self._color_BOLD}trajectories{self._color_ERROR}?{self._color_ENDC}") - if newTrajectories: - if self._comp_tool == 'legacy': - print("(Close plot window to continue.)") - self._legacy_plot(y_sim, t_ref, y_ref, noOldResults, timOfMaxErr, matFilNam) - else: - self._funnel_plot(model_name) - while not (ans == "n" or ans == "y" or ans == "Y" or ans == "N"): ans = input(" Enter: y(yes), n(no), Y(yes for all), N(no for all): ") @@ -2311,7 +2312,7 @@ def _funnel_plot(self, model_name, browser=None): server = pyfunnel.MyHTTPServer(('', 0), pyfunnel.CORSRequestHandler, str_html=content, url_html='funnel') # Start the browser instance. - server.browse(list_files, browser=browser) + server.browse(list_files, browser=browser, timeout=60) def _legacy_plot(self, y_sim, t_ref, y_ref, noOldResults, timOfMaxErr, model_name): """Plot comparison results generated by legacy comparison algorithm.""" @@ -3880,7 +3881,7 @@ def _get(model, key, data): return 0 with open(self._statistics_log, 'r') as f: - staVal = simplejson.loads(f.read()) + staVal = json.loads(f.read()) data = [] for case in staVal['testCase']: if 'translate' in case: @@ -3902,7 +3903,7 @@ def _get(model, key, data): temp['simulation']['state_events'] = case['simulate']['state_events'] if 'state_events' in case['simulate'] else 0 temp['simulation']['success'] = case['simulate']['result'] data.append(temp) - dataJson = simplejson.dumps(data) + dataJson = json.dumps(data) return dataJson def run(self): @@ -4135,7 +4136,7 @@ def run(self): # For Dymola: store available simulation info into # self._comp_info used for reporting. val = self._run_simulation_info() - self._comp_info = simplejson.loads(val) + self._comp_info = json.loads(val) r = self._checkReferencePoints(ans) if r != 0: # In case of comparison error. Comparison warnings are handled @@ -4153,8 +4154,8 @@ def run(self): if not self._skip_verification or self._rewrite_configuration_file: # For OpenModelica and OPTIMICA: store available translation and simulation info # into self._comp_info used for reporting or for rewriting the configuration file. - with open(self._simulator_log_file, 'r') as f: - self._comp_info = simplejson.loads(f.read()) + with open(self._simulator_log_file, 'r', encoding='utf-8-sig') as f: + self._comp_info = json.loads(f.read()) if not self._skip_verification: r = self._checkReferencePoints(ans='N') diff --git a/buildingspy/templates/datatable.html b/buildingspy/templates/datatable.html index 2a3e9f64..053a0c7b 100755 --- a/buildingspy/templates/datatable.html +++ b/buildingspy/templates/datatable.html @@ -1,92 +1,93 @@ - -
- - - - - - - + .dataTable tbody td { + word-break: break-word; + vertical-align: top; + } - --
| Model | -Variables | -Success | -Results File | -comp_dirs | -
|---|
Color Legend
-Translation, simulation or extracting simulation results failed: see message in - alert box.
-Funnel comparison failed: see message in alert box.
-Result verification detected error, see plot.
-Test passed.
-