Join us today!
Creating an Alarm Table in Visualization
To create an alarm table in visualization, we need to enable the 'Event table' special control feature in the PLC properties first.
Add the visualization to your project. Right click your PLC Project, select 'add', then visualization.
After adding the visualization, we will enable the 'Event table' in the project properties. Right click your PLC Project and choose 'Properties'.
Select the 'Visualization Profile' on the left menu and check the 'EventTable' checkbox.
Open the visualization and go to Toolbox. You will now see the 'Event Table' under special controls tools. Drag and drop it to workspace.
Add the Tc2_Utilities library into your project.
Add the alarm event array declaration in your MAIN program and build your project.
stAlarmEvents : ARRAY[1..80] OF ST_ReadEvent;
Open the visualization, select the event table in the workspace and go to properties. In the 'Event data array' section, select the array variable we declared in the MAIN program.
In the MAIN program, now we can define our alarm events. Add the code below.
//Alarm 1 stAlarmEvents[1].nSourceId := 1; stAlarmEvents[1].nEventId := 1; stAlarmEvents[1].nClass := 7; stAlarmEvents[1].nConfirmState := 1; stAlarmEvents[1].nResetState := 1; stAlarmEvents[1].sSource := 'fbSensorAlarmCheck'; stAlarmEvents[1].sDate := '09/16/2022'; stAlarmEvents[1].sTime := '11:41:51'; stAlarmEvents[1].sComputer := 'PLC-1'; stAlarmEvents[1].sMessageText := 'Prox Sensor has failed'; stAlarmEvents[1].bQuitMessage := FALSE; stAlarmEvents[1].bConfirmable := TRUE; //Alarm 2 stAlarmEvents[2].nSourceId := 1; stAlarmEvents[2].nEventId := 1; stAlarmEvents[2].nClass := 8; stAlarmEvents[2].nConfirmState := 1; stAlarmEvents[2].nResetState := 1; stAlarmEvents[2].sSource := 'fbDriveErrorCheck'; stAlarmEvents[2].sDate := '09/16/2022'; stAlarmEvents[2].sTime := '11:45:51'; stAlarmEvents[2].sComputer := 'PLC-1'; stAlarmEvents[2].sMessageText := 'Check motor parameters!'; stAlarmEvents[2].bQuitMessage := FALSE; stAlarmEvents[2].bConfirmable := TRUE;
nSourceID - You can assign a source ID
nEventId - You can assign event an ID
nClass -
(* nClass 1 - Maintenance 2 - Message 3 - Hint 4 - Information 5 - Instruction 6 - Warning 7 - Alarm 8 - Parameter Error *)
sSource - You can use the function block name which is generating the alarm.
sMessageText - Your alarm message.
You can check this tutorial the get the system local time and use it for sDate and sTime. You would need to convert the data to string and concatenate the hour, min, sec info etc...
To clear the alarms, you can declare and empty event structure and assign it to your array elements when you need to clear them.
stEmptyEvent : ST_ReadEvent;
IF bClearAlarms THEN stAlarmEvents[1] := stEmptyEvent; stAlarmEvents[2] := stEmptyEvent; END_IF
You can also use FB_AdsReadEvents function block to read all the events in the ADS and display them in the event table and you can utilize the Beckhoff TcEventConfigurator to create and configure your alarms.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
the latest Beckhoff TcEventConfigurator image,
could you explain the best one..., which is for TwinCAT2 or TwinCAT3?,How is it used?
I would be very grateful if you could give an example of how TcEventConfigurator is used...
Thank you very much for everything, Victor.
https://github.com/runtimevic
https://github.com/TcMotion
https://www.youtube.com/playlist?list=PLEfi_hUmmSjFpfdJ6yw3B9yj7dWHYkHmQ
https://github.com/VisualPLC
@runtimevictor TcEventConfigurator for TwinCAT 2, but you may be able to use it for TwinCAT 3 as well. I prefer creating my own array instead and passing the event data into that array as explained above.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
- 17 Forums
- 265 Topics
- 932 Posts
- 1 Online
- 688 Members