Hi there,
I have a data tag that return sting values that I am using as my status for an asset. I changed the values for the RunningValues_MCC from [1,'1',true,'true'] to [1,'1','on','ON']. But when I status attribute changes to ON. The timer is displaying DOWN. Not sure if I should be changing something else.
Thank you for your help and time with this. Hope you had a good New Year
Solved! Go to Solution.
Hi
This has been asked some time ago. But unfortunately the answer is that only a few specific values are supported, and "ON" isn't in the list. You can refer to the green table at the bottom of this documentation page. If I remember correctly, it's because of how Thingworx handles booleans (text and numbers will be translated into boolean).
You can look into getting calculated tags into Kepware to return the value as a 0/1 instead of ON/OFF. I think this would really be the easiest solution.
I tried 2 workarounds in AMU/Composer, but they both failed. I'll leave them here in case you want to use them for testing.
#1 :
- In the Configuration -> Equipment screen, create the status attribute normally (let's call it Status) and choose a tag.
- Set this attribute as the equipment's status tag.
- In Composer, remove the tag binding from property RunningStatus_MCC.
- Create a subscription. Set it to Enabled=True. The input is the DataChange event of the status property. And the code should look like this : if(me.Status == "ON"){me.RunningStatus_MCC = 1;} else {me.RunningStatus_MCC = 0;}
But this did not work because RunningStatus_MCC read only.
Also I expect this could break if you tried to change something in screen Configuration -> Equipment -> Asset Card because it would override the changes we did (tag binding on RunningStatus_MCC).
#2 :
- In the Configuration -> Equipment screen, create the status attribute normally (let's call it CalculatedStatus) and choose a tag.
- In Composer, go on the equipment's Thing.
- Create a new property (for example RawStatus) with setting Persistant=true and bind it to your tag that says "ON".
- Create a new Thing (like TempStatusThing), we can use ThingTemplate = GenericThing. This is because sadly Composer has a bug that when we try local binding a tag, the Thing can't find itself.
- Create a new property (for example TempStatus), type boolean, with setting Persistant=true. Note that if you have more equipments that require this workaround, you can put all their TempStatus properties here.
- Go back to the equipment Thing.
- Create a subscription. Set it to Enabled=True. The input is the DataChange of the tag's property (RawStatus). The code should look like this : if(me.RawStatus == "ON"){Things["TempStatusThing"].TempStatus = 1;} else {Things["TempStatusThing"].TempStatus = 0;}
- Change the tag binding on property CalculatedStatus, to be locally bound to TempStatus.
- Go back in the Configuration -> Equipment screen and set CalculatedStatus as the status tag. - This does not work because it doesn't accept locally bound properties.
- I also tried binding RunningStatus_MCC to TempStatus, but each time we push a value it throws an error saying it can't write in the property.
Take a look:
Hi
This has been asked some time ago. But unfortunately the answer is that only a few specific values are supported, and "ON" isn't in the list. You can refer to the green table at the bottom of this documentation page. If I remember correctly, it's because of how Thingworx handles booleans (text and numbers will be translated into boolean).
You can look into getting calculated tags into Kepware to return the value as a 0/1 instead of ON/OFF. I think this would really be the easiest solution.
I tried 2 workarounds in AMU/Composer, but they both failed. I'll leave them here in case you want to use them for testing.
#1 :
- In the Configuration -> Equipment screen, create the status attribute normally (let's call it Status) and choose a tag.
- Set this attribute as the equipment's status tag.
- In Composer, remove the tag binding from property RunningStatus_MCC.
- Create a subscription. Set it to Enabled=True. The input is the DataChange event of the status property. And the code should look like this : if(me.Status == "ON"){me.RunningStatus_MCC = 1;} else {me.RunningStatus_MCC = 0;}
But this did not work because RunningStatus_MCC read only.
Also I expect this could break if you tried to change something in screen Configuration -> Equipment -> Asset Card because it would override the changes we did (tag binding on RunningStatus_MCC).
#2 :
- In the Configuration -> Equipment screen, create the status attribute normally (let's call it CalculatedStatus) and choose a tag.
- In Composer, go on the equipment's Thing.
- Create a new property (for example RawStatus) with setting Persistant=true and bind it to your tag that says "ON".
- Create a new Thing (like TempStatusThing), we can use ThingTemplate = GenericThing. This is because sadly Composer has a bug that when we try local binding a tag, the Thing can't find itself.
- Create a new property (for example TempStatus), type boolean, with setting Persistant=true. Note that if you have more equipments that require this workaround, you can put all their TempStatus properties here.
- Go back to the equipment Thing.
- Create a subscription. Set it to Enabled=True. The input is the DataChange of the tag's property (RawStatus). The code should look like this : if(me.RawStatus == "ON"){Things["TempStatusThing"].TempStatus = 1;} else {Things["TempStatusThing"].TempStatus = 0;}
- Change the tag binding on property CalculatedStatus, to be locally bound to TempStatus.
- Go back in the Configuration -> Equipment screen and set CalculatedStatus as the status tag. - This does not work because it doesn't accept locally bound properties.
- I also tried binding RunningStatus_MCC to TempStatus, but each time we push a value it throws an error saying it can't write in the property.
I want to update this. I was pretty sure I had succeeded in the past, and today I just stumbled on my old solution. It's in this old post in another section of the forum.
Basically the workarounds I described earlier weren't working because the tags I was using were read-only and I couldn't get rid of the tag binding in Composer. What I needed to do was to bind a dummy read-write tag : the Kepware tag would receive dummy values from Thingworx. I'm copying the solution here :
- In the Equipment configuration screen, create an attribute that will receive the status tag, for example let's call it RawStatus. Then in the Asset Card configuration screen, select it as the status.
- In Kepware, create a "manual tag", a tag with a "fake address", for example let's call it DummyTag. This tag must have Type=Boolean and be Read-Write. To create a tag with a boolean fake address, in the Address field write B0050, or if this number is already used by another tag then increase the number until you find one that's unused (for example B0052). Each equipment will require its own tag, so if you have 10 machines you will need 10 tags..
- Go in Composer, on the equipment's Thing. In the properties screen, use the Manage Bindings button. In the left panel select the manual tag (DummyTag). and drag to the right panel on RunningStatus_MCC.
- Create a subscription. For the input, select Event=Datachange and select the attribute (RawStatus). In the code, write this :
if(events["Me_DataChange_RawStatus"].eventData.newValue.value == "ON") { me.RunningStatus_MCC = true; } if(events["Me_DataChange_RawStatus"].eventData.newValue.value == "OFF") { me.RunningStatus_MCC = false; }
- In the code, change the name of the attribute if needed (in my code it's called RawStatus). And also, you can change the conditions for true & false, in my code example I'm expecting that my raw status will be "ON" or "OFF", you can change those words, they are the words that your RawStatus tag will send you.
Nice thank you. I saw this as well and that what I did with my furnace and mill machines.
Hello @WL_10521300,
It appears that this post may answers your question. For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.
In the event that this response did not answer your question, please post your current status so that we can continue to support.
Thanks for using the PTC Community!
Regards,
Abhi