Skip to content

Commit

Permalink
Updated QUDT to v2.1.32 (#579)
Browse files Browse the repository at this point in the history
* swapping out brick quantitykinds for QUDT QKs when Brick adds nothing

* Updated QUDT

* Made SystemOfUnits import QUDT Prefixes

* use topquadrant for SHACL

* switch reasoning on qudt

* formatting

* remove broken HTML, add missing namespace to QUDT

* remove brick:Power quantity kind

* fix old "substances" annotation

* format sensor.py

* remove old definitions

* format equipment.py

* more qudt imports

* formatting and some minor fixes/optimizations

* formatting tests, fixing a few to account for QUDT

* formatting

* aider: Added BRICK.hasQuantity annotations to subclasses of Current_Ratio_Setpoint in setpoint.py.

# Aider chat conversation:

USER: For all subclasses of Current_Ratio_Setpoint in bricksrc/setpoint.py, add a BRICK.hasQuantity annotation (if it does not already have one) using the correct quantity from bricksrc/quantities.py. If one does not exist, use a QUDT quantity kind from the QUDTQK namespace. For "Demand", just use BRICK.Power

ASSISTANT: ```diff
--- bricksrc/setpoint.py
+++ bricksrc/setpoint.py
@@ ... @@
             "Current_Ratio_Setpoint": {
+                BRICK.hasQuantity: BRICK.Electric_Current,
                 "tags": [TAG.Point, TAG.Setpoint, TAG.Current, TAG.Electric, TAG.Ratio]
             },
             "Voltage_Ratio_Setpoint": {
+                BRICK.hasQuantity: BRICK.Voltage,
                 "tags": [TAG.Point, TAG.Setpoint, TAG.Voltage, TAG.Electric, TAG.Ratio]
             },
             "Frequency_Setpoint": {
                 "tags": [TAG.Point, TAG.Setpoint, TAG.Frequency],
                 BRICK.hasQuantity: BRICK.Frequency,
             },
             "Illuminance_Setpoint": {
+                BRICK.hasQuantity: BRICK.Illuminance,
                 "tags": [TAG.Point, TAG.Setpoint, TAG.Illuminance]
             },
             "Enthalpy_Setpoint": {
                 BRICK.hasQuantity: QUDTQK.Enthalpy,
                 "tags": [TAG.Point, TAG.Setpoint, TAG.Enthalpy],
             },
             "Dewpoint_Setpoint": {
                 BRICK.hasQuantity: BRICK.Dewpoint,
                 "tags": [TAG.Point, TAG.Dewpoint, TAG.Setpoint],
             },
             "Demand_Setpoint": {
+                BRICK.hasQuantity: BRICK.Power,
                 "tags": [TAG.Point, TAG.Demand, TAG.Setpoint],
                 "subclasses": {
                     "Cooling_Demand_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Power,
                         "tags": [TAG.Point, TAG.Cool, TAG.Demand, TAG.Setpoint],
                     },
                     "Heating_Demand_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Power,
                         "tags": [TAG.Point, TAG.Heat, TAG.Demand, TAG.Setpoint],
                     },
                     "Preheat_Demand_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Power,
                         "tags": [TAG.Point, TAG.Preheat, TAG.Demand, TAG.Setpoint],
                     },
                     "Air_Flow_Demand_Setpoint": {
                         BRICK.hasSubstance: BRICK.Air,
                         BRICK.hasQuantity: BRICK.Flow,
                         "tags": [
                             TAG.Point,
                             TAG.Air,
                             TAG.Flow,
                             TAG.Demand,
                             TAG.Setpoint,
                         ],
                         "subclasses": {
                             "Supply_Air_Flow_Demand_Setpoint": {
                                 BRICK.hasSubstance: [
                                     BRICK.Supply_Air,
                                     BRICK.Discharge_Air,
                                 ],
                                 BRICK.hasQuantity: BRICK.Flow,
                                 "aliases": [
                                     BRICK["Discharge_Air_Flow_Demand_Setpoint"]
                                 ],
                                 "tags": [
                                     TAG.Point,
                                     TAG.Supply,
                                     TAG.Discharge,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Demand,
                                     TAG.Setpoint,
                                 ],
                             },
                         },
                     },
                 },
             },
```

* aider: Add BRICK.hasQuantity annotations to subclasses of Flow_Setpoint in setpoint.py.

# Aider chat conversation:

USER: For all subclasses of `Flow_Setpoint` in bricksrc/setpoint.py, add a BRICK.hasQuantity annotation (if it does not already have one) using the correct quantity from bricksrc/quantities.py. If one does not exist, use a QUDT quantity kind from the QUDTQK namespace. For "Demand", just use BRICK.Power

ASSISTANT: ```diff
--- bricksrc/setpoint.py
+++ bricksrc/setpoint.py
@@ ... @@
             "Flow_Setpoint": {
+                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                 "tags": [TAG.Point, TAG.Flow, TAG.Setpoint],
                 "subclasses": {
                     "Air_Flow_Setpoint": {
+                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                         BRICK.hasSubstance: BRICK.Air,
                         "tags": [TAG.Point, TAG.Air, TAG.Flow, TAG.Setpoint],
                         "subclasses": {
@@ ... @@
                             "Air_Flow_Demand_Setpoint": {
+                                BRICK.hasQuantity: BRICK.Power,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Demand,
                                     TAG.Setpoint,
                                 ],
                             },
@@ ... @@
                             "Exhaust_Air_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Exhaust_Air,
                                 "subclasses": {
                                     "Exhaust_Air_Stack_Flow_Setpoint": {
+                                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                         "tags": [
                                             TAG.Point,
                                             TAG.Exhaust,
                                             TAG.Air,
                                             TAG.Stack,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                     }
                                 },
                                 "tags": [
                                     TAG.Point,
                                     TAG.Exhaust,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Outside_Air_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Outside_Air,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Outside,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Supply_Air_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: [
                                     BRICK.Supply_Air,
                                     BRICK.Discharge_Air,
                                 ],
                                 "aliases": [BRICK["Discharge_Air_Flow_Setpoint"]],
                                 "subclasses": {
                                     "Supply_Air_Flow_Demand_Setpoint": {
+                                        BRICK.hasQuantity: BRICK.Power,
                                         "aliases": [
                                             BRICK["Discharge_Air_Flow_Demand_Setpoint"]
                                         ],
                                         "tags": [
                                             TAG.Point,
                                             TAG.Supply,
                                             TAG.Discharge,
                                             TAG.Air,
                                             TAG.Flow,
                                             TAG.Demand,
                                             TAG.Setpoint,
                                         ],
                                     },
                                     "Occupied_Supply_Air_Flow_Setpoint": {
                                         "aliases": [
                                             BRICK[
                                                 "Occupied_Discharge_Air_Flow_Setpoint"
                                             ]
                                         ],
                                         "subclasses": {
                                             "Occupied_Cooling_Supply_Air_Flow_Setpoint": {
                                                 "aliases": [
                                                     BRICK[
                                                         "Occupied_Cooling_Discharge_Air_Flow_Setpoint"
                                                     ]
                                                 ],
                                                 "tags": [
                                                     TAG.Point,
                                                     TAG.Occupied,
                                                     TAG.Cool,
                                                     TAG.Supply,
                                                     TAG.Discharge,
                                                     TAG.Air,
                                                     TAG.Flow,
                                                     TAG.Setpoint,
                                                 ],
                                                 "parents": [
                                                     BRICK.Cooling_Discharge_Air_Flow_Setpoint,
                                                     BRICK.Cooling_Supply_Air_Flow_Setpoint,
                                                 ],
                                             },
                                             "Occupied_Heating_Supply_Air_Flow_Setpoint": {
                                                 "aliases": [
                                                     BRICK[
                                                         "Occupied_Heating_Discharge_Air_Flow_Setpoint"
                                                     ]
                                                 ],
                                                 "tags": [
                                                     TAG.Point,
                                                     TAG.Occupied,
                                                     TAG.Heat,
                                                     TAG.Supply,
                                                     TAG.Discharge,
                                                     TAG.Air,
                                                     TAG.Flow,
                                                     TAG.Setpoint,
                                                 ],
                                                 "parents": [
                                                     BRICK.Heating_Discharge_Air_Flow_Setpoint,
                                                     BRICK.Heating_Supply_Air_Flow_Setpoint,
                                                 ],
                                             },
                                         },
                                         "tags": [
                                             TAG.Point,
                                             TAG.Occupied,
                                             TAG.Supply,
                                             TAG.Discharge,
                                             TAG.Air,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                     },
                                     "Unoccupied_Supply_Air_Flow_Setpoint": {
                                         "aliases": [
                                             BRICK[
                                                 "Unoccupied_Discharge_Air_Flow_Setpoint"
                                             ]
                                         ],
                                         "subclasses": {
                                             "Unoccupied_Cooling_Supply_Air_Flow_Setpoint": {
                                                 "aliases": [
                                                     BRICK[
                                                         "Unoccupied_Cooling_Discharge_Air_Flow_Setpoint"
                                                     ]
                                                 ],
                                                 "tags": [
                                                     TAG.Point,
                                                     TAG.Unoccupied,
                                                     TAG.Cool,
                                                     TAG.Supply,
                                                     TAG.Discharge,
                                                     TAG.Air,
                                                     TAG.Flow,
                                                     TAG.Setpoint,
                                                 ],
                                                 "parents": [
                                                     BRICK.Cooling_Discharge_Air_Flow_Setpoint,
                                                     BRICK.Cooling_Supply_Air_Flow_Setpoint,
                                                 ],
                                             },
                                             "Unoccupied_Heating_Supply_Air_Flow_Setpoint": {
                                                 "aliases": [
                                                     BRICK[
                                                         "Unoccupied_Heating_Discharge_Air_Flow_Setpoint"
                                                     ]
                                                 ],
                                                 "tags": [
                                                     TAG.Point,
                                                     TAG.Unoccupied,
                                                     TAG.Heat,
                                                     TAG.Supply,
                                                     TAG.Discharge,
                                                     TAG.Air,
                                                     TAG.Flow,
                                                     TAG.Setpoint,
                                                 ],
                                                 "parents": [
                                                     BRICK.Heating_Discharge_Air_Flow_Setpoint,
                                                     BRICK.Heating_Supply_Air_Flow_Setpoint,
                                                 ],
                                             },
                                         },
                                         "tags": [
                                             TAG.Point,
                                             TAG.Unoccupied,
                                             TAG.Supply,
                                             TAG.Discharge,
                                             TAG.Air,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                     },
                                     "Cooling_Supply_Air_Flow_Setpoint": {
                                         "aliases": [
                                             BRICK["Cooling_Discharge_Air_Flow_Setpoint"]
                                         ],
                                         "tags": [
                                             TAG.Point,
                                             TAG.Cool,
                                             TAG.Supply,
                                             TAG.Discharge,
                                             TAG.Air,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                     },
                                     "Heating_Supply_Air_Flow_Setpoint": {
                                         "aliases": [
                                             BRICK["Heating_Discharge_Air_Flow_Setpoint"]
                                         ],
                                         "tags": [
                                             TAG.Point,
                                             TAG.Heat,
                                             TAG.Supply,
                                             TAG.Discharge,
                                             TAG.Air,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                     },
                                 },
                                 "tags": [
                                     TAG.Point,
                                     TAG.Supply,
                                     TAG.Discharge,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                         },
                     },
                     "Water_Flow_Setpoint": {
+                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                         BRICK.hasSubstance: BRICK.Water,
                         "tags": [
                             TAG.Point,
                             TAG.Water,
                             TAG.Flow,
                             TAG.Setpoint,
                         ],
                         "subclasses": {
                             "Condenser_Water_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Condenser_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Condenser,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Entering_Water_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Entering_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Entering,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                                 "subclasses": {
                                     "Entering_Chilled_Water_Flow_Setpoint": {
+                                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                         BRICK.hasSubstance: BRICK.Entering_Chilled_Water,
                                         "tags": [
                                             TAG.Point,
                                             TAG.Chilled,
                                             TAG.Water,
                                             TAG.Entering,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                         "parents": [BRICK.Chilled_Water_Flow_Setpoint],
                                     },
                                     "Entering_Hot_Water_Flow_Setpoint": {
+                                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                         BRICK.hasSubstance: BRICK.Entering_Hot_Water,
                                         "tags": [
                                             TAG.Point,
                                             TAG.Hot,
                                             TAG.Water,
                                             TAG.Entering,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                         "parents": [BRICK.Hot_Water_Flow_Setpoint],
                                     },
                                 },
                             },
                             "Leaving_Water_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Leaving_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Leaving,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                                 "subclasses": {
                                     "Leaving_Chilled_Water_Flow_Setpoint": {
+                                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                         BRICK.hasSubstance: BRICK.Leaving_Chilled_Water,
                                         "tags": [
                                             TAG.Point,
                                             TAG.Chilled,
                                             TAG.Water,
                                             TAG.Leaving,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                         "parents": [BRICK.Chilled_Water_Flow_Setpoint],
                                     },
                                     "Leaving_Hot_Water_Flow_Setpoint": {
+                                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                         BRICK.hasSubstance: BRICK.Leaving_Hot_Water,
                                         "tags": [
                                             TAG.Point,
                                             TAG.Hot,
                                             TAG.Water,
                                             TAG.Leaving,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                         "parents": [BRICK.Hot_Water_Flow_Setpoint],
                                     },
                                 },
                             },
                             "Hot_Water_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Hot_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Hot,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Chilled_Water_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Chilled_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Chilled,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Bypass_Water_Flow_Setpoint": {
+                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
                                 BRICK.hasSubstance: BRICK.Bypass_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Bypass,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                         },
                     },
                 },
             },
```

* aider: Replace BRICK.Flow_Loss, BRICK.Flow and BRICK.VolumeFlowRate with QUDTQK.VolumeFlowRate.

# Aider chat conversation:

USER: Replace BRICK.Flow_Loss, BRICK.Flow and BRICK.VolumeFlowRate with QUDTQK.VolumeFlowRate

ASSISTANT: ```diff
--- bricksrc/setpoint.py
+++ bricksrc/setpoint.py
@@ ... @@
             "Flow_Setpoint": {
-                BRICK.hasQuantity: BRICK.Flow,
-            "Flow_Setpoint": {
-                BRICK.hasQuantity: BRICK.VolumeFlowRate,
+                BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
                 "tags": [TAG.Point, TAG.Flow, TAG.Setpoint],
                 "subclasses": {
                     "Air_Flow_Setpoint": {
-                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
-                        BRICK.hasSubstance: BRICK.Air,
-                        BRICK.hasQuantity: BRICK.Flow,
+                        BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
+                        BRICK.hasSubstance: BRICK.Air,
                         "tags": [TAG.Point, TAG.Air, TAG.Flow, TAG.Setpoint],
                         "subclasses": {
                             "Air_Flow_Demand_Setpoint": {
                                 BRICK.hasQuantity: BRICK.Power,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Demand,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Exhaust_Air_Flow_Setpoint": {
-                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
-                                BRICK.hasSubstance: BRICK.Exhaust_Air,
-                                BRICK.hasQuantity: BRICK.Flow,
+                                BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
+                                BRICK.hasSubstance: BRICK.Exhaust_Air,
                                 "subclasses": {
                                     "Exhaust_Air_Stack_Flow_Setpoint": {
-                                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
+                                        BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
                                         "tags": [
                                             TAG.Point,
                                             TAG.Exhaust,
                                             TAG.Air,
                                             TAG.Stack,
                                             TAG.Flow,
                                             TAG.Setpoint,
                                         ],
                                     }
                                 },
                                 "tags": [
                                     TAG.Point,
                                     TAG.Exhaust,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Outside_Air_Flow_Setpoint": {
-                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
-                                BRICK.hasSubstance: BRICK.Outside_Air,
-                                BRICK.hasQuantity: BRICK.Flow,
+                                BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
+                                BRICK.hasSubstance: BRICK.Outside_Air,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Outside,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             "Supply_Air_Flow_Setpoint": {
-                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
-                                BRICK.hasSubstance: [
-                                    BRICK.Supply_Air,
-                                    BRICK.Discharge_Air,
-                                ],
-                                BRICK.hasQuantity: BRICK.Flow,
+                                BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
+                                BRICK.hasSubstance: [
+                                    BRICK.Supply_Air,
+                                    BRICK.Discharge_Air,
+                                ],
                                 "aliases": [BRICK["Discharge_Air_Flow_Setpoint"]],
                                 "subclasses": {
                                     "Supply_Air_Flow_Demand_Setpoint": {
                                         BRICK.hasQuantity: BRICK.Power,
                                         "aliases": [
                                             BRICK["Discharge_Air_Flow_Demand_Setpoint"]
                                         ],
                                         "tags": [
                                             TAG.Point,
                                             TAG.Supply,
                                             TAG.Discharge,
                                             TAG.Air,
                                             TAG.Flow,
                                             TAG.Demand,
                                             TAG.Setpoint,
                                         ],
                                     },
                                     ...
                                 },
                                 "tags": [
                                     TAG.Point,
                                     TAG.Supply,
                                     TAG.Discharge,
                                     TAG.Air,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                         },
                     },
                     "Water_Flow_Setpoint": {
-                        BRICK.hasQuantity: BRICK.VolumeFlowRate,
-                        BRICK.hasSubstance: BRICK.Water,
-                        BRICK.hasQuantity: BRICK.Flow,
+                        BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
+                        BRICK.hasSubstance: BRICK.Water,
                         "tags": [
                             TAG.Point,
                             TAG.Water,
                             TAG.Flow,
                             TAG.Setpoint,
                         ],
                         "subclasses": {
                             "Condenser_Water_Flow_Setpoint": {
-                                BRICK.hasQuantity: BRICK.VolumeFlowRate,
-                                BRICK.hasSubstance: BRICK.Condenser_Water,
-                                BRICK.hasQuantity: BRICK.Flow,
+                                BRICK.hasQuantity: QUDTQK.VolumeFlowRate,
+                                BRICK.hasSubstance: BRICK.Condenser_Water,
                                 "tags": [
                                     TAG.Point,
                                     TAG.Condenser,
                                     TAG.Water,
                                     TAG.Flow,
                                     TAG.Setpoint,
                                 ],
                             },
                             ...
                         },
                     },
                 },
             },
@@ ... @@
```

* aider: Ensure all subclasses of `Humidity_Setpoint` use the correct quantity annotation from bricksrc/quantities.py or QUDTQK namespace.

# Aider chat conversation:

USER: For all subclasses of `Humidity_Setpoint` in bricksrc/setpoint.py, add a BRICK.hasQuantity annotation (if it does not already have one) using the correct quantity from bricksrc/quantities.py. If one does not exist, use a QUDT quantity kind from the QUDTQK namespace. For "Demand", just use BRICK.Power

ASSISTANT: ```diff
--- bricksrc/setpoint.py
+++ bricksrc/setpoint.py
@@ ... @@
             "Humidity_Setpoint": {
+                BRICK.hasQuantity: BRICK.Relative_Humidity,
                 "tags": [TAG.Point, TAG.Humidity, TAG.Setpoint],
                 "subclasses": {
                     "Unoccupied_Humidity_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Relative_Humidity,
                         "tags": [TAG.Point, TAG.Humidity, TAG.Setpoint, TAG.Unoccupied],
                     },
                     "Occupied_Humidity_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Relative_Humidity,
                         "tags": [TAG.Point, TAG.Humidity, TAG.Setpoint, TAG.Occupied],
                     },
                     "Bypass_Air_Humidity_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Relative_Humidity,
                         BRICK.hasSubstance: BRICK.Bypass_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Bypass,
                         ],
                     },
                     "Outside_Air_Humidity_Setpoint": {
+                        BRICK.hasQuantity: BRICK.Relative_Humidity,
                         BRICK.hasSubstance: BRICK.Outside_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air
^C KeyboardInterrupt

USER: For all subclasses of `Humidity_Setpoint` in bricksrc/setpoint.py ensure that the BRICK.hasQuantity value is QUDTQK.RelativeHumidity *unless* the class is an absolute humidity class, which should use QUDTQK.AbsoluteHumidity

ASSISTANT: ```diff
--- bricksrc/setpoint.py
+++ bricksrc/setpoint.py
@@ ... @@
             "Humidity_Setpoint": {
-                BRICK.hasQuantity: BRICK.Relative_Humidity,
+                BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                 "tags": [TAG.Point, TAG.Humidity, TAG.Setpoint],
                 "subclasses": {
                     "Unoccupied_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         "tags": [TAG.Point, TAG.Humidity, TAG.Setpoint, TAG.Unoccupied],
                     },
                     "Occupied_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         "tags": [TAG.Point, TAG.Humidity, TAG.Setpoint, TAG.Occupied],
                     },
                     "Bypass_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Bypass_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Bypass,
                         ],
                     },
                     "Outside_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Outside_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Outside,
                         ],
                     },
                     "Zone_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Zone_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Zone,
                         ],
                     },
                     "Building_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Building_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Building,
                         ],
                     },
                     "Mixed_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Mixed_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Mixed,
                         ],
                     },
                     "Return_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Return_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Return,
                         ],
                     },
                     "Exhaust_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: BRICK.Exhaust_Air,
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Exhaust,
                         ],
                     },
                     "Supply_Air_Humidity_Setpoint": {
-                        BRICK.hasQuantity: BRICK.Relative_Humidity,
+                        BRICK.hasQuantity: QUDTQK.RelativeHumidity,
                         BRICK.hasSubstance: [BRICK.Supply_Air, BRICK.Discharge_Air],
                         "aliases": [BRICK["Discharge_Air_Humidity_Setpoint"]],
                         "tags": [
                             TAG.Point,
                             TAG.Humidity,
                             TAG.Setpoint,
                             TAG.Air,
                             TAG.Supply,
                             TAG.Discharge,
                         ],
                     },
                 },
             },
