Skip to content

Commit

Permalink
Merge branch 'master' into iv-error-message-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
trav3711 authored Jan 12, 2024
2 parents 2250345 + ee2d177 commit b15e2ee
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/OntologyValidator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Get modified entity type files
id: changed-entity-type-files
if: github.event_name == 'push'
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v41
with:
files: '**/ontology/yaml/**/entity_types/*.yaml'

Expand Down
4 changes: 2 additions & 2 deletions ontology/docs/hvac_ahu.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Air handling units are common air-side devices that provide mechanical condition
- It **must** handle outside air directly.
- It **must** handle return air from the space.

## Example: Single-Zone AHUs
## Example: Single-Zone AHUs
This version of AHU serves an individual zone as a stand-alone device.

### BMS Example
Expand Down Expand Up @@ -124,7 +124,7 @@ VAV-1:
```


## Example: AHU as Part of a Dual Duct System
## Example: AHU as Part of a Dual Duct System
This version of AHU serves a group of zones through downstream terminal units (VAVs), and those terminal units are also served by duct furnaces (central air-side heating devices which provide heating via a second set of ductwork known commonly as the "hot deck").

### BMS Example
Expand Down
17 changes: 4 additions & 13 deletions ontology/docs/hvac_chws.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Examples
* [Variable Primary CHWS (Air-Cooled)](#example-variable-primary-chws-air-cooled)
* [Variable Primary CHWS (Water-Cooled)](#example-variable-primary-chws-water-cooled)

## Type Definition
Hydronic chilled and condensing water systems are two distinct systems. A typical chilled water system (CHWS) consists of chillers (that use refrigerant to cool a closed loop of circulating water known as the "chilled water") and pumps to distribute the chilled water to other equipment in the building and/or to circulate water through the chillers. Typically, air-side equipment (e.g., AHU, FCU) contains chilled water coils connected to the main CHWS; as air passes over the chilled water coils it is cooled. As chilled water systems cool the chilled water, they must reject the heat absorbed from the chilled water loop. In a CHWS with "air-cooled" chillers, the heat is rejected directly into the atmospehre. In a CHWS with "water-cooled" chillers, the heat is rejected to another water distribution system (typically a condensing water system).

Expand All @@ -19,14 +19,14 @@ There are many different types of chilled and condenser water system configurati
## Type Requirements
- Chillers (CH) require the mechanical cooling of water.
- Condensers require that, regardless of their own cooling method (sensible or evaporative), they serve downstream devices which require water as a condensing source.
- Heat exchangers (HX) provide heat transfer between two fluid streams, without intermixing the fluids. They are modeled separately only if they are stand-alone devices.
- Heat exchangers (HX) provide heat transfer between two fluid streams, without intermixing the fluids. They are modeled separately only if they are stand-alone devices.

## Connection Requirements
- The equipment which is part of each system should be assigned a `HAS_PART` connection to it.
- The specific interconnections between equipment in the system can also be defined through `FEEDS` connections. In these cases, it is best to feed from the pumps.
- To simplify distribution specifics, the system (rather than the system pumps) should be used to feed downstream equipment.

## Example: Variable Primary CHWS (Air-Cooled)
## Example: Variable Primary CHWS (Air-Cooled)
This version of CHWS has a single set of variable speed pumps which serve air-cooled chillers and downstream equipment.

### BMS Example
Expand All @@ -38,9 +38,6 @@ This version of CHWS has a single set of variable speed pumps which serve air-co
![CHWS Variable Primary](./figures/system_diagrams/chws_aircooled.png)

### Sample Building Configuration
<details>
<summary>Click to expand the example building configuration</summary>

```yaml
# System definition. Everything that it serves will be fed by it, everything that comprises it will be contained by it.
CHWSYS-BLDG-1:
Expand Down Expand Up @@ -134,11 +131,9 @@ AHU-1:
percent: '%'
...


```
</details>

## Example: Variable Primary CHWS (Water-Cooled)
## Example: Variable Primary CHWS (Water-Cooled)
This version of CHWS has a single set of variable speed chilled water pumps serving water-cooled chillers and downstream equipment. The condensing side serves the chillers via two pumps.

### BMS Example
Expand All @@ -150,9 +145,6 @@ This version of CHWS has a single set of variable speed chilled water pumps serv
![CHWS Variable Primary WC](./figures/system_diagrams/chws_watercooled.png)

### Sample Building Configuration
<details>
<summary>Click to expand the example building configuration</summary>

```yaml
# Chilled water system feeds the equipment, and contains the distribution/production equipment.
CHWSYS-BLDG-1:
Expand Down Expand Up @@ -367,7 +359,6 @@ AHU-1:
values:
percent: '%'
...
</details>

