Skip to content

Commit

Permalink
Minor fixes after demo 2 (#10)
Browse files Browse the repository at this point in the history
* Pushed test coverage to 100%

* Fix doc link, fix cf summary widget spinbox

* Bump version
  • Loading branch information
Myoldmopar committed Oct 26, 2022
1 parent 24ace25 commit a04373b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
*.ods#

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion energyplus_pet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NICE_NAME = "EnergyPlus P.E.T."
VERSION = "0.41"
VERSION = "0.42"
22 changes: 12 additions & 10 deletions energyplus_pet/equipment/wahp_cooling_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,21 +261,13 @@ def to_eplus_epjson_object(self) -> str:
"minimum_value_of_y": -100, "maximum_value_of_y": 100,
"minimum_value_of_z": -100, "maximum_value_of_z": 100,
}
curves = {'TotalCapacityCurve': {
quad_curves = {'TotalCapacityCurve': {
"coefficient1_constant": self.total_capacity_params[0],
"coefficient2_w": self.total_capacity_params[1],
"coefficient3_x": self.total_capacity_params[2],
"coefficient4_y": self.total_capacity_params[3],
"coefficient5_z": self.total_capacity_params[4],
**reused_limits_four
}, 'SensibleCapacityCurve': {
"coefficient1_constant": self.sensible_capacity_params[0],
"coefficient2_v": self.sensible_capacity_params[1],
"coefficient3_w": self.sensible_capacity_params[2],
"coefficient4_x": self.sensible_capacity_params[3],
"coefficient5_y": self.sensible_capacity_params[4],
"coefficient5_z": self.sensible_capacity_params[5],
**reused_limits_five
}, 'CoolingPowerCurve': {
"coefficient1_constant": self.cooling_power_params[0],
"coefficient2_w": self.cooling_power_params[1],
Expand All @@ -284,11 +276,21 @@ def to_eplus_epjson_object(self) -> str:
"coefficient5_z": self.cooling_power_params[4],
**reused_limits_four
}}
quint_curves = {'SensibleCapacityCurve': {
"coefficient1_constant": self.sensible_capacity_params[0],
"coefficient2_v": self.sensible_capacity_params[1],
"coefficient3_w": self.sensible_capacity_params[2],
"coefficient4_x": self.sensible_capacity_params[3],
"coefficient5_y": self.sensible_capacity_params[4],
"coefficient5_z": self.sensible_capacity_params[5],
**reused_limits_five
}}

epjson_object = {
**BaseEquipment.current_eplus_version_object_epjson(),
'Coil:Cooling:WaterToAirHeatPump:EquationFit': coil_object,
'Curve:QuadLinear': curves
'Curve:QuadLinear': quad_curves,
'Curve:QuintLinear': quint_curves
}
return dumps(epjson_object, indent=2)

Expand Down
2 changes: 1 addition & 1 deletion energyplus_pet/forms/base_data_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self, parent_window, eq: BaseEquipment):
self.table.set_all_cell_sizes_to_text(redraw=True)
self.table.extra_bindings("end_edit_cell", func=self._cell_edited)
self.table.extra_bindings("end_paste", func=self._cells_pasted)
# TODO: Handle undo here
# Undo events in the table could bypass our bindings, need to verify this
self.table.select_cell(row=1, column=0)
self.table.pack(side=TOP, expand=True, fill=BOTH, padx=p, pady=p)
self.table.focus()
Expand Down
9 changes: 6 additions & 3 deletions energyplus_pet/forms/correction_summary_widget.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tkinter import Button, Frame, Label, LabelFrame, TOP, Spinbox, IntVar, Scrollbar, LEFT, BOTH, RIGHT, EW, \
VERTICAL, Radiobutton, StringVar, W, NS, OptionMenu, MULTIPLE, Listbox, Variable, BooleanVar, \
ACTIVE, DISABLED, HORIZONTAL
ACTIVE, DISABLED, HORIZONTAL, TclError
from tkinter.ttk import Separator
from typing import Callable

Expand Down Expand Up @@ -37,7 +37,10 @@ def __init__(self, parent: Frame, name: str, equipment_instance: BaseEquipment,
self._setup_removal_callback(remove_callback)

def _update_from_traces(self, *_): # pragma: no cover
self.cf.num_corrections = self.var_num_corrections.get()
try:
self.cf.num_corrections = self.var_num_corrections.get()
except TclError:
self.cf.num_corrections = 0 # if blank, set to zero for now
if self.var_mod_type.get() == CorrectionFactorType.Multiplier.name:
self.cf.correction_type = CorrectionFactorType.Multiplier
elif self.var_mod_type.get() == CorrectionFactorType.Replacement.name:
Expand Down Expand Up @@ -68,7 +71,7 @@ def _build_gui(self): # pragma: no cover
Label(corr_frame, text="# Correction Values").grid(
row=0, column=0, padx=p, pady=p
)
Spinbox(corr_frame, from_=2, to=15, width=4, textvariable=self.var_num_corrections).grid(
Spinbox(corr_frame, from_=1, to=99, width=4, textvariable=self.var_num_corrections).grid(
row=0, column=1, padx=p, pady=p
)
corr_frame.grid(
Expand Down
5 changes: 3 additions & 2 deletions energyplus_pet/forms/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ def _refresh_gui_state(self):
self._button_save_data['state'] = DISABLED

def _help_documentation(self):
"""Launches a browser to open the latest documentation"""
browser_open('https://energypluspet.readthedocs.io/en/latest/')
"""Launches a browser to open the stable documentation"""
# could try to use the current version docs but that may be a bit finicky
browser_open('https://energypluspet.readthedocs.io/en/stable/')
self._update_status_bar('Launched online documentation')

@staticmethod
Expand Down

0 comments on commit a04373b

Please sign in to comment.