Skip to content

Commit

Permalink
Adding Differential Quantities to Brick (#294)
Browse files Browse the repository at this point in the history
* try differential static pressure

* working on more differential quantities, adding annotations to sensors

* fix annotation

* fix some quantities

* fix inference related to differential sensors

* fix co2 sensor query test
  • Loading branch information
gtfierro authored Jul 29, 2021
1 parent 8dfd939 commit cfdded8
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 10 deletions.
42 changes: 41 additions & 1 deletion bricksrc/quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ def get_units(qudt_quantity):
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("COConcentration"),
SKOS.broader: QUDTQK.DimensionlessRatio,
SKOS.narrower: {
"Differential_CO_Concentration": {
QUDT.isDeltaQuantity: Literal(True),
QUDT.applicableUnit: [UNIT.PPM, UNIT.PPB],
SKOS.definition: Literal(
"The difference in carbon monoxide concentration between two areas"
),
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("ΔCOConcentration"),
},
},
},
"CO2_Concentration": {
QUDT.applicableUnit: [UNIT.PPM, UNIT.PPB],
Expand All @@ -55,6 +66,17 @@ def get_units(qudt_quantity):
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("CO2Concentration"),
SKOS.broader: QUDTQK.DimensionlessRatio,
SKOS.narrower: {
"Differential_CO2_Concentration": {
QUDT.isDeltaQuantity: Literal(True),
QUDT.applicableUnit: [UNIT.PPM, UNIT.PPB],
SKOS.definition: Literal(
"The difference in carbon dioxide concentration between two areas"
),
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("ΔCO2Concentration"),
},
},
},
"Formaldehyde_Concentration": {
QUDT.applicableUnit: [UNIT.PPM, UNIT.PPB],
Expand Down Expand Up @@ -557,7 +579,15 @@ def get_units(qudt_quantity):
BRICK.hasQUDTReference: QUDTQK["AtmosphericPressure"]
},
"Dynamic_Pressure": {},
"Static_Pressure": {BRICK.hasQUDTReference: QUDTQK["StaticPressure"]},
"Static_Pressure": {
BRICK.hasQUDTReference: QUDTQK["StaticPressure"],
SKOS.narrower: {
"Differential_Static_Pressure": {
BRICK.hasQUDTReference: QUDTQK["StaticPressure"],
QUDT.isDeltaQuantity: Literal(True),
},
},
},
"Velocity_Pressure": {
BRICK.hasQUDTReference: [
QUDTQK["DynamicPressure"],
Expand Down Expand Up @@ -608,6 +638,10 @@ def get_units(qudt_quantity):
"Temperature": {
BRICK.hasQUDTReference: QUDTQK["ThermodynamicTemperature"],
SKOS.narrower: {
"Differential_Temperature": {
BRICK.hasQUDTReference: QUDTQK["ThermodynamicTemperature"],
QUDT.isDeltaQuantity: Literal(True),
},
"Operative_Temperature": {
QUDT.applicableUnit: [UNIT["DEG_F"], UNIT["DEG_C"], UNIT["K"]],
SKOS.definition: Literal(
Expand Down Expand Up @@ -637,6 +671,12 @@ def get_units(qudt_quantity):
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("Dry_Bulb_Temperature"),
SKOS.broader: QUDTQK.ThermodynamicTemperature,
SKOS.narrower: {
"Differential_Dry_Bulb_Temperature": {
BRICK.hasQUDTReference: QUDTQK["Dry_Bulb_Temperature"],
QUDT.isDeltaQuantity: Literal(True),
},
},
},
"Wet_Bulb_Temperature": {
QUDT.applicableUnit: [UNIT["DEG_F"], UNIT["DEG_C"], UNIT["K"]],
Expand Down
66 changes: 58 additions & 8 deletions bricksrc/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@
"tags": [TAG.Point, TAG.Sensor, TAG.CO],
"substances": [
[BRICK.measures, BRICK.Air],
[BRICK.measures, BRICK.CO],
[BRICK.measures, BRICK.CO_Concentration],
],
"subclasses": {
"CO_Level_Sensor": {
"tags": [TAG.Point, TAG.CO, TAG.Level, TAG.Sensor],
},
"CO_Differential_Sensor": {
"substances": [
[BRICK.measures, BRICK.Air],
[
BRICK.measures,
BRICK.Differential_CO_Concentration,
],
],
"tags": [
TAG.Point,
TAG.CO,
Expand All @@ -47,7 +54,7 @@
],
"substances": [
[BRICK.measures, BRICK.Outside_Air],
[BRICK.measures, BRICK.CO],
[BRICK.measures, BRICK.CO_Concentration],
],
},
"Return_Air_CO_Sensor": {
Expand All @@ -69,10 +76,17 @@
"tags": [TAG.Point, TAG.Sensor, TAG.CO2],
"substances": [
[BRICK.measures, BRICK.Air],
[BRICK.measures, BRICK.CO2],
[BRICK.measures, BRICK.CO2_Concentration],
],
"subclasses": {
"CO2_Differential_Sensor": {
"substances": [
[BRICK.measures, BRICK.Air],
[
BRICK.measures,
BRICK.Differential_CO2_Concentration,
],
],
"tags": [
TAG.Point,
TAG.CO2,
Expand Down Expand Up @@ -115,7 +129,7 @@
"tags": [TAG.Point, TAG.Sensor, TAG.Level, TAG.NO2],
"substances": [
[BRICK.measures, BRICK.Air],
[BRICK.measures, BRICK.NO2],
[BRICK.measures, BRICK.NO2_Concentration],
],
},
"Formaldehyde_Level_Sensor": {
Expand Down Expand Up @@ -1149,10 +1163,16 @@
"subclasses": {
"Differential_Pressure_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Pressure, TAG.Differential],
"substances": [
[BRICK.measures, BRICK.Differential_Static_Pressure]
],
"subclasses": {
"Air_Differential_Pressure_Sensor": {
"substances": [
[BRICK.measures, BRICK.Pressure],
[
BRICK.measures,
BRICK.Differential_Static_Pressure,
],
[BRICK.measures, BRICK.Air],
],
"tags": [
Expand All @@ -1165,7 +1185,10 @@
"subclasses": {
"Return_Air_Differential_Pressure_Sensor": {
"substances": [
[BRICK.measures, BRICK.Pressure],
[
BRICK.measures,
BRICK.Differential_Static_Pressure,
],
[BRICK.measures, BRICK.Return_Air],
],
"tags": [
Expand All @@ -1189,7 +1212,10 @@
TAG.Chilled,
],
"substances": [
[BRICK.measures, BRICK.Pressure],
[
BRICK.measures,
BRICK.Differential_Static_Pressure,
],
[BRICK.measures, BRICK.Chilled_Water],
],
},
Expand All @@ -1212,7 +1238,10 @@
TAG.Hot,
],
"substances": [
[BRICK.measures, BRICK.Pressure],
[
BRICK.measures,
BRICK.Differential_Static_Pressure,
],
[BRICK.measures, BRICK.Hot_Water],
],
"subclasses": {
Expand Down Expand Up @@ -1867,6 +1896,13 @@
],
"subclasses": {
"Chilled_Water_Differential_Temperature_Sensor": {
"substances": [
[
BRICK.measures,
BRICK.Differential_Temperature,
],
[BRICK.measures, BRICK.Chilled_Water],
],
"tags": [
TAG.Point,
TAG.Chilled,
Expand Down Expand Up @@ -2008,6 +2044,20 @@
],
},
"Differential_Supply_Return_Water_Temperature_Sensor": {
"substances": [
[
BRICK.measures,
BRICK.Differential_Temperature,
],
[
BRICK.measures,
BRICK.Supply_Water,
],
[
BRICK.measures,
BRICK.Return_Water,
],
],
"tags": [
TAG.Point,
TAG.Differential,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_tag_inference():
res2 = make_readable(
g.query(
"SELECT DISTINCT ?sensor WHERE {\
?sensor brick:measures brick:CO2\
?sensor brick:measures brick:CO2_Concentration\
}"
)
)
Expand Down

0 comments on commit cfdded8

Please sign in to comment.