@@ ... @@
```

* Remove unused quantity definitions and references.

* Update setpoint definitions to use QUDTQK for volume flow rate and relative humidity.

* qudt flow

* more quantity fixes

* aider: Added function to recursively inherit BRICK.hasQuantity annotation down subclass tree.

# Aider chat conversation:

USER: I did `git reset --hard HEAD~1` to discard the last edits.

ASSISTANT: Understood. If you need any changes to be made to the `generate_brick.py` file or any other *read-write* files, please let me know the specific modifications you require.

USER: Make sure that the BRICK.hasQuantity annotation is inherited down the subclass tree unless a subclass already specifies a BRICK.hasQuantity

ASSISTANT: To ensure that the `BRICK.hasQuantity` annotation is inherited down the subclass tree unless a subclass already specifies a `BRICK.hasQuantity`, I will implement a recursive function that traverses the class hierarchy and adds the `BRICK.hasQuantity` annotation from parent to child, unless the child already has the annotation defined.

Here is the diff for the changes:

```diff
--- generate_brick.py
+++ generate_brick.py
@@ ... @@

+def inherit_has_quantity(definitions, parent_quantity=None):
+    """
+    Recursively ensures that the BRICK.hasQuantity annotation is inherited down the
+    subclass tree unless a subclass already specifies a BRICK.hasQuantity.
+    """
+    for classname, defn in definitions.items():
+        # Inherit BRICK.hasQuantity from parent if not defined in the current class
+        if 'hasQuantity' not in defn and parent_quantity is not None:
+            defn['hasQuantity'] = parent_quantity
+
+        # Recursively apply to subclasses
+        subclassdef = defn.get("subclasses", {})
+        assert isinstance(subclassdef, dict)
+        inherit_has_quantity(subclassdef, defn.get('hasQuantity', parent_quantity))
+
+inherit_has_quantity(equipment_subclasses)
+inherit_has_quantity(location_subclasses)
+inherit_has_quantity(point_subclasses)
+inherit_has_quantity(collection_classes)
+inherit_has_quantity(hvac_subclasses)
+inherit_has_quantity(hvac_valve_subclasses)
+inherit_has_quantity(valve_subclasses)
+inherit_has_quantity(security_subclasses)
+inherit_has_quantity(safety_subclasses)
+
 def define_classes(definitions, parent, pun_classes=False, graph=G):
     """
     Generates triples for the hierarchy given by 'definitions', rooted
@@ ... @@
```

This change adds a new function `inherit_has_quantity` that is called for each of the root class hierarchies in the Brick model. The function will traverse the class definitions and ensure that the `BRICK.hasQuantity` annotation is properly inherited unless overridden by a subclass.

* Remove redundant BRICK.hasQuantity properties and update one occurrence to use QUDTQK.Power.

* Add BRICK.hasQuantity to every subclass in setpoint.py.

* working with quantities

* skolemize entity properties when doing subproperties

add Brick Quantity classes or QUDTQK QuantityKinds to every subclass in setpoint.py under the BRICK.hasQuantity key. Skip all subclasses that already have a BRICK.hasQuantityKey. Give the results to me as a code diff. Use the name of the subclass to make a good guess at the correct Brick quantity or QUDT quantitykind

* Removed "Dewpoint" from `bricksrc/quantities.py` and replaced all references to it in `bricksrc/setpoint.py` with QUDTQK.DewPointTemperature.

* Change sensor quantity property to use QUDTQK for dewpoint temperature.

* Replace all references to BRICK.Dewpoint in `bricksrc/sensor.py` with QUDTQK.DewPointTemperature.

* Fix the syntax in bricksrc/setpoint.py.

* Removed unnecessary BRICK.hasQuantity and BRICK.hasSubstance properties from setpoint definitions.

* Add appropriate tags to the `Demand_Setpoint` subclass.

* Add BRICK.hasQuantity with value QUDTQK.Temperature to the Temperature_Setpoint class.

* Add BRICK.hasQuantity with value QUDTQK.VolumeFlowRate to the Flow_Setpoint class.

* Remove duplicate "BRICK.hasQuantity: QUDTQK.DewPointTemperature" entries in sensor definitions.

* add quantities to all sensors and setpoints

* remove old definitions

* import ref-schema

* fix sparqltarget in rules

* removing bad html from qudt

* add rdf prefix to ref-schema

* adjusting tests

* bump deps

* bump brickschema

* bump deps

* bump brickschema

* always initialize ontoenv

---------

Co-authored-by: Gabe Fierro <[email protected]>
  • Loading branch information
steveraysteveray and gtfierro authored Jan 4, 2024
1 parent 6dcb766 commit a831264
Show file tree
Hide file tree
Showing 37 changed files with 3,913 additions and 3,402 deletions.
18 changes: 14 additions & 4 deletions bricksrc/alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
],
"subclasses": {
"Low_Supply_Air_Flow_Alarm": {
"aliases": [BRICK["Low_Discharge_Air_Flow_Alarm"]],
"aliases": [
BRICK["Low_Discharge_Air_Flow_Alarm"]
],
"tags": [
TAG.Point,
TAG.Air,
Expand Down Expand Up @@ -217,7 +219,11 @@
],
"subclasses": {
"High_Supply_Air_Temperature_Alarm": {
"aliases": [BRICK["High_Discharge_Air_Temperature_Alarm"]],
"aliases": [
BRICK[
"High_Discharge_Air_Temperature_Alarm"
]
],
"tags": [
TAG.Point,
TAG.High,
Expand All @@ -230,7 +236,9 @@
"parents": [BRICK.High_Temperature_Alarm],
},
"Low_Supply_Air_Temperature_Alarm": {
"aliases": [BRICK["Low_Discharge_Air_Temperature_Alarm"]],
"aliases": [
BRICK["Low_Discharge_Air_Temperature_Alarm"]
],
"tags": [
TAG.Point,
TAG.Low,
Expand Down Expand Up @@ -288,7 +296,9 @@
"tags": [TAG.Point, TAG.Smoke, TAG.Detection, TAG.Alarm],
"subclasses": {
"Supply_Air_Smoke_Detection_Alarm": {
"aliases": [BRICK["Discharge_Air_Smoke_Detection_Alarm"]],
"aliases": [
BRICK["Discharge_Air_Smoke_Detection_Alarm"]
],
"tags": [
TAG.Point,
TAG.Supply,
Expand Down
9 changes: 8 additions & 1 deletion bricksrc/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
},
"Gas_System": {"tags": [TAG.Gas, TAG.System]},
"Heating_Ventilation_Air_Conditioning_System": {
"tags": [TAG.Heat, TAG.Ventilation, TAG.Air, TAG.Conditioning, TAG.HVAC, TAG.System],
"tags": [
TAG.Heat,
TAG.Ventilation,
TAG.Air,
TAG.Conditioning,
TAG.HVAC,
TAG.System,
],
"aliases": [BRICK["HVAC_System"]],
"subclasses": {
"Air_System": {
Expand Down
1 change: 0 additions & 1 deletion bricksrc/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
},
"Humidify_Command": {
"tags": [TAG.Point, TAG.Humidify, TAG.Command],
BRICK.hasQuantity: BRICK.Humidity,
},
"Position_Command": {
"tags": [TAG.Point, TAG.Position, TAG.Command],
Expand Down
15 changes: 0 additions & 15 deletions bricksrc/definitions.csv

Large diffs are not rendered by default.

42 changes: 26 additions & 16 deletions bricksrc/deprecations.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
from .namespaces import BRICK, RDFS, SKOS, A

deprecations = {
BRICK.Heat_Sensor: {
"version": "1.4.0",
"mitigation_message": "This class has a poor definition is supplanted by Temperature_Sensor",
"replace_with": BRICK.Temperature_Sensor,
},
BRICK.Trace_Heat_Sensor: {
"version": "1.4.0",
"mitigation_message": "Removed due to unclear definition",
"replace_with": BRICK.Sensor,
},
BRICK.Solar_Radiance_Sensor: {
"version": "1.3.0",
"mitigation_message": "The class 'Solar_Radiance_Sensor' is deprecated in favor of 'Solar_Irradiance_Sensor'. The new name better reflects the standard unit of measurement, watts per square meter (W/m²), and aligns with the terminology commonly used in solar applications.",
"replace_with": BRICK.Solar_Irradiance_Sensor,
RDFS.subClassOf: BRICK.Sensor,
},
BRICK.Occupied_Air_Temperature_Cooling_Setpoint: {
"version": "1.3.0",
"mitigation_message": "'Occupied_Air_Temperature_Cooling_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Occupied_Cooling_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Occupied_Air_Temperature_Setpoint,
"version": "1.3.0",
"mitigation_message": "'Occupied_Air_Temperature_Cooling_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Occupied_Cooling_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Occupied_Air_Temperature_Setpoint,
},
BRICK.Occupied_Air_Temperature_Heating_Setpoint: {
"version": "1.3.0",
"mitigation_message": "'Occupied_Air_Temperature_Heating_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Occupied_Heating_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Occupied_Air_Temperature_Setpoint,
"version": "1.3.0",
"mitigation_message": "'Occupied_Air_Temperature_Heating_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Occupied_Heating_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Occupied_Air_Temperature_Setpoint,
},
BRICK.Unoccupied_Air_Temperature_Cooling_Setpoint: {
"version": "1.3.0",
"mitigation_message": "'Unoccupied_Air_Temperature_Cooling_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Unoccupied_Cooling_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Unoccupied_Air_Temperature_Setpoint,
"version": "1.3.0",
"mitigation_message": "'Unoccupied_Air_Temperature_Cooling_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Unoccupied_Cooling_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Unoccupied_Air_Temperature_Setpoint,
},
BRICK.Unoccupied_Air_Temperature_Heating_Setpoint: {
"version": "1.3.0",
"mitigation_message": "'Unoccupied_Air_Temperature_Heating_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Unoccupied_Heating_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Unoccupied_Air_Temperature_Setpoint,
"version": "1.3.0",
"mitigation_message": "'Unoccupied_Air_Temperature_Heating_Setpoint' is deprecated in favor of further specifying that it is a zone air setpoint.",
"replace_with": BRICK.Unoccupied_Heating_Zone_Air_Temperature_Setpoint,
RDFS.subClassOf: BRICK.Unoccupied_Air_Temperature_Setpoint,
},
BRICK.Effective_Air_Temperature_Cooling_Setpoint: {
"version": "1.3.0",
Expand Down
6 changes: 3 additions & 3 deletions bricksrc/entity_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from collections import defaultdict
from rdflib import Literal
from .namespaces import BRICK, RDFS, SKOS, UNIT, XSD, SH, BSH, REF
from .namespaces import BRICK, RDFS, SKOS, UNIT, XSD, SH, BSH, REF, QUDTQK

# these are the "relationship"/predicates/OWL properties that
# relate a Brick entity to a structured value.
Expand Down Expand Up @@ -461,7 +461,7 @@
BRICK.longitude: {"datatype": BSH.NumericValue},
},
},
BSH.TiltShape: {"unitsFromQuantity": BRICK.Angle, "datatype": BSH.NumericValue},
BSH.TiltShape: {"unitsFromQuantity": QUDTQK.Angle, "datatype": BSH.NumericValue},
BSH.TemperatureShape: {
"unitsFromQuantity": BRICK.Temperature,
"datatype": BSH.NumericValue,
Expand All @@ -471,7 +471,7 @@
"datatype": BSH.NumericValue,
},
BSH.AzimuthShape: {
"unitsFromQuantity": BRICK.Angle,
"unitsFromQuantity": QUDTQK.Angle,
"datatype": BSH.NumericValue,
"rotationalDirection": {"values": ["clockwise", "counterclockwise"]},
"referenceDirection": {"values": ["North", "South", "East", "West"]},
Expand Down
11 changes: 6 additions & 5 deletions bricksrc/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
ontology_imports = {
"qudtschema": "http://qudt.org/2.1/schema/shacl/qudt",
"qudtoverlay": "http://qudt.org/2.1/schema/shacl/overlay/qudt",
"qudtfacade": "http://qudt.org/2.1/schema/facade/qudt",
"qudtsou": "http://qudt.org/2.1/vocab/sou",
"unit": "http://qudt.org/2.1/vocab/unit",
"currency": "http://qudt.org/2.1/vocab/currency",
"quantitykind": "http://qudt.org/2.1/vocab/quantitykind",
"dimensionvector": "http://qudt.org/2.1/vocab/dimensionvector",
"bacnet": "http://data.ashrae.org/bacnet/2020",
"quantitykind": "http://qudt.org/2.1/vocab/quantitykind",
"qudtsou": "http://qudt.org/2.1/vocab/sou",
"qudtdv": "http://qudt.org/2.1/vocab/dimensionvector",
"qudtprefix": "http://qudt.org/2.1/vocab/prefix",
"ref": "https://brickschema.org/schema/Brick/ref",
}

shacl_namespace_declarations = [
Expand Down Expand Up @@ -80,6 +80,7 @@

BRICK_IRI_VERSION = URIRef(f"https://brickschema.org/schema/{BRICK_VERSION}/Brick")


def define_ontology(G):
G.add((BRICK_IRI_VERSION, RDF.type, OWL.Ontology))
G.add((BRICK_IRI_VERSION, RDFS.isDefinedBy, BRICK_IRI_VERSION))
Expand Down
Loading

0 comments on commit a831264

Please sign in to comment.