TrakHound / TrakHound-Community

Open Source MDC Software Package using MTConnect
http://www.TrakHound.com
GNU General Public License v3.0
49 stars 29 forks source link

OEE only starts tracking at 12pm #48

Open JackIsAKiwi opened 1 year ago

JackIsAKiwi commented 1 year ago

Love the software, i'm just in the process of adding all our mills and lathes and its been fantastic to have that overview of the factory. The only issue i'm having is that the tracking only appears to start at midday for the OEE. I'm wondering if it's due to my timezone as we are based in New Zealand, do I need to adjust something before I compile?

JackIsAKiwi commented 1 year ago

Sorted, calculated the time zone offset based on the local time zone rather than the UTC time zone in TrakHound-Dashboard/Pages/Dashboard/OeeHourTimeline/Controls /Row.xaml.cs

public void UpdateData(List hours) { if (hours != null) { foreach (var hourData in HourDatas) { hourData.Reset(); }

    TimeZoneInfo localTimeZone = TimeZoneInfo.Local;
    TimeSpan timeZoneOffset = localTimeZone.GetUtcOffset(DateTime.UtcNow);

    foreach (var hour in hours)
    {
        int h = hour.Hour + timeZoneOffset.Hours;
        if (h >= 24) h -= 24;

        var match = HourDatas.Find(o => o.StartHour == h);
        if (match != null)
        {
            match.Oee = hour.Oee;

            if (hour.PlannedProductionTime > 0)
            {
                if (hour.Oee > 0.75) match.Status = 2;
                else if (hour.Oee > 0.5) match.Status = 1;
                else if (hour.Oee >= 0) match.Status = 0;
            }
            else match.Status = -1;
        }
    }
}

}

siculas commented 12 months ago

Set the time zone of the computer where TrakHound is installed to "UTC". Synchronize your computer time with your local time. Check the data.