### Build and Run IBR SDK Example using Bash Source: https://context7.com/google/digitalbuildings/llms.txt This bash command sequence shows how to build the IBR SDK project and then start a local HTTP server to run examples. It involves navigating to the SDK directory, running build commands, and then serving the files from the parent directory. ```bash cd digitalbuildings/ibr/ibr_sdk npm run build # Start local server cd digitalbuildings/ibr/ python3 -m http.server # Navigate to http://0.0.0.0:8000/examples/html/ ``` -------------------------------- ### Install with Setup (Deprecated) Source: https://github.com/google/digitalbuildings/blob/master/tools/scoring/README.md Installs dependencies for the scoring tool using the setup.py script. This method is to be deprecated. ```bash python3 setup.py install ``` -------------------------------- ### Building Configuration File Format Example Source: https://context7.com/google/digitalbuildings/llms.txt Example of a YAML building configuration file. These files map physical building assets to the ontology model, defining entities with types, translations, connections, and links. ```yaml # Building configuration file example CONFIG_METADATA: operation: INITIALIZE # Building entity US-SEA-BLDG1-GUID: type: FACILITIES/BUILDING code: US-SEA-BLDG1 # Floor entity with connection to building US-SEA-BLDG1-FLOOR1-GUID: type: FACILITIES/FLOOR code: US-SEA-BLDG1-FLOOR1 connections: US-SEA-BLDG1-GUID: CONTAINS ``` -------------------------------- ### Full Translation Configuration Example (YAML) Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/building_config.md A detailed example of a translation configuration in YAML format. It demonstrates how to map standard fields like 'zone_air_temperature_sensor' and 'supply_air_isolation_damper_command' to their corresponding paths and values within a device's native payload. This includes specifying present values, value ranges, units, and multistate mappings. ```yaml FCU-123: ... translation: zone_air_temperature_sensor: present_value: "points.temp_1.present_value" value_range: 15,25 units: key: "pointset.points.temp_1.units" values: degrees_celsius: "degC" supply_air_isolation_damper_command: present_value: "points.damper_1.present_value" states: OPEN: "1" CLOSED: - "2" - "3" zone_air_temperature_setpoint: MISSING ``` -------------------------------- ### Start Interactive Ontology Explorer using Bash Source: https://context7.com/google/digitalbuildings/llms.txt This bash command navigates to the Digital Buildings explorer tool directory and starts an interactive Python-based explorer. It also shows how to launch the explorer with a modified ontology, allowing for custom configurations. ```bash cd digitalbuildings/tools/explorer # Start interactive explorer python explorer.py # Start with modified ontology python explorer.py --modified-ontology-types=/path/to/modified/ontology ``` -------------------------------- ### Install Dependencies - Python Source: https://github.com/google/digitalbuildings/blob/master/tools/validators/ontology_validator/README.md Installs or upgrades pip and then installs the project's Python dependencies from the local setup.py file. This ensures all required packages are available. ```bash python3 -m pip install --upgrade pip ``` ```bash python3 -m pip install . ``` -------------------------------- ### Start Local Server with Python Source: https://github.com/google/digitalbuildings/blob/master/ibr/ibr_sdk/README.md Starts a local HTTP server using Python 3. This is used to serve the IBR project files, typically from the root 'ibr' directory. ```bash cd digitalbuildings/ibr/ python3 -m http.server ``` -------------------------------- ### Example Building Configuration for Metering System Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/meter_systems.md Provides a complete YAML configuration example for a building's metering system, including the building entity, meter devices, and load types. This demonstrates how to structure the configuration file for a simplified metering-only model. ```yaml # Building bldg: code: BLDG-123 type: FACILITIES/BUILDING # Meters m_main: code: M_MAIN type: METERS/EM connections: bldg: CONTAINS m_tc1: code: M_TC1 type: METERS/EM connections: m_main: FULLY_AGGREGATES bldg: CONTAINS m_4ha1: code: M_4HA1 type: METERS/EM connections: m_main: FULLY_AGGREGATES bldg: CONTAINS m_ahu1: code: M_AHU-1 type: METERS/EM connections: m_4ha1: PARTIALLY_AGGREGATES bldg: CONTAINS m_ahu2: code: AHU-2 type: METERS/EM connections: m_4ha1: PARTIALLY_AGGREGATES bldg: CONTAINS m_ahu3: code: AHU-3 type: METERS/EM connections: m_4ha1: PARTIALLY_AGGREGATES bldg: CONTAINS # Loadtypes hvac: code: HVAC type: METERS/LOADTYPE connections: m_ahu1: MEASURES_TYPE m_ahu2: MEASURES_TYPE m_ahu3: MEASURES_TYPE bldg: CONTAINS main: code: MAIN type: METERS/LOADTYPE connections: m_main: MEASURES_TYPE bldg: CONTAINS plug: code: PLUG type: METERS/LOADTYPE connections: m_tc1: MEASURES_TYPE bldg: CONTAINS ``` -------------------------------- ### Install Scoring Tool with Pip Source: https://github.com/google/digitalbuildings/blob/master/tools/scoring/README.md Installs the scoring tool package using pip from the current directory. Assumes the digitalbuildings/tools/scoring path. ```bash python3 -m pip install . ``` -------------------------------- ### Install RDF Generator with pip Source: https://github.com/google/digitalbuildings/blob/master/tools/rdf_generator/README.md Installs the RDF Generator and its dependencies using pip. It requires updating pip first and then installing from the requirements.txt file. ```bash python3 -m pip install --upgrade pip python3 -m pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies for IBR PNG Parser using Bash Source: https://context7.com/google/digitalbuildings/llms.txt This bash script installs the necessary Python dependencies for the IBR PNG Parser. It navigates to the respective subdirectories for boundary extraction and image data creation and installs requirements using pip. ```bash cd digitalbuildings/ibr/png_parser # Install dependencies pip install -r boundary_extraction/requirements.txt pip install -r imagedata_creation/requirements.txt ``` -------------------------------- ### Digital Buildings Toolkit CLI Usage Source: https://context7.com/google/digitalbuildings/llms.txt Command-line interface for validating building configurations and generating GUIDs. Supports basic validation, GUID generation, and optional telemetry validation against Google Cloud Pub/Sub. ```bash # Basic instance validation python toolkit.py -i /path/to/building_config.yaml -v # Generate GUIDs and validate python toolkit.py -i /path/to/building_config.yaml -g -v # Full validation with telemetry validation python toolkit.py \ -i /path/to/building_config.yaml \ -g \ -v \ -s projects/google.com:your-project/subscriptions/your-subscription \ -d /path/to/report-directory \ -t 600 \ --udmi # Validate against modified ontology python toolkit.py \ -i /path/to/building_config.yaml \ -v \ -m /path/to/modified/ontology/yaml/resources ``` -------------------------------- ### Code Update Example Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/building_config.md Illustrates how to update an entity's 'code' and 'type' attributes. This example shows a change from 'FAN-123' to 'PMP-123' and from 'HVAC/FAN_SS' to 'HVAC/PMP_SS', demonstrating that translations may not need updates if the new types share similar fields. ```yaml GUID-123: type: HVAC/FAN_SS code: FAN-123 ... GUID-123: type: HVAC/PMP_SS code: PMP-123 ... update_mask: - type - code ``` -------------------------------- ### Ontology YAML Configuration Examples Source: https://context7.com/google/digitalbuildings/llms.txt Defines the ontology structure using YAML files, including entity types, fields, states, and units. These configurations are used by the ontology validator to ensure consistency and correctness. ```yaml # Entity type definition (ontology/yaml/resources/HVAC/entity_types/AHU.yaml) AHU_SFSS_SFVSC_CHWDC: guid: "abc123-def456-ghi789" description: "Single-fan single-speed AHU with variable speed control and chilled water cooling" is_canonical: true implements: - AHU - SFSS - SFVSC - CHWDC uses: - supply_air_temperature_sensor - supply_air_static_pressure_sensor - supply_fan_run_command - supply_fan_speed_percentage_command - chilled_water_valve_percentage_command # Abstract type definition AHU: guid: "xyz789-abc123" description: "Air Handling Unit general type" is_abstract: true opt_uses: - outside_air_damper_command - return_air_damper_command # Field definition (ontology/yaml/resources/fields/telemetry_fields.yaml) literals: - supply_air_temperature_sensor - supply_air_static_pressure_sensor - supply_fan_run_command - supply_fan_speed_percentage_command - chilled_water_valve_percentage_command # Subfield definition (ontology/yaml/resources/subfields/global_subfields.yaml) subfields: - sensor: description: "A sensing element" category: POINT_TYPE - command: description: "A commanded setpoint or state" category: POINT_TYPE - temperature: description: "Temperature measurement" category: MEASUREMENT - air: description: "Air medium" category: MEDIUM # State definition (ontology/yaml/resources/states/global_states.yaml) states: ON: description: "Device is running" OFF: description: "Device is stopped" OPEN: description: "Valve or damper is open" CLOSED: description: "Valve or damper is closed" AUTO: description: "Automatic control mode" MANUAL: description: "Manual control mode" # Unit definition (ontology/yaml/resources/units/global_units.yaml) units: temperature: - degrees_celsius - degrees_fahrenheit - kelvin pressure: - pascals - inches_of_water - pounds_per_square_inch percentage: - percent ``` -------------------------------- ### UDMI Compliant Translation Shortcut (YAML) Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/building_config.md An example of a simplified translation configuration for devices compliant with UDMI. This format omits redundant information by assuming UDMI's standardized paths and naming conventions. It shows how to specify 'present_value' and 'unit_values' more concisely. ```yaml FCU-123: ... translation: zone_air_temperature_sensor: present_value: "temp_1" unit_values: degrees_celsius: "degC" supply_air_isolation_damper_command: present_value: "damper_1" states: OPEN: "1" CLOSED: "2" ``` -------------------------------- ### Clone Digital Buildings Repository Source: https://github.com/google/digitalbuildings/blob/master/tools/abel/README.md This command clones the Digital Buildings repository from GitHub to your local machine. Ensure you have Git installed and configured. ```bash git clone https://github.com/google/digitalbuildings.git ``` -------------------------------- ### Update Repository and Activate Environment (Windows) Source: https://github.com/google/digitalbuildings/blob/master/tools/abel/README.md Commands to update the Digital Buildings repository, navigate to the tools directory, activate the virtual environment, and install dependencies using a batch script. Assumes a Windows environment. ```batch cd %USERPROFILE%\digitalbuildings\ git pull cd \tools\ tooling\Scripts\activate pip_install.bat cd \abel\ ``` -------------------------------- ### Update Repository and Activate Environment (Linux/macOS) Source: https://github.com/google/digitalbuildings/blob/master/tools/abel/README.md Commands to update the Digital Buildings repository, navigate to the tools directory, activate the virtual environment, and install dependencies using a shell script. Assumes a Linux or macOS environment. ```shell cd ~/digitalbuildings/ git pull cd /tools/ source tooling/bin/activate ./pip_install.sh cd abel ``` -------------------------------- ### Instantiate Building, Floors, and Rooms in Java Source: https://github.com/google/digitalbuildings/blob/master/ontology/rdf/example/README.md This Java code demonstrates the instantiation of a Building object, along with its associated Floors and Rooms. It utilizes a provided namespace and sets properties like code and friendly name for each entity. The relationships between building and floors are established using the addFloor method. ```java String exampleNamespace = "http://www.example.com/ont/tc2#"; // Physical Location Building building = new Building(exampleNamespace, "12345"); building.setCode("US-SVL-TC2"); building.setFriendlyName("TC2 Building"); Floor floor1 = new Floor(exampleNamespace, "floor1"); floor1.setCode("US-SVL-TC2-1"); //... Room room11 = new Room(exampleNamespace, "room11"); room11.setCode("Room on floor 1"); //... Room room21 = new Room(exampleNamespace, "room21"); room21.setCode("Room on floor 2"); // Connect Building and Floor building.addFloor(floor3); building.addFloor(floor2); building.addFloor(floor1); ``` -------------------------------- ### Initial Entity and Link Configuration (YAML) Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/building_config.md This YAML snippet shows the initial configuration of a physical entity (ENTITY-A-123-GUID) and a virtual entity (VIRTUAL-ENTITY-C-123-GUID) with their respective translations and links. It serves as a baseline before updates. ```yaml ENTITY-A-123-GUID: type: SOME_TYPE_NAMESPACE/TYPE-A code: ENTITY-A-123 etag: ... cloud_device_id: ... translation: field_a: present_value: points.analog-value_1.present_value units: ... field_b: present_value: points.analog-value_2.present_value units: ... field_c: present_value: points.analog-value_3.present_value units: ... VIRTUAL-ENTITY-C-123-GUID: type: SOME_TYPE_NAMESPACE/TYPE-C code: VIRTUAL-ENTITY-C-123 etag: ... cloud_device_id: ... links: entity-123: field_a: field_a_1 field_b: field_b_1 field_c: field_c_1 ``` -------------------------------- ### Generate GUIDs for Building Configurations Source: https://context7.com/google/digitalbuildings/llms.txt The GUID Generator creates globally unique identifiers for entities in building configuration files. It can be used via the command line or programmatically to convert files from old formats to new ones keyed by GUID. ```bash # Navigate to GUID generator directory cd digitalbuildings/tools/guid_generator/instance/instance_guid_generator # Generate GUIDs for building config python generator.py --input=/path/to/building_config.yaml # Multiple files python generator.py \ --input=/path/to/config1.yaml \ --input=/path/to/config2.yaml ``` ```python # Programmatic usage from guid_generator.instance.instance_guid_generator import generator # Generate GUIDs for files updated_files = generator.Generate( filenames=['/path/to/config1.yaml', '/path/to/config2.yaml'] ) ``` -------------------------------- ### Sample Building Configuration in YAML Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/hvac_fcu.md This YAML snippet defines a sample building configuration, including its zones, HVAC equipment, and the translation of sensor and command points. It demonstrates how different devices are connected and how their data points are mapped. ```yaml BLDG-1: type: FACILITIES/BUILDING ZONE-1: connections: BLDG-1: CONTAINS FCU-1: FEEDS type: FACILITIES/ZONE FCU-1: cloud_device_id: 1234 connections: BLDG-1: CONTAINS type: HVAC/FCU_DFSS_DFVSC_... translation: chilled_water_valve_percentage_command: present_value: points.cooling_valve_percentage_command.present_value units: key: pointset.points.cooling_valve_percentage_command.units values: percent: '%' discharge_air_temperature_sensor: present_value: points.supply_air_temperature_sensor.present_value units: key: pointset.points.supply_air_temperature_sensor.units values: degrees_celsius: degC zone_air_temperature_sensor: present_value: points.zn_air_temperature_sensor.present_value units: key: pointset.points.zn_air_temperature_sensor.units values: degrees_celsius: degC ... EF-1: cloud_device_id: 12334 connections: BLDG-1: CONTAINS ZONE-1: FEEDS type: HVAC/FAN_SS_CSP... translation: run_command: present_value: points.cmd.present_value units: key: pointset.points.cmd.units states: ON: on OFF: off zone_air_temperature_sensor: present_value: points.zn_air_temperature_sensor.present_value units: key: pointset.points.zn_air_temperature_sensor.units values: degrees_celsius: degC ... DMP-1: cloud_device_id: 12434 connections: ZONE-1: FEEDS BLDG-1: CONTAINS type: HVAC/DMP_... translation: supply_air_damper_command: present_value: points.air_valve_command.present_value units: key: pointset.points.air_valve_command.units values: percent: '%' zone_air_temperature_sensor: present_value: points.zn_air_temperature_sensor.present_value units: key: pointset.points.zn_air_temperature_sensor.units values: degrees_celsius: degC ... ``` -------------------------------- ### Entity Update with update_mask Example Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/building_config.md Provides a comprehensive example of an entity (E4) being updated using the 'update_mask' attribute. It specifies which fields ('translation' and 'cloud_device_id') are targeted for modification, demonstrating the structure required for such updates. ```yaml CONFIG_METADATA: operation: UPDATE E4-GUID: type: ... code: E4 etag: ... cloud_device_id: ... translation: ... connections: ... links: ... operation: UPDATE # This can be omitted when update_mask is specified update_mask: - translation - cloud_device_id ``` -------------------------------- ### Add Metadata to Device Configuration (YAML) Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/building_config.md Demonstrates how to include metadata for devices within the building configuration. For dimensional units, 'present_value' and 'units' must be specified. For strings or implied units, the value can be inlined. Field and unit names must adhere to standard forms. ```yaml FCU-123: ... metadata: discharge_air_flowrate_capacity: present_value:"300" units: "cubic_feet_per_minute" manufacturer_label: "Carrier" ``` -------------------------------- ### Docker Deployment for Digital Buildings Tools Source: https://context7.com/google/digitalbuildings/llms.txt Provides commands to build and run the Digital Buildings tools within Docker containers. This ensures a consistent environment for development and deployment. ```bash # Build and run Docker container cd digitalbuildings/tools ./docker_run.sh # Run ABEL via Docker ./docker_run.sh abel -c /path/to/credential.json -s SPREADSHEET_ID # Run instance validator via Docker ./docker_run.sh instance_validator -i /path/to/config.yaml -v # Run toolkit via Docker ./docker_run.sh toolkit -i /path/to/config.yaml -g -v ``` -------------------------------- ### Instantiate Fan_ss with Run Command and Status in Java Source: https://github.com/google/digitalbuildings/blob/master/ontology/rdf/example/README.md This Java code snippet illustrates the instantiation of a Fan_ss entity, a subclass of Fan and Ss. It includes setting mandatory fields like Run_command and Run_status, assigning time series IDs, and associating a physical location. This example highlights how to connect specific commands and statuses to a device. ```java Fan_ss fan_ss1 = new Fan_ss(ns, "fan_ss1"); // Mandatory fields for fan ss Run_command runCommand = new Run_command(ns, "rc1"); runCommand.setTimeSeriesId("ts-1"); //GUID Run_status runStatus = new Run_status(ns, "rs1"); runStatus.setTimeSeriesId("ts-2"); //GUID // Connect Fields to commands fan_ss1.addUsesRun_command(runCommand); fan_ss1.addUsesRun_status(runStatus); // Add a location for the fan fan_ss1.addPhysicalLocation(room32); … ``` -------------------------------- ### Sample Building Configuration in YAML Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/hvac_fcu.md This YAML snippet demonstrates a sample building configuration, defining a building, a zone, and various HVAC components like FCU, AHU, and VAV. It includes device types, connections between components, and translation mappings for control points and their units. ```yaml BLDG-1: type: FACILITIES/BUILDING ZONE-1: connections: BLDG-1: CONTAINS FCU-1: FEEDS type: FACILITIES/ZONE FCU-1: cloud_device_id: 1234 connections: # Note: the chilled water system would also be linked here, if the unit is fed from it. BLDG-1: CONTAINS type: HVAC/FCU_DFSS_DFVSC_... translation: chilled_water_valve_percentage_command: present_value: points.cooling_valve_percentage_command.present_value units: key: pointset.points.cooling_valve_percentage_command.units values: percent: '%' discharge_air_temperature_sensor: present_value: points.supply_air_temperature_sensor.present_value units: key: pointset.points.supply_air_temperature_sensor.units values: degrees_celsius: degC zone_air_temperature_sensor: present_value: points.zn_air_temperature_sensor.present_value units: key: pointset.points.zn_air_temperature_sensor.units values: degrees_celsius: degC ... AHU-1: cloud_device_id: 12234 connections: BLDG-1: CONTAINS type: HVAC/AHU_SFSS_SFVSC_... translation: chilled_water_valve_percentage_command: present_value: points.cooling_valve_percentage_command.present_value units: key: pointset.points.cooling_valve_percentage_command.units values: percent: '%' supply_air_temperature_sensor: present_value: points.supply_air_temperature_sensor.present_value units: key: pointset.points.supply_air_temperature_sensor.units values: degrees_celsius: degC ... VAV-1: cloud_device_id: 12334 connections: AHU-1: FEEDS BLDG-1: CONTAINS type: HVAC/VAV_SD_DSP_... translation: supply_air_damper_percentage_command: present_value: points.air_valve_percentage_command.present_value units: key: pointset.points.air_valve_percentage_command.units values: percent: '%' zone_air_temperature_sensor: present_value: points.zn_air_temperature_sensor.present_value units: key: pointset.points.zn_air_temperature_sensor.units values: degrees_celsius: degC ... ``` -------------------------------- ### MEASURES Connection Example in YAML Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/connections.md Shows the MEASURES connection, used when one entity quantifies attributes of another. For example, a meter measuring attributes of a panel. The connection is set on the entity whose attributes are being measured. ```yaml PANEL-GUID: code: MSB-1 connections: METER-GUID: - MEASURES ``` -------------------------------- ### CONTROLS Connection Example in YAML Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/connections.md Illustrates the CONTROLS connection, used when one entity affects the behavior or state of another. An example is a lighting control module (LCM) controlling luminaires (LT). The connection is set on the entity being controlled. ```yaml LT-GUID: code: LT 123 connections: LCM-GUID: - CONTROLS ``` -------------------------------- ### HAS_RANGE Connection Example in YAML Source: https://github.com/google/digitalbuildings/blob/master/ontology/docs/connections.md Illustrates the HAS_RANGE connection, defining the coverage or detection limits of one entity by another. An example is an occupancy sensor's range being defined by the room it is in. The connection is set on the entity whose range is being defined. ```yaml ROOM-GUID: code: Room 123 connections: SENSOR-ZOC-GUID: - HAS_RANGE ``` -------------------------------- ### Ontology Explorer: Build Wrapper with Default Ontology (Python) Source: https://context7.com/google/digitalbuildings/llms.txt Python code snippet demonstrating how to initialize the Ontology Explorer's `Build` function using the default ontology path. This creates an ontology wrapper for querying building entity types and fields. ```python # Python API usage from lib import explorer_handler from lib.model import StandardField # Build ontology wrapper with default ontology ontology = explorer_handler.Build(ontology_path=None) ``` -------------------------------- ### Run Scoring Tool Source: https://github.com/google/digitalbuildings/blob/master/tools/scoring/README.md Executes the scoring tool from the command line, requiring paths to proposed and solution configuration files. An optional path for modified types can also be provided. ```bash python3 tools/scoring/scorer.py -prop path/to/proposed/file.yaml -sol path/to/solution/file.yaml ``` -------------------------------- ### ABEL: Convert with Modified Ontology (Bash) Source: https://context7.com/google/digitalbuildings/llms.txt Command-line usage of the ABEL tool for converting a spreadsheet to a building configuration YAML, using a custom or modified ontology. Requires the path to the modified ontology files and the output directory. ```bash # Convert with modified ontology python abel.py \ -s YOUR_SPREADSHEET_ID \ -c /path/to/credential.json \ -m /path/to/modified/ontology \ -d /path/to/output/directory ``` -------------------------------- ### Telemetry Data JSON Format Source: https://github.com/google/digitalbuildings/blob/master/ontology/rdf/example/README.md This JSON structure represents the output format for telemetry data. It includes a unique timeseries ID (GUID) and a list of timestamp-value pairs. ```json { "132654546-guid": [ { "ts": "2019-08-16T02:00:39.000Z", "v": "ON" }, { "ts": "2019-08-16T02:10:39.000Z", "v": "OFF" }, "..." ] } ```