Historian Simulator
Historian Simulator
Watch the videoThe Historian Simulator is a provider that will generate simulated historical records, without the need for an external database or data source. The Simulator doesn't actually store any records. Rather, subsystems in Ignition can make requests to the simulator, and it will generate a result set based on the tag path(s) provided.
The simulator is great for testing, as the data generated is reliably aligned to the specified period. Each generation of data for a given set of parameters and given time range will be repeatable. In addition, the "resolution" of the raw data, or the frequency of the generated datapoints, is configurable allowing for as dense or sparse raw values.
Configuring a Historian Simulator Provider​
On the Gateway Webpage, navigate to the Config section.
Under the TAGS heading in the sidebar, click on History.
On the History Provider listing, click Create new Historical Tag Provider.
From the listing of available types, select Simulator, and click Next.
The simulator requires a unique name from other historical providers on the same Gateway, but otherwise does not require any other configuration settings. The bulk of configuration occurs when attempting to request records from the simulator. For now just provide a name, and click the Create New Historical Tag Provider button to finish configuring the provider.
You'll be redirected back to the History Provider listing. You're now ready to use the simulator.
Retrieving Simulated Data​
Once a Simulator Provider has been configured, you need a Tag Historian Query to start retrieving records from it. Lots of different interfaces can request Tag Historian Queries, but for the sake of simplicity we'll only focus on Tag history bindings in Vision. Browsing for available historical tags using a Vision Tag History binding reveals the following tags:
Simulated Provider
- cos_1m_100_1000ms
- function_period_amplitude_resolution
- ramp_60s_100_1s
- realistic_1d
- sine_10s_20_500ms
- square_1h_10_10s
To get started quickly, you can use the default tags in the list above. The one exception would be the function_period_amplitude_resolution
tag, as that's simply there for syntax reference. The rest of the tags utilizes the simulator's pathing syntax.
Simulator Path Syntax​
The built-in "Tags" provided by the simulator are a great example of the simulator can do, but it is worth knowing that the data returned by the simulator can be customized. Doing so involves modifying the Tag path in the Tag history query.
As a refresher, history providers require a path that contains multiple components. Together, the components identify where the data came from. For example, a historical path could have a histprov
component that represents the history provider associated with the data, and a tag
component that represents the Tag path of the Tag. A hypothetical historical path would look like the following:
histprov:my_provider:/tag:my_tag_path
With that understanding, retrieving records from the simulator involves providing the name of the simulator configuration on the gateway (the histprov
) and a tag path. Again, the simulator doesn't store any records. Rather, it looks at the tag path provided, parses it, and returns a result set based off of contents in the path.
The simulator expects tag paths to use the following notation, with each "parameter" delimited by an underscore:
function_periodTime_amplitude_resolutionTime
Each parameter is described below:
Parameter | Description |
---|---|
function | The function to use when generating the raw data. The following functions are available:
|
periodTime | How often the data sequence starts over. Values for periodTime need a time unit. |
amplitude | Used as a peak value by most of the functions. |
resolutionTime | How often raw data points are generated. Like periodTime, this parameter requires a time unit. |
For those functions utilizing a time unit represented by certain notation. A description of each notation can be found below:
Notation | Time Unit |
---|---|
ms | Milliseconds |
s | Seconds |
m | Minutes |
h | Hours |
d | Days |
Editing the Paths​
With the knowledge of how the paths work, you can easily use the existing tag history interfaces to request datasets with custom paths, usually by simply typing in the desired parameters.
For example, the image below shows Vision's Tag History Binding interface, but we modified the Selected Historical Tag path to use the realistic function over a period of 30 minutes, instead of the default one day.
Function Examples​
For example, the tag in the path below utilizes a sine function, over a period of 10 seconds, with an amplitude of 20, and a raw point will be generated every 500 milliseconds.
tag:sine_10s_20_500ms
The following would generate a square wave, with an amplitude of 10, repeating every day, while generating a raw value for every 5 minutes.
tag:square_1d_10_5m
The realistic function is unique in that it only utilizes the periodTime parameter, therefore:
tag:realistic_30m