```

Expand Down
2 changes: 1 addition & 1 deletion ontology/docs/hvac_fcu.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Fan coil units are air-side devices that provide conditioning to a space. By def
- It **must not** handle outside air directly.
- It **must** handle return air from the space.

## Example: Stand-Alone FCUs
## Example: Stand-Alone FCUs
This version of FCU serves an individual zone as a stand-alone device.

### BMS Example
Expand Down
2 changes: 1 addition & 1 deletion ontology/docs/hvac_hws.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Hydronic heating water systems (HWS) contain boilers (BLR) to heat the water and
## Type Requirements
- It **must** handle water for the purposes of heating.

## Example: Variable Primary HWS
## Example: Variable Primary HWS
This version of HWS has a single set of variable speed pumps which serve boilers and downstream equipment.

### BMS Example
Expand Down
41 changes: 21 additions & 20 deletions tools/abel/model/model_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,37 @@ def DetermineReportingEntityUpdateMask(
API.
updated_entity: An Entity instance from an updated building config.
"""
update_mask = []
update_mask = set()
# updated entity code
if updated_entity.code != current_entity.code:
update_mask.append(entity_enumerations.EntityUpdateMaskAttribute.CODE)
update_mask.add(entity_enumerations.EntityUpdateMaskAttribute.CODE)
# updated entity type name
if updated_entity.type_name != current_entity.type_name:
update_mask.append(entity_enumerations.EntityUpdateMaskAttribute.TYPE)
update_mask.add(entity_enumerations.EntityUpdateMaskAttribute.TYPE)
# updated entity connections
if set(updated_entity.connections).difference(
set(current_entity.connections)
):
update_mask.append(
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.CONNECTIONS
)
if set(updated_entity.translations).intersection(
set(current_entity.translations)
) != set(current_entity.translations):
update_mask.append(
if (sorted(updated_entity.translations, key=lambda x: x.std_field_name) !=
sorted(current_entity.translations, key=lambda x: x.std_field_name)):
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.TRANSLATION
)
else:
for updated_field in updated_entity.translations:
curent_translations = {
current_translation = {
field.std_field_name: field for field in current_entity.translations
}
current_field = curent_translations.get(updated_field.std_field_name)
current_field = current_translation.get(updated_field.std_field_name)
if isinstance(current_field, ef.DimensionalValueField) and isinstance(
updated_field, ef.DimensionalValueField
):
# Unit mapping could change
if current_field.units != updated_field.units:
update_mask.append(
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.TRANSLATION
)
elif isinstance(current_field, ef.MultistateValueField) and isinstance(
Expand All @@ -102,28 +104,27 @@ def DetermineReportingEntityUpdateMask(
updated_states = updated_model.GetStates(
updated_field.reporting_entity_guid, updated_field.std_field_name
)

if sorted(
current_states, key=lambda state: state.reporting_entity_guid
) != sorted(
updated_states, key=lambda state: state.reporting_entity_guid
):
update_mask.append(
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.TRANSLATION
)

elif isinstance(current_field, ef.MissingField) and not isinstance(
updated_field, ef.MissingField
):
# field was missing and now is not missing
update_mask.append(
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.TRANSLATION
)
elif not isinstance(current_field, ef.MissingField) and isinstance(
updated_field, ef.MissingField
):
# field was being reported but is now missing
update_mask.append(
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.TRANSLATION
)
return update_mask
Expand All @@ -137,15 +138,15 @@ def DetermineVirtualEntityUpdateMask(current_entity, updated_entity):
API.
updated_entity: An Entity instance from an updated building config.
"""
update_mask = []
update_mask = set()
if updated_entity.code != current_entity.code:
update_mask.append(entity_enumerations.EntityUpdateMaskAttribute.CODE)
update_mask.add(entity_enumerations.EntityUpdateMaskAttribute.CODE)
if updated_entity.type_name != current_entity.type_name:
update_mask.append(entity_enumerations.EntityUpdateMaskAttribute.TYPE)
update_mask.add(entity_enumerations.EntityUpdateMaskAttribute.TYPE)
if set(updated_entity.connections).difference(
set(current_entity.connections)
):
update_mask.append(
update_mask.add(
entity_enumerations.EntityUpdateMaskAttribute.CONNECTIONS
)
# Facilities entities don't have links but are virtual so do the following
Expand All @@ -161,7 +162,7 @@ def DetermineVirtualEntityUpdateMask(current_entity, updated_entity):
< 0.9
)
):
update_mask.append(entity_enumerations.EntityUpdateMaskAttribute.LINKS)
update_mask.add(entity_enumerations.EntityUpdateMaskAttribute.LINKS)
return update_mask


Expand Down
33 changes: 23 additions & 10 deletions tools/abel/tests/model_helper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def testDetermineReportingEntityUpdateMask(self):
current_entity = self.current_model.GetEntity(entity_guid)
updated_entity = self.updated_model.GetEntity(entity_guid)

expected_updated_mask = [
expected_updated_mask = {
EntityUpdateMaskAttribute.TYPE,
EntityUpdateMaskAttribute.CONNECTIONS,
EntityUpdateMaskAttribute.TRANSLATION,
]
}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
Expand All @@ -99,7 +99,7 @@ def testDetermineReportingEntityUpdateMask_UpdatedFieldRawUnitValue(self):
current_entity = self.current_model.GetEntity(vav_4_guid)
updated_entity = self.updated_model.GetEntity(vav_4_guid)

expected_updated_mask = [EntityUpdateMaskAttribute.TRANSLATION]
expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
Expand All @@ -112,7 +112,7 @@ def testDetermineReportingEntityUpdateMask_UpdatedFieldRawStateValue(self):
current_entity = self.current_model.GetEntity(vav_5_guid)
updated_entity = self.updated_model.GetEntity(vav_5_guid)

expected_updated_mask = [EntityUpdateMaskAttribute.TRANSLATION]
expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
Expand All @@ -125,7 +125,7 @@ def testDetermineReportingEntityUpdateMask_UpdatedFieldPresentValuePath(self):
current_entity = self.current_model.GetEntity(vav_6_guid)
updated_entity = self.updated_model.GetEntity(vav_6_guid)

expected_updated_mask = [EntityUpdateMaskAttribute.TRANSLATION]
expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
Expand All @@ -138,7 +138,7 @@ def testDetermineReportingEntityUpdateMask_UpdatedFieldUnitPath(self):
current_entity = self.current_model.GetEntity(vav_7_guid)
updated_entity = self.updated_model.GetEntity(vav_7_guid)

expected_updated_mask = [EntityUpdateMaskAttribute.TRANSLATION]
expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
Expand All @@ -151,7 +151,7 @@ def testDetermineReportingEntityUpdateMask_UpdatedMissingField(self):
current_entity = self.current_model.GetEntity(vav_8_guid)
updated_entity = self.updated_model.GetEntity(vav_8_guid)

expected_updated_mask = [EntityUpdateMaskAttribute.TRANSLATION]
expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
Expand All @@ -164,23 +164,36 @@ def testDetermineReportingEntityUpdateMask_UpdatedFieldIsMissing(self):
current_entity = self.current_model.GetEntity(vav_9_guid)
updated_entity = self.updated_model.GetEntity(vav_9_guid)

expected_updated_mask = [EntityUpdateMaskAttribute.TRANSLATION]
expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
)

self.assertEqual(actual_updated_mask, expected_updated_mask)

def testDetermineReportingEntityUpdateMask_AddTranslation(self):
vav_10_guid = 'f318a105-a8c8-4157-bf0f-9745ac11fbfc'
current_entity = self.current_model.GetEntity(vav_10_guid)
updated_entity = self.updated_model.GetEntity(vav_10_guid)

expected_updated_mask = {EntityUpdateMaskAttribute.TRANSLATION}

actual_updated_mask = model_helper.DetermineReportingEntityUpdateMask(
self.current_model, self.updated_model, current_entity, updated_entity
)

self.assertEqual(actual_updated_mask, expected_updated_mask)

def testDetermineVirtualEntityUpdateMask(self):
entity_guid = '4931e096-dea5-4b81-86ad-234c6d07b978'
current_entity = self.current_model.GetEntity(entity_guid)
updated_entity = self.updated_model.GetEntity(entity_guid)
expected_updated_mask = [
expected_updated_mask = {
EntityUpdateMaskAttribute.TYPE,
EntityUpdateMaskAttribute.CONNECTIONS,
EntityUpdateMaskAttribute.LINKS,
]
}

actual_updated_mask = model_helper.DetermineVirtualEntityUpdateMask(
current_entity, updated_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ e49b0687-e409-4a24-95d6-4629ed42e7b7:
'ON': active
type: HVAC/VAV_SD_CSP

f318a105-a8c8-4157-bf0f-9745ac11fbfc:
cloud_device_id: "254190134410577"
code: VAV-10
etag: 1234567
type: HVAC/VAV_SD_CSP

c2ba089b-3a5e-4c56-bdeb-748a9d1b0e99:
code: TEST_BUILDING
etag: 1234567
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,31 @@ e49b0687-e409-4a24-95d6-4629ed42e7b7:
'ON': active
type: HVAC/VAV_SD_CSP

f318a105-a8c8-4157-bf0f-9745ac11fbfc:
cloud_device_id: "254190134410577"
code: VAV-10
etag: 1234567
# Adding a translation to an already typed entity.
translation:
zone_air_temperature_sensor:
present_value: zone_air_temperature_sensor.present_value
units:
key: zone_air_temperature_sensor.units
values:
degrees_fahrenheit: degrees-farenheit
zone_air_temperature_setpoint:
present_value: zone_air_temperature_setpoint.present_value
units:
key: zone_air_temperature_setpoint.units
values:
degrees_fahrenheit: degrees-farenheit
run_command:
present_value: points.run_command.present-value
states:
'OFF': inactive
'ON': active
type: HVAC/VAV_SD_CSP

# Adding an entity
37fb77f1-4a2a-4ab4-b6bb-771c1cfeaa05:
operation: ADD
Expand Down

0 comments on commit b15e2ee

Please sign in to comment.