7 Replies Latest reply on Oct 31, 2017 12:28 PM by ylima RSS
    ylima Explorer

    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