Random Output Values

Hello,
I am doing my semester project with the Toolbox and I am facing the following problem. I have connected the Toolbox to a Siemens PLC via a KEPServerEX. The communication works without any problems. Also the changes of the sensor values are displayed in the toolbox without any problems. But as soon as I use a slider to send e.g. a value from the toolbox to the PLC, after some time random values are sent and it looks like a counter is always counting up the values. I have already tried this with int and real data types. For the first attempts I used the default slider, but I need an output range from 0 to 100, so I made a conversion in the index.html file, but after some time I get random values again. Do I have to configure something additional to send a value as output to the Siemens PLC?
Thanks a lot for the help!

Best regards,
Alex

Hi Alex, first of all that’s great to hear that you’ve successfully connected to the Siemens PLC and can read its sensor values.

I hope we can help debug your issue. A couple questions…

  1. Where exactly do you see the random values appearing? If you go to localhost:8080 and click on the name of your object, you should see a debug page where each node’s live value can be seen. Do you see the random value here, or just somewhere on the KEPServerEX / PLC?
  2. If you connect an on-off switch (or other controllable tools) rather than a slider, do they all end up as random values or does it seem specific to the slider?
  3. Does this issue still occur when you use the default slider, or it appears when you scale up to 100?

We do have an option to scale the data sent through nodes by providing a unitMin and unitMax in addition to the value (see the documentation for write on this page), although I haven’t used it recently in combination with the kepware interface.

If it seems more likely that there’s a bug in the edge server’s kepware interface itself, you could try out this beta version of the core-addon which replaces our kepware’s REST interface with an OPCUA interface: GitHub - ptcrealitylab/vuforia-spatial-core-addon at kepwareReplacement

Let me know if any of this helps, and with the answers I should have a better idea of where the bug is originating.

Best,
Ben

Hi Ben, thanks for the answer.

Regarding your questions…

  1. The random values appear on the debug page of the object (localhost:8080), on the KEPServerEX and the PLC.
  2. I also tried it with the input tool for numbers to send values directly, but random values appeared too.
  3. If I use the default slider, it looks good at first but after a few times if I set the slider to value 1 and display this value with the graph tool in the VST, then I get the value 0.825 in the text field of the graph and the yellow graph itself is at the bottom. In the debug page of the object I see the value 0.001.
    I also tried scaling the value of the default slider with the scaling tool in the logic node but did not get correct results

Where can I set the unitMin and unitMax values? Do I write the “write” function directly into the “index.html” file of the tool?

I hope that my answers help.

Best regards,
Alex

Ok, that’s helpful to know that the issue seems to be internal to the Toolbox system, rather than occurring during transmission between the Toolbox and the KepServerEX. The whole behavior of the slider seems a bit odd in your system, so I’d suggest creating a backup of your current version and downloading a fresh copy of the core-addon from our GitHub to make sure nothing’s been corrupted.

To adjust the scale of the slider using the unitMin and unitMax, you can directly edit the tools/slider/index.html file.

Look for the line
realityInterface.write('value', properties.value);
and replace it with something like:

let unitMin = 0;
let unitMax = 100;
let unitLabel = undefined; // can be any string, example: 'meters', 'kg', or undefined if you don't need this
realityInterface.write('value', properties.value, 'f', unitLabel, unitMin, unitMax);

Try connecting the updated slider to a graph, and you should see it display the scaled value like this:

Screen Shot 2022-01-03 at 2.54.16 PM

The debug value on localhost:8080 will still show the unscaled value (in my screenshot, 0.6517…), but the node now contains the right metadata for listeners (such as the graph tool) to scale it to the correct range.


Looking at this again, I have one more suggestion for what you may need to do. It is possible that you can just use a default slider (sending the 0 to 1 range of values) if you also configure the Min and Max of the tag in the Kepware Hardware Interface. If you go to localhost:8080 and click on the Manage Hardware Interfaces tab, and then click on the yellow gear next to the kepware field, you should see a list of configurable properties. At the bottom (at least in the old Kepware interface, this might have changed with the OPCUA version), you will see a “Configure tags” section, and if you Edit your tag you can type in a new Min and Max for its range, for example 0 and 100. This means that when the Toolbox node receives a value of 1, the interface should send the PLC a value of 100.

I haven’t tested this recently myself, as I don’t have hardware on-hand, and perhaps you’re already doing this step, but I just wanted to add it in case this is what I missed the first time.

Best,
Ben

Hi, adjusting the scaling of the slider works fine.

I looked in “Configure Tags” and increased the maximum to 100 on a few tags, but this did not produce the desired results. I am also not sure what all the tags do since I do not know what the tag names mean. The most obvious was “conveyor”, so I tried that first. I see the following tags:

image

However, I am not sure if the “Configure Tags” is the problem and possibly this works - because I get the following message directly on KEPServerEX:

There may be a problem because of the type conversion (the data type of the tag in the IoT Gateway is “short”). Is it possible that “string” data is sent? If yes, is a conversion to “short” possible in the Spatial Toolbox?

Best,
Alex