Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions schema/ifcx-quantity-kinds.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum QuantityKind
{
PlaneAngle: "Plane angle";
ThermodynamicTemperatue: "Thermodynamic temperature",
CelsiusTemperature: "Celsius temperature",
ElectricCurrent: "Electric current",
Time: "Time",
Frequency: "Frequency",
Expand All @@ -15,4 +16,7 @@ enum QuantityKind
Energy: "Energy",
Power: "Power",
Volume: "Volume",
MassDensity: "Mass density",
ThermalConductivity: "Thermal conductivity",
ThermalTransmittance: "Thermal transmittance"
}
4 changes: 4 additions & 0 deletions schema/out/@typespec/openapi3/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ components:
enum:
- Plane angle
- Thermodynamic temperature
- Celsius temperature
- Electric current
- Time
- Frequency
Expand All @@ -162,6 +163,9 @@ components:
- Energy
- Power
- Volume
- Mass density
- Thermal conductivity
- Thermal transmittance
code:
type: string
pattern: </[A-Za-z0-9]+>
Expand Down
18 changes: 16 additions & 2 deletions src/utils/python/populate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,22 @@

obj = json.load(open(sys.argv[1]))
known_quants = {
"volume": {"quantityKind": "Volume"},
"height": {"quantityKind": "Length"}
"planeAngle": {"quantityKind": "Plane angle"}, # Added
"thermodynamicTemperatue": {"quantityKind": "Thermodynamic temperatue"}, # Added
"celsiusTemperature": {"quantityKind": "Celsius temperature"}, # Added
"electricCurrent": {"quantityKind": "Electric current"}, # Added
"time": {"quantityKind": "Time"}, # Added
"frequency": {"quantityKind": "Frequency"}, # Added
"mass": {"quantityKind": "Mass"}, # Added
"length": {"quantityKind": "Length"}, # Changed "height" into "length" !
"linearVelocity": {"quantityKind": "Linear velocity"}, # Added
"force": {"quantityKind": "Force"}, # Added
"pressure": {"quantityKind": "Pressure"}, # Added
"area": {"quantityKind": "Area"}, # Added
"volume": {"quantityKind": "Volume"},
"massDensity": {"quantityKind": "Mass density"}, # Added
"thermalConductivity": {"quantityKind": "Thermal conductivity"}, # Added
"thermalTransmittance": {"quantityKind": "Thermal transmittance"} # Added
}

def make_schema(v, path=[]):
Expand Down
163 changes: 162 additions & 1 deletion src/viewer/compose-flattened.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,175 @@ function TreeNodeToComposedObject(path: string, node: PostCompositionNode, schem
{
let postfix = "";
let quantityKind = schema.value.quantityKind;
if (quantityKind === "Length")

if (quantityKind === "Plane angle") // Added
{
postfix = String.fromCodePoint(0x00B0);
}
else if (quantityKind === "Thermodynamic temperature") // Added
{
postfix = String.fromCodePoint(0x00B0) + "K";
}
else if (quantityKind === "Celsius temperature") // Added
{
postfix = String.fromCodePoint(0x00B0) + "C";
}
else if (quantityKind === "Electric current") // Added
{
postfix = "A";
}
else if (quantityKind === "Time") // Added
{
postfix = "s";
}
else if (quantityKind === "Frequency") // Added
{
postfix = "Hz";
}
else if (quantityKind === "Mass") // Added
{ // Though the prefix "Kilo" starts with an uppercase letter,
postfix = "kg"; // the respective abbreviation/ SI-symbol doesn't/ isn't one
} // (unlike presented in 'quantity-kinds_source_table.xlsx')
else if (quantityKind === "Length")
{
postfix = "m";
}
else if (quantityKind === "Linear velocity") // Added
{
postfix = "m/s";
}
else if (quantityKind === "Force") // Added
{
postfix = "N";
}
else if (quantityKind === "Pressure") // Added
{
postfix = "Pa";
}
else if (quantityKind === "Area") // Added
{
postfix = "m" + String.fromCodePoint(0x00B2);
}
else if (quantityKind === "Energy") // Added
{
postfix = "J";
}
else if (quantityKind === "Power") // Added
{
postfix = "W";
}
else if (quantityKind === "Volume")
{
postfix = "m" + String.fromCodePoint(0x00B3);
}
else if (quantityKind === "Mass density") // Added
{
postfix = "kg/m" + String.fromCodePoint(0x00B3);
}
else if (quantityKind === "Thermal conductivity") // Added
{
postfix = "W/mK";
}
else if (quantityKind === "Thermal transmittance") // Added
{
postfix = "W/m" + String.fromCodePoint(0x00B2) + "K";
}

/* // Other option to the many "else if" - statements above

switch(quantityKind) {
case "Plane angle":
{
postfix = String.fromCodePoint(0x00B0);
break;
}
case "Thermodynamic temperature":
{
postfix = String.fromCodePoint(0x00B0) + "K";
break;
}
case "Celsius temperature":
{
postfix = String.fromCodePoint(0x00B0) + "C";
break;
}
case "Electric current":
{
postfix = "A";
break;
}
case "Time":
{
postfix = "s";
break;
}
case "Frequency":
{
postfix = "Hz";
break;
}
case "Mass":
{
postfix = "kg"; // Though the prefix "Kilo" starts with an uppercase letter,
break; // the respective abbreviation/ SI-symbol doesn't/ isn't one
} // (unlike presented in 'quantity-kinds_source_table.xlsx')
case "Length":
{
postfix = "m";
break;
}
case "Linear velocity":
{
postfix = "m/s";
break;
}
case "Force":
{
postfix = "N";
break;
}
case "Pressure":
{
postfix = "Pa";
break;
}
case "Area":
{
postfix = "m" + String.fromCodePoint(0x00B2);
break;
}
case "Energy":
{
postfix = "J";
break;
}
case "Power":
{
postfix = "W";
break;
}
case "Volume":
{
postfix = "m" + String.fromCodePoint(0x00B3);
break;
}
case "Mass density":
{
postfix = "kg/m" + String.fromCodePoint(0x00B3);
break;
}
case "Thermal conductivity":
{
postfix = "W/mK";
break;
}
case "Thermal transmittance":
{
postfix = "W/m" + String.fromCodePoint(0x00B2) + "K";
break;
}
}
*/
co.attributes[attrName] = `${attr} ${postfix}`;
}
else
Expand Down