Skip to main content
Version: 4.0.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:

  • Setup the docker-compose.yml file by creating 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:-latest}
    depends_on:
    - mosquitto-server
    - tributech-agent
    environment:
    - Logging__LogLevel__Default=Trace
    - 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:-latest}
    depends_on:
    - mosquitto-server
    environment:
    - Logging__LogLevel__Default=Trace
    - Logging__Console__FormatterName=simple
    - MqttOptions__MQTTHost=mosquitto-server
    - EdgeDeviceOptions__AgentID=${AGENT_ID:?"The Tributech Agent requires a GUID"}
    - EdgeDeviceOptions__NodeUrl=${NODE_URL:?"The Tributech Node Url is required"}
    - EnrollmentOptions__EnrollmentCertBase64=${ENROLLMENT_CERT_BASE64:?"The base64 encoded Enrollment Cert is required"}
    - EnrollmentOptions__EnrollmentKeyBase64=${ENROLLMENT_KEY_BASE64:?"The base64 encoded Enrollment Key is required"}
    ports:
    - "5000:8080"
    networks:
    - simulated-net
    volumes:
    - ./volumes/simulated/agent/:/app/data # volume mapping for permanent storage of keys and datatwin file
    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

    networks:
    simulated-net:

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

env specific settings
tributech-agent:
...
environment:
...
- EdgeDeviceOptions__AgentID=00000000-0000-0000-0000-000000000007
- EdgeDeviceOptions__NodeUrl=https://my-environment.tributech-node.com
- EnrollmentOptions__EnrollmentCertBase64=LS0tLS1C...ZDdqb29rcUV
- EnrollmentOptions__EnrollmentKeyBase64=AKS0tLS1C...ZDdqb29rcDE

Configuration

**Configure agent**

Right click the Edge Device and add a Simulated Source:

**Simulated Source Add**

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

**Simulated Stream Add**

Adjust the Stream settings to your needs and save the settings by clicking Save in workspace:

**Apply 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 **Save Simulated Source0**

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