Support Forums
Update Tag Value from external program

Hi,

I am new to VTScada and experimenting with VTScada light. Did a setup using Pumps and values.

I have a tag let us say > Local TCP Port\PLCSim\Pump 1 \ Motor Speed with current value 500.

Is there any way to set this value to 1000 by using some external programming (Not through manual dials)?

I do see the REST interface provides read capability for these tags, but NOT the write capability. Please advise.

Appreciate any help, stay safe!

Hi, I am new to VTScada and experimenting with VTScada light. Did a setup using Pumps and values. I have a tag let us say > Local TCP Port\PLCSim\Pump 1 \ Motor Speed with current value 500. Is there any way to set this value to 1000 by using some external programming (Not through manual dials)? I do see the REST interface provides read capability for these tags, but NOT the write capability. Please advise. Appreciate any help, stay safe!

The easiest way to do this is through the multi-write tag or the legacy Analog Output tag where you can fill in the data source field.

The easiest way to do this is through the multi-write tag or the legacy Analog Output tag where you can fill in the data source field.

Trihedral Engineering Ltd.

Thanks Dave!

Any references available, any example of documentation on this approach? Appreciate your help!

For example, if I have a Python program, how can I call VTScada "Analog output tag" and update the value?

I spent last 3 days working through VTScada programmers and developers guide, couldn't find any.

Thanks Dave! Any references available, any example of documentation on this approach? Appreciate your help! For example, if I have a Python program, how can I call VTScada "Analog output tag" and update the value? I spent last 3 days working through VTScada programmers and developers guide, couldn't find any.

Typically this would be done through one of our drivers if your script is not programmed as a custom module in the product.

To read this value, I'd suggest you add a couple of python libraries to make the data accessible to one of the following drivers: JSON, MQTT, SQL, OPC, or Modbus. Just press F1 in the product or check out our vtscada.com -> documentation for the help files. We have quite a bit on all of this as well as quite a bit of info and some sample code regarding custom modules in VTScada (PS a custom module can read and write tag info and works like react).

Typically this would be done through one of our drivers if your script is not programmed as a custom module in the product. To read this value, I'd suggest you add a couple of python libraries to make the data accessible to one of the following drivers: JSON, MQTT, SQL, OPC, or Modbus. Just press F1 in the product or check out our vtscada.com -> documentation for the help files. We have quite a bit on all of this as well as quite a bit of info and some sample code regarding custom modules in VTScada (PS a custom module can read and write tag info and works like react).

Trihedral Engineering Ltd.

Thank you Dave for quick guidance!

I am assuming when you mentioned custom module, it is following:
https://www.vtscada.com/help/Content/Scripting/API/StoreDeclareModules.htm

If I understand correctly, what you are suggesting is, write a custom module ---> Which reads "1000" (in my case) from external source ---> and then writes/updates to the Tag value.

Am I correct?

Thank you Dave for quick guidance! I am assuming when you mentioned custom module, it is following: https://www.vtscada.com/help/Content/Scripting/API/StoreDeclareModules.htm If I understand correctly, what you are suggesting is, write a custom module ---> Which reads "1000" (in my case) from external source ---> and then writes/updates to the Tag value. Am I correct?

Hi Team,

I do have a Tag of type "Analog Control" --> Which sets the speed of the pump. This tag I/O tab has "datasource" field.

I am thinking if we can set this to Json (or) SQL driver and read the value from these and set to "value" of other tag -- which is "Motor Speed". Is this possible approach? could you please advise.

Hi Team, I do have a Tag of type "Analog Control" --> Which sets the speed of the pump. This tag I/O tab has "datasource" field. I am thinking if we can set this to Json (or) SQL driver and read the value from these and set to "value" of other tag -- which is "Motor Speed". Is this possible approach? could you please advise.

Hi,
You're on the right track with the Analog Control + data source.
If the value you're reading, and which you want to write to that Analog Control, is available via JSON, then create a JSON driver and an Analog Status (or I/O) tag as a child of that. Make that Analog Status the data source for the Analog Control.

The process will then proceed as follows:

  1. The JSON driver + Analog Status will check for new values every x seconds (defaulting to 1 as configured in your Analog Status).
  2. It will read the value and store it in the Analog Status.
  3. The Analog Control will see that the value of it's data source changed and write the new value.

No need for scripting.

Hi, You're on the right track with the Analog Control + data source. If the value you're reading, and which you want to write to that Analog Control, is available via JSON, then create a JSON driver and an Analog Status (or I/O) tag as a child of that. Make that Analog Status the data source for the Analog Control. The process will then proceed as follows: 1. The JSON driver + Analog Status will check for new values every x seconds (defaulting to 1 as configured in your Analog Status). 2. It will read the value and store it in the Analog Status. 3. The Analog Control will see that the value of it's data source changed and write the new value. No need for scripting.

Great. So in your Datasource field you will link either a JSON/XML or a SQL tag. Note that the JSON/XML used a HTTP(s) Get so you'll need to hit a server that will return the JSON payload. That said, it's pretty simple to configure this using NPM's http-server, XAMPP, or PHP as they all make running simple servers really easy.

SQL is probably easiest if you already have a database.

If you wrote your own module, you could use the built-in JSON encode/decode function (https://www.vtscada.com/help/Content/Pro_Functions/JSONParse.htm) along with FileStream (https://www.vtscada.com/help/Content/Pro_Functions/FileStream.htm). To just read and parse a file directly.

Finally, note that MQTT has some simple and free brokers (Mosquitto and RSMB) as well as loads of python libraries.

I hope that helps.

Great. So in your Datasource field you will link either a JSON/XML or a SQL tag. Note that the JSON/XML used a HTTP(s) Get so you'll need to hit a server that will return the JSON payload. That said, it's pretty simple to configure this using NPM's http-server, XAMPP, or PHP as they all make running simple servers really easy. SQL is probably easiest if you already have a database. If you wrote your own module, you could use the built-in JSON encode/decode function (https://www.vtscada.com/help/Content/Pro_Functions/JSONParse.htm) along with FileStream (https://www.vtscada.com/help/Content/Pro_Functions/FileStream.htm). To just read and parse a file directly. Finally, note that MQTT has some simple and free brokers (Mosquitto and RSMB) as well as loads of python libraries. I hope that helps.

Trihedral Engineering Ltd.

Thank you Dave and Andrew. I went with JSON approach and was able to modify the values. Appreciate your time and help!

And this video on VTSCada Json driver also helped me (If anyone looking for help in future)

https://www.youtube.com/watch?v=gegzTIR88EE&feature=youtu.be

Thank you Dave and Andrew. I went with JSON approach and was able to modify the values. Appreciate your time and help! And this video on VTSCada Json driver also helped me (If anyone looking for help in future) https://www.youtube.com/watch?v=gegzTIR88EE&feature=youtu.be
edited Jun 9 '20 at 8:39 pm
155
9
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft