Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add open/close and dehumidify command #606

Closed

Conversation

connorjcantrell
Copy link
Contributor

Proposing to add Open Close Command and Dehumidify Command.

  • Open Close Command is a specific type of On Off Command, typically used for controlling dampers and valves.
  • Dehumidify Command is a command used to initiate the dehumidification process.

connorjcantrell and others added 12 commits December 21, 2023 09:16
…ema#603)

* Fix IndexError in `add_definitions` by checking list length before accessing elements

* Raise error if row is longer than header
* 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]>
* Add dampers

* Add wall air conditioner

* Add pressurization fan
* ensure that deprecated concepts are not always asserted to be owl:Class

* adding some evse concepts

* add evse example

* add directionality and expand enumerations

* working on more EVSe rules; put directionality on the port

* implement inference rules for charging directionality

* add test for EVSE example

* fix EVSE property definitions

* add inverse property rule

* fix datatypes on evse example

* use topquadrant reasoning on test

* use specialized logger

* final changes
@connorjcantrell
Copy link
Contributor Author

Due to rebase, tests are failing for unknown reason. Applied a patch to a new branch: #611

@connorjcantrell connorjcantrell deleted the add-open-close-command branch January 13, 2024 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants