public static string ErrorCodeMessage(ERuntimeErrorCode aCode) { switch (aCode) { case ERuntimeErrorCode.DoesNotExist: return("Does not exist (-4). "); case ERuntimeErrorCode.WrongArgument: return("Argument is wrong (-8). "); case ERuntimeErrorCode.ConnectionError: return("Connection error (-10). "); case ERuntimeErrorCode.Timeout: return("Timeout (-11). "); case ERuntimeErrorCode.WrongVersion: return("Wrong version (-13). "); case ERuntimeErrorCode.InstanceNotRunning: return("Instance not running (-14). "); case ERuntimeErrorCode.InterfaceRemoved: return("Interface removed (-15). "); case ERuntimeErrorCode.NotSupported: return("Not supported (-19). "); case ERuntimeErrorCode.SignalConfigurationError: return("Signal configuration error (-24). "); case ERuntimeErrorCode.TypeMismatch: return("Type mismatch (-29). "); case ERuntimeErrorCode.NotEnoughMemory: return("Not enough memory (-43). "); case ERuntimeErrorCode.NotUpToDate: return("The stored tag list must be updated (-47). "); default: return("Unknown error code " + ((int)aCode).ToString() + ". "); } }
private void Instance_OnProcessEventDone(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_SystemTime, uint in_HardwareIdentifier, uint in_Channel, EProcessEventType in_ProcessEventType, uint in_SequenceNumber) { }
private void Instance_OnConfigurationChanged(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, EInstanceConfigChanged in_InstanceConfigChanged, uint in_Param1, uint in_Param2, uint in_Param3, uint in_Param4) { //Growl.Info(string.Format("Instance_OnConfigurationChanged ")); }
private void Instance_OnSyncPointReached(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, uint in_PipId, long in_TimeSinceSameSyncPoint_ns, long in_TimeSinceAnySyncPoint_ns, uint in_SyncPointCount) { Console.WriteLine(""); SyncPointCount.OnNext(in_SyncPointCount); }
/// <summary> /// Event when Configuration changed of the PLC (during download) /// </summary> /// <param name="in_Sender"> PLC which fired this event</param> /// <param name="in_ErrorCode"> ErrorCode of Runtime of the PLC</param> /// <param name="in_DateTime"> DateTime when the configuration changed</param> void instance_OnConfigurationChanged(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, EInstanceConfigChanged in_InstanceConfigChanged, uint in_Param1, uint in_Param2, uint in_Param3, uint in_Param4) { IsConfigured = false; try { instance.UpdateTagList(ETagListDetails.IO); IsConfigured = true; } catch (Exception ex) { } }
/// <summary> /// Event when PLC reach the End of the main Cycle, this will be called, whenever the Controller reaches the end of cycle. /// </summary> /// <param name="in_Sender">PLC which fired this event</param> /// <param name="in_ErrorCode">ErrorCode of Runtime of the PLC</param> /// <param name="in_DateTime">DateTime when the configuration changed</param> /// <param name="in_CycleTime_ns">current cycle time in ns of the PLC</param> /// <param name="in_CycleCount">current count of Cycles of the PLC</param> void instance_OnEndOfCycle(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, long in_CycleTime_ns, uint in_CycleCount) { if (IsConfigured) { NewCycle?.Invoke(); //try //{ // // Read outputs of the virtual controller and assign to variables of the Co-Simulation // coSimulation.setOnBeltActive = instance.ReadBool("setOnBeltActive"); // coSimulation.moveBeltActive = instance.ReadBool("moveBeltActive"); // coSimulation.setOffBeltActive = instance.ReadBool("setOffBeltActive"); // coSimulation.releaseActive = instance.ReadBool("releaseActive"); // coSimulation.acknowledgeActive = instance.ReadBool("acknowledgeActive"); // coSimulation.restartActive = instance.ReadBool("restartActive"); // // Call the Co-Simulation programm // coSimulation.CoSimProgramm(); // // Write the Co-Simulation values to the inputs of the virtual controller // instance.WriteBool("sensorStartPos", coSimulation.sensorStartPos); // instance.WriteBool("sensorBeltStart", coSimulation.sensorBeltStart); // instance.WriteBool("sensorBeltDest", coSimulation.sensorBeltDest); // instance.WriteBool("sensorEndPos", coSimulation.sensorEndPos); //} //catch (Exception ex) //{ //} } else { try { instance.UpdateTagList(ETagListDetails.IO); IsConfigured = true; } catch (Exception ex) { } } }
private void Instance_OnLedChanged(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, ELEDType in_LEDType, ELEDMode in_LEDMode) { //Growl.Info(string.Format("Instance_OnOperatingStateChanged From {0} To {1}", in_LEDType,in_LEDMode)); switch (in_LEDType) { case ELEDType.Run: UpdateRunLed(in_LEDMode); break; case ELEDType.Stop: UpdateErrorLed(in_LEDMode); break; case ELEDType.Maint: UpdateMaintLed(in_LEDMode); break; } }
private void Instance_OnOperatingStateChanged(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, EOperatingState in_PrevState, EOperatingState in_OperatingState) { Console.WriteLine(string.Format("Instance_OnOperatingStateChanged From {0} To {1}", in_PrevState, in_OperatingState)); switch (in_OperatingState) { case EOperatingState.InvalidOperatingState: break; case EOperatingState.Off: break; case EOperatingState.Booting: break; case EOperatingState.Stop: break; case EOperatingState.Startup: AfterStartupOK(); break; case EOperatingState.Run: AfterRunOK(); break; case EOperatingState.Freeze: break; case EOperatingState.ShuttingDown: break; case EOperatingState.Hold: break; } }
private void onConfigurationChanged(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime, EInstanceConfigChanged in_InstanceConfigChanged, uint in_Param1, uint in_Param2, uint in_Param3, uint in_Param4) { if (mReconnect) { mReconnect = false; Log.Info("PLC '" + mPLCName + "' configuration changed. "); Task.Run(() => { try { connect(); } catch (Exception lExc) { if (mRemote) { Log.Error("Error while reconnecting to Siemens S7-PLCSIM Advanced v2 PLC '" + mPLCName + "' at host '" + mIP + ":" + mIPPort.ToString() + "'. " + lExc.Message, lExc.ToString()); } else { Log.Error("Error while rconnecting to Siemens S7-PLCSIM Advanced v2 PLC '" + mPLCName + "'. " + lExc.Message, lExc.ToString()); } } }); } }
private void onConfigurationChanging(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime) { if (mConnected) { mDisconnect = true; mReconnect = true; Log.Info("PLC '" + mPLCName + "' configuration changing started. "); } }
private void Instance_OnConfigurationChanging(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_DateTime) { //Growl.Info(string.Format("Instance_OnConfigurationChanging ")); }
private void Instance_OnUpdateEventDone(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_SystemTime, uint in_HardwareIdentifier) { }