Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
For some reason my downtime kpi is not showing up. I configured the downtime model and added the shift event to the machine and ran the KPI Engine sql query. And the availability isn't showing up. I check the timeslice table to see if there is data but it's empty. There is entries in timesliceschedule table. I am not sure where I went wrong. I am using binding to an AMU property instead of a tag because how we are tracking of this machine is on or off is based on a temperature range. So I made a AMU attribute/property called status that returns "Running" or "Stopped " when the temp changes. I configured status with a DummyTag with an address of S0050 and use a service to update the status to return the "Running" or "Stopped" based the datachange event of the AMU attribute/property called Temp. (This idea come from this article: https://community.ptc.com/t5/ThingWorx-Developers/How-AMU-attribute-logging-works/m-p/930097#M65531)
so I am not sure if there is a better way for this to work for both RTPPM and AMU. My goal is to use the temp data tag that I have to determine if the machine is running or not. (Eg, if temp is within the limits configured in Characterisitcs, then return Running. Else out of the range return Stopped). Let me know if you can think of a better way for me to does this to work for both RTPPM and AMU.
I ran queryPorpertyHistory and I see rows but I don't see some columns populated. Compare to another machines who Availbility KPI is working.
Solved! Go to Solution.
Ok yes, this is why the KPIs are not showing up. You have a record for December 5th (2024-12-05) with empty Uids (Shift, Product & Joborder mostly) and for some reason it's trying to create a duplicate. It should not be doing that, it must have encountered a bad scenario somehow. But the end result is that there is an error in the KPI calculations. And when there is an error, it rolls back all the calculations and tries again. I'm guessing you have no record at all since December 6th.
So there's 2 options. #1 : we can leave the data as it is and try to debug the procedure & data to figure out how it gets that wrong scenario. Then we can find a way to fix it and also alert the software team, to prevent this from happening in the future. #2 : fix it now : DELETE timeslice WHERE equipmentuid = 26 AND starttime >= '2024-12-05 16:00'. This should allow the KPIs to be calculated immediately.
Hi WL
Let's look at this piece by piece.
I configured the downtime model and added the shift event to the machine and ran the KPI Engine sql query. And the availability isn't showing up. I check the timeslice table to see if there is data but it's empty. There is entries in timesliceschedule table.
Yeah my first suspect was that the TimesliceSchedule table was empty, but I see you already checked that. So here's a few more items to check :
I am using binding to an AMU property instead of a tag because how we are tracking of this machine is on or off is based on a temperature range. So I made a AMU attribute/property called status that returns "Running" or "Stopped " when the temp changes. I configured status with a DummyTag with an address of S0050 and use a service to update the status to return the "Running" or "Stopped" based the datachange event of the AMU attribute/property called Temp.
I never tried using a text value for the downtime tag, I'm not sure if it's supported. But the goal is to send the value in the DowntimeByTag_DowntimeTag property and its valuestream, so using a local property instead of a Kepware tag should be acceptable, I'm just not sure about the "it's text" part. You may need an extra step to convert it into 0/1 instead of stopped/running.
so I am not sure if there is a better way for this to work for both RTPPM and AMU. My goal is to use the temp data tag that I have to determine if the machine is running or not. (Eg, if temp is within the limits configured in Characterisitcs, then return Running. Else out of the range return Stopped). Let me know if you can think of a better way for me to does this to work for both RTPPM and AMU.
It's not "officially supported", but what you're doing is a simple workaround that should work. Except maybe the "transform the text into a number" part that I'm not sure is required, as mentioned above.
I ran queryPorpertyHistory and I see rows but I don't see some columns populated.
First, this is the Value_Stream table in the Thingworx database if you want to query it in SQL (the UI can show repeated values for example, SQL is safer). Second, the way to have values into it is to either use a tag with the Log setting on the property, or if you push values via subscription then you also need to push the value into the Valuestream you can see an example in subscription JobOrderProdEvent_Subscription : calling the AddStringValueStreamEntry service. Third, Valuestream records get deleted after they are processed by the models. This is probably why your downtime tag only has "Running", even though the history tag has all the other values. The history tags are supposed to keep the values for 24h before deleting them, for debugging purposes. The fact that we just see Running for downtime and alternating Running/Stopped in history makes me think it's processing the values, if the downtimes don't get created then I would look in Scriptlog and ErrorLogMessage for related errors.
Let me know if you're able to progress further with this information.
Create time slices -1 KPIEngine_TimeSliceCreate_SP Cannot insert duplicate key row in object 'dbo.timeslice' with unique index 'TimeSlice_StartTime_EndTime_EquipmentUID_TimeSliceTypeUID_ShiftEventUID_JobOrderUID_EventSubTypeUID_ProductUID_Unique'. The duplicate key value is (2024-12-05 17:00:00.0000000 +00:00, 2024-12-05 18:00:00.0000000 +00:00, 26, 1, <NULL>, <NULL>, 1, <NULL>). - Parameters: NONE
I did change it to true/false and I tried 0/1 as well. Unfortunately the timeslide table is still empty after 1 hr of run for each datatype (boolean, integer)
I did run the KPI Engine SQL code just in case. I think those errors are related to that.
Ok yes, this is why the KPIs are not showing up. You have a record for December 5th (2024-12-05) with empty Uids (Shift, Product & Joborder mostly) and for some reason it's trying to create a duplicate. It should not be doing that, it must have encountered a bad scenario somehow. But the end result is that there is an error in the KPI calculations. And when there is an error, it rolls back all the calculations and tries again. I'm guessing you have no record at all since December 6th.
So there's 2 options. #1 : we can leave the data as it is and try to debug the procedure & data to figure out how it gets that wrong scenario. Then we can find a way to fix it and also alert the software team, to prevent this from happening in the future. #2 : fix it now : DELETE timeslice WHERE equipmentuid = 26 AND starttime >= '2024-12-05 16:00'. This should allow the KPIs to be calculated immediately.
Your 2nd option worked for my and my KPIs are showing again. Thank you so much!!