cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Error when updating a property from thingworx to kepware

ylima
1-Newbie

Error when updating a property from thingworx to kepware

Hello,
I connected some tags in kepware and I want to read/writing them using an experience in Thingworx  Studio.

When reading, it works just fine, the problem is when I try to write a property.

If I set the property manually from Thingworx it works correctly and I can see the change in Kepware

 

To be clear, when I click the button 'set' I can see that the value in OPC (and in PLC) is changing

 

To write from Thingworx Studio I made an experience with a button that takes the text input from a text box and take the output as a parameter, then I bind it to a custom service

 

// Create a new blank infotable for passing into the 'update' service 

var params = { 

    infoTableName: "MyUpdateTable" /* STRING */ 

}; 

 

// result: INFOTABLE 

var myUpdate = Resources["InfoTableFunctions"].CreateInfoTable(params); 

 

// add the name field to the datashape for the update table 

// this will hold the name of the property to update 

var nameField = new Object(); 

nameField.name = "name"; 

nameField.baseType = 'STRING'; 

myUpdate.AddField(nameField); 

 

// add the value field to the datashape for the update table 

// this will hold the value of the property to update 

var valueField = new Object(); 

valueField.name = "value"; 

valueField.baseType = 'BOOLEAN'; 

myUpdate.AddField(valueField); 

 

// add the row that contains the update for temperature 

var updateRow = new Object(); 

updateRow.name = 'Siemens_PLC_S_Run'; // << your actual property name here 

updateRow.value = Input; // << your new value for that property here 

 

// add the temperature row new value to the infotable 

myUpdate.AddRow(updateRow); 

 

var params = { 

    values: myUpdate /* INFOTABLE */ 

}; 

 

// Finally, update my thing with the properties in the table 

me.UpdatePropertyValues(params);

 

 

Note that the input (that I conveniently named 'Input') is bond to the text. You can see that i'm using UpdatePropertyValues

Well, the problem is: When I write a value in thingworx studio using this service (I configured it to Invoke on start-up, take the first row and auto-refresh 0.2) it show in ThingWorx that the value in the property changed (If use GetPropertyValues I can see that it really changed) but in OPC Client it simply does not change and Thingworx stop reading from OPC too (The property just take the value in the text box from the studio experience).

 

How can I solve this? Or, there is any better solution to write a property from Studio?

 

Thanks

7 REPLIES 7
katte
1-Newbie
(To:ylima)

Interesting!! Did you try directly executing the service in ThingWorx Platform and see if that updates the values in kepware/OPC? ? Technically, if Studio pushes the values to ThingWorx Platform, then it is all with ThingWorx Platform to carry the task. Not sure why this isn't working in your case. Also did you notice errors in logs (thingworx Platform)?

ylima
1-Newbie
(To:katte)

Hello giri!

I executed the service directly in ThingWorx Platform and I've got the same error:
ThingWorx set the property to one

But OPC does not set the tag

Crazy, right?

No errors in logs too.

I wonder if it is a problem in the Service or in UpdatePropertyValues...

ylima
1-Newbie
(To:ylima)

It seems like when I execute the service I still have to click on the "set" button to ThingWorx actually work

ylima
1-Newbie
(To:ylima)

Well, when this error occurs, if I try to manually set the property to false again it simply don't work.
I have to execute the service again, with false as input (to match OPC), then I can manually set and unset the tag again.

katte
1-Newbie
(To:ylima)

Yeah, I guess the root cause seems to be between ThingWorx Platform and OPC (kepware). Can you please check if there is error or missing configuration in kepware? As I'm not fully aware of kepware services I would wait for an expert advice on it.

ylima
1-Newbie
(To:katte)

Here is my Kepware configs. I can't see any reason to change it

ylima
1-Newbie
(To:katte)

I've excecuted UpdatePropertyValues and got the same error. So I think the problem is between ThingWorx and Kepware as you pointed.

Top Tags