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

Getting spike in KPI's when shift changes 9.1

mpaisley90
7-Bedrock

Getting spike in KPI's when shift changes 9.1

When my shifts change I get a big spike in my OEE. I was wondering what I can put in to stop this from happening. See pics below. 

 

Also, looking for a way to clear OEE calculations and start new when I have a data change on a SKU number. I do not want to erase data out of the database just start fresh and clear counts and time info stuff. I cannot find the service that could do this for me. 

 

Thanks,

 

mpaisley90_0-1626291822959.png

Shift is at 5 am and 1pm as you can see the jump in the data thus throwing off my graphs.

5 REPLIES 5

Hello,

 

If you want to keep the DB but not the current data, you only need to clear the kpicache.  You can do this by using the below part of ClearHistory service. 

 

function clearKPICache() {

    me.kpiCacheValue = {};

}

 

You can also manually set kpiCacheValue property to blank as well.

 

Let me know if you have any further questions or concerns.

 

Warm Regards,

 

John

Looking for ways to stop the Spike when the shift changes. Performance Spikes so Not sure where to clip KPI calculate unless there is a Produced count. During Shift change if there is no change in machine and the outfeed counts before infeed this will make a huge spike in Performance especially if the outfeed count is *6 or something.

Hi Michael,

 

I believe I had a case with you and wanted to know if the changes that you made for that case resolved this issue for you as well?  If not are there any errors or warnings listed in the log files when those values spike?

 

Thanks,

 

John

No, the spike is always at the shift change. So if they are running during this change and the outfeed clicks before the infeed counts then we show a big spike in the data. How can I clip the calculation to now calculate unless I have infeed counts first?

John,

 

If we run this will it clear the actualProductionTime_APT and also the plannedBusyTime_PBT.

 

I have this code in to run when my SKU or Product changes. I get the clear of counts but not of the above to zero.

 

 

//When the SKU changes Subcribtion will call this Service to clear the KPIC cache and also clear out the good_quanity_GQ and Produced_Quanity_PQ
var myLogger = logger.getLoggerContext().getLogger(logger.getName() + "LOL.KepserverBasedPhysicalAssetThingTemplate.SKU_CAHNGE_ClearKPI");
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDate() + "/";
var launchPointConfigName = Things["PTC.Factory.LaunchPointConfigurationThing"].GetLaunchPointConfigurationName();
var launchPointConfigThing = Things[launchPointConfigName];
var result = datetime;
var statusManager = Things[launchPointConfigThing.GetStatusManagerThingName()];


myLogger.debug('Deleting CACHE (KPIElements, KPIValues, Statuses, and Monitored properties) of equipment (' + me.name + ') since: ' + datetime + '.');

try {
updateStatus();
clearKPICache();

myLogger.debug('Finished Clearing of Cache after SKU Change (' + me.name + ').');
} catch(e) {
myLogger.error('Clear Cache after SKU: ' + me.name + ', did not complete successfully');
throw e;
}

function updateStatus() {
var status = me.status;
if (status > 0) {
var time = new Date();
time.setTime(time.getTime() - 1000);
setStatus(0, time);
setStatus(status, new Date());
}
}

function clearKPICache() {
me.kpiCacheValue = {};
}

me.goodQuantity_GQ = 0;
me.goodQuantity_firstValue = 0;
me.goodQuanity_GQ_Total = 0;
me.producedQuantity_PQ = 0;
me.productedQuantity_firstValue = 0;
me.producedQuanity_PQ_Total = 0;
me.Pounds_Per_Hour = 0;

function setStatus(status, time) {
me.status = status;
me.statusTimestamp = time;

statusManager.CreateStateValueForThing({
thingName: me.name
});
}

function getStartDate(numDays) {
var date = new Date();
date.setDate(date.getDate()-numDays);

return date;
}

 

 

Top Tags