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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Asset advisor performance charts not reflecting asset status history

Willie
16-Pearl

Asset advisor performance charts not reflecting asset status history

For some reason, the performance charts do not reflect the asset status history anymore.

Thingworx - 2020-04-03 - Performance chart not updating - 1.png.jpg

 

The expressions for the asset are set programatically during asset provisioning as follows:

 

Things[UserInputSerialNumber].EXP_E_Running = "\"" + UserInputSerialNumber + ":AssetStatus\"=2";
Things[UserInputSerialNumber].EXP_E_NotConfigured = "false";
Things[UserInputSerialNumber].EXP_E_Unavailable = "true";
Things[UserInputSerialNumber].EXP_E_PlannedDowntime = "\"" + UserInputSerialNumber + ":AssetStatus\"=4";
Things[UserInputSerialNumber].EXP_E_UnplannedDowntime = "\"" + UserInputSerialNumber + ":AssetStatus\"=3";
Things[UserInputSerialNumber].EXP_E_Unavailable = "\"" + UserInputSerialNumber + ":AssetStatus\"=5";

 

When the property "AssetStatus" is updated, the property "statusTimestamp" is also updated with the current datetime.

 

Am I missing something? 

ACCEPTED SOLUTION

Accepted Solutions

Hi @slangley 

 

The case # is C15366984.

I was able to get the correct status value.  It seems that I had the expressions for 2 statuses swapped, causing unexpected status outcomes.  I am now also using CalculateStatus instead of manually setting the status and statusTimestamp values.  I have a new issue where I'm not able to edit the expression for state "5" which is "Unavailable".  This is also in C15366984.

View solution in original post

9 REPLIES 9
Willie
16-Pearl
(To:Willie)

Additional information:

 

When I update the status, I update the following properties:

AssetStatus

status

statusTimestamp

 

Example:

Things[thingname].AssetStatus = 4;

Things[thingname].status = 4;  //I update this manually so that the asset advisor status reflects the asset status immediately instead of waiting for asset advisor to scan the expression for the status and update the status.

Things[thingname].statusTimestamp = new Date( );

abhkumar
14-Alexandrite
(To:Willie)

Hi @Willie 

 

The status expressions are evaluated in the order that they appear in the table. The first expression to evaluate to true determines the state of the equipment. Could you please change the order of the status expression. I could see that from the above post that unavailable status is above the PlannedDowntime.  Additionally, could you please verify the value of properties Status, StatusTimestamp and EXP_E_PlannedDowntime from composer.

 

Thanks

Abhishek

Hi @abhkumar 

 

I just removed some extra lines that were unnecessary.

 

*******new set of lines to set properties for status expressions******

Things[UserInputSerialNumber].EXP_E_Running = "\"" + UserInputSerialNumber + ":AssetStatus\"=2";
Things[UserInputSerialNumber].EXP_E_PlannedDowntime = "\"" + UserInputSerialNumber + ":AssetStatus\"=4";
Things[UserInputSerialNumber].EXP_E_UnplannedDowntime = "\"" + UserInputSerialNumber + ":AssetStatus\"=3";
Things[UserInputSerialNumber].EXP_E_Unavailable = "\"" + UserInputSerialNumber + ":AssetStatus\"=5";

********************************************************************************

This doesn't affect the issue I'm having though.  Also, I don't think the order of the properties I set during asset provisioning affects the order they appear in the table.  The order they appear in the table is set by default.  Please see below:

 

Thingworx - 2020-04-08 - Status definition mashup.PNG

 

The issue I'm having is not specific to "Planned Downtime" status.  Regardless of what the current status is, the performance chart does not update anymore.  The properties status, statusTimestamp, and the expressions all have the correct values; however, the status and statusTimestamp do not reflect these values.

Is there a service that I can call to get asset advisor to scan the status expressions of a particular thing?

abhkumar
14-Alexandrite
(To:Willie)

Hi @Willie 

 

The Service GetDefaultStatusExpressionsConfiguration gives you the default expression of your Asset. You can overwrite the service to customize your own Status. Service GetStatusConfiguration gives you current status of Asset and service  GetStatusExpressions provides to current status of Asset with order of execution.  Service CalculateStatus returns numeric result as per the current status for asset defined on Status property,

0 = Not Configured, 1 = Warning, 2 = Running, 3 = Planned Downtime, 4 = Unplanned Downtime, 5 = Unavailable, 6 = Custom1, 7 = Custom2, 8 = Custom3

 

If you are entitled to open a support case with PTC, then open a support case so that  available TSE will further assist you in the investigation of this issue.

 

Thanks

Abhishek

 


 
 

Hi @abhkumar 

 

I tried calling the CalculateStatus service, but for some reason, it is not outputting the correct status value.  It seems that it does not evaluate the expression correctly.  I will open a support case.  Thanks.

slangley
23-Emerald II
(To:Willie)

Hi @Willie.

 

Please let us know the case number so we can track it for updating this post once a solution is known.

 

Regards.

 

--Sharon

Hi @slangley 

 

The case # is C15366984.

I was able to get the correct status value.  It seems that I had the expressions for 2 statuses swapped, causing unexpected status outcomes.  I am now also using CalculateStatus instead of manually setting the status and statusTimestamp values.  I have a new issue where I'm not able to edit the expression for state "5" which is "Unavailable".  This is also in C15366984.

Hi @Willie ,

Unavailable expression is not editable as per the product design

As per the status functionality, anyone of the asset status should be true for displaying asset status in asset advisor. In case if none of the above expressions are true, then asset status will be Unavailable (Hardcoded 5 to true) and this will be evaluated in the last when all OOTB and custom expressions gets evaluated.

 

Thanks,

Himanshu

 

If the above response has answered your question, please mark as Accepted Solution, for the benefit of others who may have the same question.

 

 

Announcements


Top Tags