Part 6 - Feeding data

This article is a part of "Creating an Equipment model" tutorial

At this point, you should have is a fully configured system. The system consists of two tanks, one pump, and two pipes. This part of the tutorial will show how to update values by feeding data to the system. First, we will show how to write data using the data abstraction interface VtrinLib. Then, we will show how to connect your system with our real-time simulation that provides data for you. The latter example might be closer to a real-world situation, so you might already have sensors that send data into the RTDB using some of our APIs.

Feeding data using VtrinLib

Let's start by creating a new Visual Studio project and make sure we have connection to the RTDB. Please follow the articles Part 1 - Getting started and Part 2 - Connecting to RTDB to make that happen. Alternatively, you can read through only the first part, and then copy existing code from our GitHub repository.

var pump = RTDBDriver
	.Classes["Path"]
	.Instances
	.GetInstanceByName("Example site.Pump section.Pump");

// Update instance properties
pump = pump.BeginUpdate();
pump["Power"] = 900;
pump["Running"] = true;
pump["Powered on"] = true;
pump.CommitChanges();

The code above will update instance's current value. Previous value will be historized, if the historization is enabled for the corresponding equipment property.