Skip to main content
Version: 5.3.0

Simulated Source

The Tributech Simulated Source allows us to simulate a data source for testing purposes.

Setup

The Tributech Simulated Source image can be started without any dependencies but will not be functional without a valid Twin Configuration or MessageBroker connect to the Tributech Agent. The TwinConfiguration can be provided via the Tributech Node (recommended) or MessageBroker (see Source Integration). The Simulated Source will automatically connect to the Tributech Agent if the Tributech Agent is running and the Simulated Source is configured with the correct MessageBroker settings. In the following section we will describe the setup of a Tributech Simulated Source:

  • Create a docker-compose.yml file with the following content (adjustments required):
    docker-compose.yml
    version: "3.6"

    services:
    source-simulated:
    image: ${DOCKER_REGISTRY-tributech.azurecr.io/}tributech-source-simulated:${SOURCE_TAG:-5.2.0}
    depends_on:
    - mosquitto-server
    - tributech-agent
    environment:
    - Logging__LogLevel__Default=Information
    - Logging__Console__FormatterName=simple
    - MqttOptions__MQTTHost=mosquitto-server
    networks:
    - simulated-net
    restart: unless-stopped
    logging:
    driver: "json-file"
    options:
    max-size: "2m"
    max-file: "5"

    tributech-agent:
    image: ${DOCKER_REGISTRY-tributech.azurecr.io/}tributech-agent:${AGENT_TAG:-5.4.2}
    depends_on:
    - mosquitto-server
    environment:
    - Logging__LogLevel__Default=Information
    - Logging__Console__FormatterName=simple
    - MqttOptions__MQTTHost=mosquitto-server
    - EdgeDeviceOptions__NodeUrl=${NODE_URL:?"The Tributech Node Url is required"}
    ports:
    - "5001:8080"
    networks:
    - simulated-net
    volumes:
    - app-data:/app/data # volume mapping for permanent storage of keys and datatwin file
    - ./enrollment:/app/enrollment # local enrollment folder mounted to /app/enrollment
    restart: unless-stopped
    logging:
    driver: "json-file"
    options:
    max-size: "2m"
    max-file: "5"

    mosquitto-server:
    image: eclipse-mosquitto:${MQTT_TAG:-1.6}
    networks:
    - simulated-net
    # ports:
    # - '1883:1883' # MQTT
    # - "127.0.0.1:9001:9001" # web-socket
    restart: unless-stopped

    volumes:
    app-data:

    networks:
    simulated-net:

Adjust the setting for the Tributech Agent to your environment, sample value:

env specific settings
tributech-agent:
...
environment:
...
- EdgeDeviceOptions__NodeUrl=https://my-environment.tributech-node.com

The Tributech Agent authenticates with the Tributech Node using enrollment certificates provided through a local enrollment folder mounted into the container (the ./enrollment:/app/enrollment volume in the docker-compose.yml above). See Authentication Certificates (Enrollment) and Docker volumes in the Setup guide for how to create and provide it. If no Agent ID is configured, the agent generates a random one on first start.

Configuration

Configure AgentConfigure Agent

Right click the Edge Device and add a Simulated Source:

Add Simulated SourceAdd Simulated Source

Right click the newly added Simulated Source and add a Simulated Stream:

Add Simulated StreamAdd Simulated Stream

Adjust the Stream settings to your needs:

Simulated Stream settingsSimulated Stream settings

Repeat this step for every stream you need.

After saving all streams in the workspace we can send the configuration to the Tributech Agent and update currently running Tributech Source configuration by clicking Apply configuration

Apply configurationApply configuration

Value Change Options (VCO) Handling

The basic handling of VCO can be found in Source Integration. This section contains the concrete handling of the Step (Delta) for the simulated source. The following list contains the description for each supported Stream Data Encoding where X represents the value for Step (Delta):

  • Double, Int32, Long, Float: defines the minimum difference between values to be submitted, the change is always compared to the last successful submitted value, e.g. if X= 3 if the double values 1, 2, 5, 8, 10, 11, 14 are received by the Tributech Source only 1, 5, 8, 11, 14 will be submitted.
  • Byte Array: will only be submitted if the current and last submitted value are not equal
  • String UTF 8: will only be submitted if the current and last submitted value are not equal
  • Boolean: will only be submitted if the current and last submitted value are not equal