A simple Metrology Simulator is supplied as part of the Distributed Intelligence (DI) package file (distributedintelligence.tgz) and is installed on the Ubuntu Virtual Machine (VM) used for development as part of the Reference Agent installation.
This page describes how to configure and use the Metrology Simulator.
The Metrology Simulator takes as its input all the comma separated variable (csv) files present in the directory: “/usr/share/itron/metsimfiles” and plays these back. Each csv file should have the following format:
A single header row with each column containing either the Logical ID (LID) number or the shorthand name of the quantity to be simulated. For example, for power factor the LID number is: 18153559 and the shorthand name is: “PowerFactor”. A full list of LIDs available is contained at the bottom of this document. The following rows should be the comma separated values of these fields in each column as appropriate. The values can be either floating point or whole numbers or even empty (missing). Each row represents a single second’s worth of data. Figure 1 contains an example of a csv file for Voltage and Power Factor.
Reference ResourcesHow to Clone an Agent
Figure 1: An Example csv File in the Terminal Text Editor: vi
The order that the Metrology Simulator plays back the csv files is not guaranteed. If order is important then a director file with the name: “metsimdirector.txt” should be created and placed in the directory: “/usr/share/itron”. This file should contain a list of the csv file names including the path, separated by the Line Feed (newline) character. The Metrology Simulator will then play back the csv files in the order that they appear in this file. Figure 2 contains an example of a director file.
Figure 2: An Example of a Director File in the Terminal Text Editor: vi
Using the Metrology Simulator
The script that runs the Reference Agent, “host_run.sh”, deletes all the files present in the: “/usr/share/itron/metsimfiles” directory and then copies any files present in the: “~/DistributedIntelligence/source/Agents/ThirdPartyReferenceAgent/TestCsv” directory to the: “/usr/share/itron/metsimfiles” directory. To enable the continuing use of this script and to facilitate the use of a director file the following steps are suggested:
ssh to the Ubuntu VM as user: “dev”
Create a separate directory to contain the director file using: “mkdir ~/DistributedIntelligence/source/Agents/MetrologySimulator”
Create a subdirectory to contain the csv files: “mkdir ~/DistributedIntelligence/source/Agents/MetrologySimulator/metsimfiles”
Remove the existing “TestCsv” directory using: “rm -rf ~/DistributedIntelligence/source/Agents/ThirdPartyReferenceAgent/TestCsv”
Create a new soft link using: “ln -s ~/DistributedIntelligence/source/Agents/MetrologySimulator/metsimfiles ~/DistributedIntelligence/source/Agents/ThirdPartyReferenceAgent/TestCsv”
Create (or place) the director file: “metsimdirector.txt” in the “~/DistributedIntelligence/source/Agents/MetrologySimulator” directory
Create a new soft link using: “sudo ln -s ~/DistributedIntelligence/source/Agents/MetrologySimulator/metsimdirector.txt /usr/share/itron/metsimdirector.txt”
Create (or place) the csv files in the “~/DistributedIntelligence/source/Agents/MetrologySimulator/metsimfiles” directory
Navigate to the “ThirdPartyReferenceAgent” directory using: “cd ~/DistributedIntelligence/source/Agents/ThirdPartyReferenceAgent”
Test by running the Reference Agent using: “sudo ./host_run.sh”. The results of a successful run are as per Figure 3.
Figure 3: A Terminal Window after Successfully Running the Metrology Simulator and Reference Agent
Refer to the page DI available LIDs which contains a list of all the available Logical IDs (aka "LIDs”).