+ Added functions access
* Change db and added PLC_ID
This commit is contained in:
@@ -18,6 +18,7 @@ public static class ThreadsFunctions
|
||||
private static long ReadAxesTimer = 0, ReadAxesTimes = 0;
|
||||
private static long ReadPowerOnTimer = 0, ReadPowerOnTimes = 0;
|
||||
private static long ReadProcPPTimer = 0, ReadProcPPTimes = 0;
|
||||
private static long ReadFunctionTimer = 0, ReadFunctionTimes = 0;
|
||||
|
||||
private static Thread ConnThread;
|
||||
|
||||
@@ -238,6 +239,51 @@ public static class ThreadsFunctions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void ReadRuntimeFunctionAccess()
|
||||
{
|
||||
NcHandler ncHandler = new NcHandler();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
|
||||
try
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncHandler.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
while (true)
|
||||
{
|
||||
sw.Restart();
|
||||
|
||||
if (ncHandler.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get Data from NC
|
||||
libraryError = ncHandler.GetFunctionsMappedWithNC(out List<DTORuntimeFunctionAccessModel> functionsAccessList);
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
else
|
||||
// Send through signalR
|
||||
MessageServices.Current.Publish(SEND_FUNCTIONALITY_DATA, null, functionsAccessList);
|
||||
}
|
||||
else
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
//Send to the UI the time
|
||||
ReadFunctionTimer += sw.ElapsedMilliseconds;
|
||||
ReadFunctionTimes++;
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
ncHandler.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SupportFunctions
|
||||
@@ -364,6 +410,12 @@ public static class ThreadsFunctions
|
||||
ReadProcPPTimer = 0;
|
||||
ReadProcPPTimes = 0;
|
||||
}
|
||||
if (ThreadsHandler.RunningThreadStatus.ContainsKey("ReadRuntimeFunctionAccess") && ReadFunctionTimes != 0)
|
||||
{
|
||||
ThreadsHandler.RunningThreadStatus["ReadRuntimeFunctionAccess"] = (ReadFunctionTimer / ReadFunctionTimes) + " mS";
|
||||
ReadFunctionTimer = 0;
|
||||
ReadFunctionTimes = 0;
|
||||
}
|
||||
|
||||
MessageServices.Current.Publish(SEND_THREADS_STATUS, null, ThreadsHandler.RunningThreadStatus);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user