Virtual Data Source
The Virtual data source generates data entirely within Mango's memory without any connection to an external or physical system. Data points on a Virtual data source produce either random or deterministic values based on configurable algorithms. Every supported Mango data type (Binary, Multistate, Numeric, and Alphanumeric) can be used, and each has its own set of change type algorithms that control how values evolve over time.
Virtual data sources are useful in many scenarios: validating that a Mango installation is working correctly, generating benchmark data for comparison with real sensor readings, creating test data for dashboard development, prototyping control logic before connecting to physical equipment, and simulating device behavior during system demonstrations.
Overview
| Property | Value |
|---|---|
| Module | Core (built-in) |
| Protocol | N/A (simulated) |
| Direction | N/A |
| Typical Use | Testing and simulation with generated data patterns |
Prerequisites
No external hardware, network connections, or special software are required. The Virtual data source is built into Mango and is available immediately after installation.
Configuration
Data Source Settings
| Setting | Description |
|---|---|
| Name | A descriptive name for the data source. |
| Update period | How frequently the algorithms that change virtual point values are executed. For example, setting this to "2 minutes" causes all points on this data source to update every two minutes. |
| Perform polls | When unchecked, the data source does not automatically generate updates for its points. This is useful when you want virtual points to update only when set externally -- from a point link, a script, the user interface, or the REST API. |
Data Point Configuration
All virtual data points share these common attributes:
| Setting | Description |
|---|---|
| Name | The display name of the point. |
| Settable | Whether the point can be manually set by users or scripts. |
| Data type | The Mango data type (Binary, Multistate, Numeric, or Alphanumeric). |
| Change type | The algorithm that determines how the point value changes on each poll (see below). |
| Start value | The initial value when the data point starts. |
If a virtual data point has a cache size of 0, its value always reverts to the Start value when the data source or data point is restarted. With a cache size of 1 or greater, the point continues from its previous value after a restart.
Binary Points
Binary points exist in one of two states (on/off, true/false). Three change types are available:
| Change Type | Behavior |
|---|---|
| Alternate | Toggles between the two states on each poll cycle. |
| No change | The point value never changes automatically. Useful for points that are only set manually. |
| Random | Changes state randomly on each poll cycle. |
Multistate Points
Multistate points represent one of several discrete states (e.g., on, off, disabled). The set of possible values must be defined using the Values control. Three change types are available:
| Change Type | Behavior |
|---|---|
| Increment | Cycles through each defined value in order. When Roll is enabled, the point returns to the first value after reaching the last. When Roll is disabled, the point reverses direction at the boundaries. |
| No change | The point value never changes automatically. |
| Random | Assumes a random value from the defined set on each poll. |
Numeric Points
Numeric points represent analog values as 64-bit floating point numbers. Six change types are available:
| Change Type | Behavior |
|---|---|
| Brownian | Simulates Brownian motion -- the point changes by a random differential from its previous value. Configure Minimum, Maximum (bounds), and Maximum change (the largest possible random step). |
| Increment | The point changes by the Change amount every poll. The Change value may be negative. Configure Minimum, Maximum bounds and the Roll behavior. When Roll is on, the value wraps to the opposite bound. When off, the change direction reverses at the bounds. |
| No change | The point value never changes automatically. |
| Random | Uniformly distributed random value between the configured Minimum and Maximum (inclusive) on each poll. |
| Attractor | The point asymptotically approaches the value of another numeric point in the system. Maximum change limits the step size toward the target. Volatility adds random fluctuations to the approach. |
| Sinusoidal | Produces a sine wave output. The frequency depends on the poll period -- each poll increments the internal time counter by 1. Configure Amplitude, Offset, and Period to shape the wave. |
Alphanumeric Points
Alphanumeric points store character strings and are not subject to algorithmic change. The only available change type is No change. These points are typically set manually or via scripts.
Common Patterns
System Validation
After installing Mango, create a Virtual data source with a few Numeric and Binary points to verify that data collection, charting, event detection, and email notifications are all working correctly. This provides a known-good data stream that is independent of any external equipment.
Dashboard Development
When building dashboards for a system that is not yet online, use Virtual data sources to simulate realistic sensor data. Configure Brownian or Sinusoidal change types to produce data that visually resembles real-world signals. This allows dashboard layout, formatting, and user experience to be finalized before the physical system is connected.
Vacation Lighting Simulation
If home lighting is controlled through Mango, a Virtual data source with a Random Binary point can drive the lights on and off at irregular intervals while you are away, creating the appearance of occupancy.
Control Logic Prototyping
Use Virtual points as inputs and outputs for point links, meta points, and scripting data sources during the development phase. Once the control logic is validated, replace the Virtual data source references with connections to real equipment.
Manual Setpoints
Create a Virtual data source with Perform polls unchecked and configure Numeric or Multistate points as Settable with No change. These points serve as manual setpoint holders that can be set from the user interface, REST API, or scripts, and their values persist until explicitly changed.
Troubleshooting
Points Not Updating
- Verify that Perform polls is checked on the data source. When unchecked, points only update when set externally.
- Confirm the data source is enabled and running.
- Check the Update period -- a very long period may make it appear that updates are not occurring.
Values Resetting on Restart
If point values revert to the Start value after restarting the data source, increase the point's cache size to 1 or greater. A cache size of 0 causes the point to always begin at the configured Start value.
Unexpected Value Ranges
For Numeric points using Brownian, Increment, or Random change types, verify the Minimum and Maximum bounds are set correctly. The Brownian change type can appear to produce values outside the expected range if the Maximum change is large relative to the bounds -- the value is clamped after the random step, which may create clustering at the boundaries.
Sinusoidal Output Not as Expected
The Sinusoidal change type uses the poll count as its time variable, not wall-clock time. If the update period changes, the apparent frequency of the sine wave changes proportionally. The output formula is: value = offset + amplitude * sin(2 * PI * pollCount / period).
Related Pages
- Data Sources Overview — General data source and data point concepts
- Internal Data Source — Monitor Mango's own system health and performance metrics
- Meta Data Source — Create derived points from calculations on other data points
- Scripting Data Source — Execute JavaScript to generate or transform data programmatically