Supported platforms: CODESYS 2.3, CODESYS 3.5

EL_ReadLog (FB)

Description

This function block reads G_EL_MAXVISIBLELOGLINES number of events log lines from log.

Events are internally read to a sorted list.

 

The event log view can be filled from top to bottom or bottom to top with the i_AscendingOrder flag.

 

Start position of the log is determined with i_StartPosition. The start position 0 is the beginning of sorted list.

The start position maximum value is limited to ensure that application does not scroll the list too far.

If sorted list contains at least G_EL_MAXVISIBLELOGLINES amount of events, the start position will be limited to o_FilteredListEventCount - G_EL_MAXVISIBLELOGLINES.

If sorted list contains less events than view of log size, then start position is always 0 because all sorted list events fit in view of log

 

Sorted list update/re-initialization can be forced with rising edge of i_UpdateSortedList input.

This can be used to update sorted list when changing filter condition without changing the filter variable.

The sorted list is also automatically updated when filter variable pointer or count is changed or sorting order changes or new events occur.

 

Events can be filtered according to i_pFilter and sorted according to i_SortingOrder_1st and i_SortingOrder_2nd.

For how to use guide, see How to Use EventLog Library.

Limitations

Initialization with EL_Init must be done before any other event log function can be called. MultiTool Creator automatically generates initializations to the code template.

 

Remember to update the value of the library parameter G_EL_NUMBER_OF_READLOG_INSTANCES if the application has more than one EL_ReadLog instances.

 

The instance(s) of EL_ReadLog should be called in every program cycle to prevent a high load burst.  

 

Inputs

Input variable name

Data type

Range

Description

i_StartPosition

UINT

0..

o_FilteredListEventCount - G_EL_MAXVISIBLELOGLINES

start position of the sorted list, 0 = first event in sorted list

i_AscendingOrder

BOOL

 

View fill direction

i_pFilter

POINTER TO EL_Filter

 

Pointer to filter table

i_FilterCount

BYTE

 

Number of filters in the table

i_SortingOrder_1st

BYTE

See example from EL_EventHashCode (FUN)

The highest sorting order. Default 1: type

i_SortingOrder_2nd

BYTE

See example from EL_EventHashCode (FUN)

The second sorting order. Default 0: none.

i_UpdateSortedList

BOOL

-

Rising edge forces sorted list update/re-initialization e.g. when filter condition is changed

Outputs

CODESYS 2.3CODESYS 2.3

Output variable name

Data type

Range

Description

o_ViewOfLog

ARRAY [1..G_EL_MAXVISIBLELOGLINES] OF EL_GUI_ViewOfLog

 

Event log view structure array

o_EventCount

WORD

0..G_EVENTLOG_SizeOfLog

Number of events currently in the event log

 

 

CODESYS 3.5CODESYS 3.5

Output variable name

Data type

Range

Description

o_ViewOfLog

ARRAY [1..G_EL_MAXVISIBLELOGLINES] OF EL_GUI_ViewOfLog

 

Event log view structure array

o_EventCount

WORD

0..G_EVENTLOG_SizeOfLog

Number of events currently in the event log

o_FilteredListEventCount

WORD

0..G_EVENTLOG_SizeOfLog

Filtered list event count

o_SortOrFilterBusy

BOOL

TRUE/FALSE

Sorting or filtering is busy = TRUE.

 

 

Example code

Definitions:

 

 

(*Events are filtered by ID and source*)

efilter: ARRAY [1..2] OF EL_Filter:=

(* show only ID's 100..200 *)

(FilterType:=EL_FTP_EVENTID ,Operator:=EL_FOP_AND, Negation:=FALSE, Arg1:=100 ,Arg2:=200),

(* ...from sources 5..10 *)

(FilterType:=EL_FTP_SOURCE  ,Operator:=EL_FOP_AND, Negation:=FALSE Arg1:=5 ,Arg2:=10);     

 

FilterCount:BYTE:=2;

LogView:EL_ReadLog;

 

 

Code:

 

LogView(

   i_StartPosition:=0,

   i_AscendingOrder:=FALSE,

   i_pFilter:=ADR(efilter),

   i_FilterCount:=FilterCount,

   i_SortingOrder_1st:=0,

   i_SortingOrder_2nd:=0,

   i_UpdateSortedList:=FALSE

);

 

 

 

See also

How to Use EventLog Library

 

 

Source file Topic000743.htm

Last updated 19-Dec-2024