Multi task structure. Schneider Electric PL7 Micro/Junior/Pro
Mainos
Mainos
5.3
Multi task structure
Presentation
Introduction to this section
What's in this
Section?
This section describes how a multi task application runs.
This section contains the following topics:
Topic
Multitask software structure
Sequencing tasks in a multitask structure
Assigning input/output channels to master and fast tasks
Exchanging inputs/outputs in event processes
Software structure
Page
35015365.01 07/2008
103
Software structure
Multitask software structure
Description Task structure for such an application is as follows:
Task
Master
Fast
Event
Name
MAST
FAST
EVTi
Description
Always present which can be cyclic or periodic.
Optional which is always periodic.
Called up by the system when an event appears on an input/output data module.
These processes are optional and are used for applications which need short response times to act on inputs/outputs.
Illustration The following drawing shows multitask structure tasks and their priority level.
Master task Fast task Event processes
Priority
+
104
35015365.01 07/2008
Example
Software structure
The following example shows a multitask structure made up of a master task MAST, a fast task FAST and 2 event processes EVTO and EVTI.
MAST FAST
Sas (LD) Alarm_Sas (LD)
EVT0
Oven_1 (Grafcet)
Monitor_drying (LD)
Alarm_Oven (ST)
PRL (LD)
Alarm_Cleaning (ST)
CHART
POST (IL)
SR0
Drying (LD)
SR0
Cleaning (ST)
35015365.01 07/2008
105
Software structure
Sequencing tasks in a multitask structure
General points
Operation
The master task default is active.
The fast task default is active if it is programmed.
The event process is activated when the event associated with it occurs.
The following table describes running priority tasks.
Phase
1
2
3
4
Description
Arrival of an event or beginning of the fast task cycle.
Stopping the running of tasks in progress that have a lower priority,
Running the priority task.
The interrupted task takes over again when the priority task processes have finished.
Description of sequencing tasks
Checking tasks
The following drawing illustrates task sequencing for a multitask process including a cyclical master task, a fast 20ms task and an event process.
E v e n t
F a s t
E T S E T S E T S E
E
T S E T S
E T T S E T T S E T Ma s t e r
Sy s t e m
2 0 m s 2 0 m s 2 0 m s 2 0 m s
Key:
E: Acquisition of inputs
T: program processing
S: updating outputs
Running fast and event tasks can be checked by the program by using system bits: z z z
%S30 is used to activate or not the master task MAST.
%S31 is used to activate or not the fast task FAST.
%S38 is used to activate or not event tasks EVTi.
106
35015365.01 07/2008
Software structure
Assigning input/output channels to master and fast tasks
General points
Discrete modules
Counting modules
Analogue modules
As well as the application program master MAST and fast FAST tasks run system functions linked to managing implicit inputs/outputs associated with them.
Associating a channel or group of channels to a task is defined in the configuration screen of the corresponding data module, the associated default task being the
MAST task.
As the modularity of discrete modules is 8 successive channels (channels 0 - 7, channels 8 - 15,…), inputs/outputs can be assigned by groups of 8 channels either to the MAST task or the FAST task.
Example: it is possible to assign channels of a 28 input/output module in the following way: z z z z inputs 0 - 7 assigned to the MAST task, inputs 8 -15 assigned to the FAST task, outputs 0 - 7 assigned to the MAST task, outputs 8 - 15 assigned to the FAST task.
Each counting module channel can be assigned either to the MAST task or the
FAST task.
Example: for a 2 channel counting module it is possible to assign : z z channel 0 to the MAST task, channel 1 to the FAST task.
Micro analogue input module channels must be assigned to the MAST task. On the other hand it is possible to assign analogue output channels or groups of channels either to the MAST task or the FAST task with a 2 channel modularity.
Example : for a 4 analogue output module it is possible to assign: z z channels 0 and 1 to the MAST task and, channels 2 and 3 to the FAST task.
The Premium analogue input and output module channels can be assigned to the
MAST task or the FAST task. This assigning is individual for each of the isolated analogue input or output module channels (4 isolated channels) and with a modularity of 4 channels for the other modules.
Note: in order to achieve the best performance, it is preferable to regroup the channels of a module into the same task.
35015365.01 07/2008
107
Software structure
Exchanging inputs/outputs in event processes
General points
Operation
It is possible to use input/output channels other than those relating to the event for each process.
Exchanges are then made implicitly by the system before (%I) and after (%Q) in the process to be applied.
These exchanges can be related to a channel (e.g. counting module) or to a group of channels (discrete module). In the second case, if, for example, the process modifies outputs 2 and 3 of a discrete module, the map of outputs 0 - 7 will be transferred to the module.
The following table describes the exchanges and processes carried out.
Phase
1
2
3
4
5
Description
The appearance of an event diverts the application program to the process that is associated with the input/output channel which has caused the event.
All the inputs associated with the channel that has caused the event are acquired automatically.
All the inputs used by the user in the EVTi process are acquired.
The event process is carried out. It must be as short as possible.
All the outputs used by the user in the EVTi process are updated. The outputs associated with the channel that caused the event must also be used, so that they are updated.
Programming rules
General rule:
The inputs exchanged (and the associated group of channels) when the event process is carried out are updated again (loss of historic values and therefore edges). You must therefore avoid testing edges on these inputs in master tasks
(MAST) or fast tasks (FAST).
In the case of modules TOR TSX DEY16FK, TSX DMY28FK or TSX DMY28RFK :
The input which triggered the event must not be tested in the event process (the value is not updated).
Testing the edge which triggered the event must be done on the status word: z z
%IWxy.i:X0 = 1 --> rising edge,
%IWxy.i:X0 = 1 --> rising edge.
108
35015365.01 07/2008
Performance
Software structure
On Micro PL7s : z z analogue input modules which can only be used in the MAST task must not be exchanged in an event process.
for each event process, it is possible to declare at the most the exchanges for 2 input modules (before the event process) and 2 output modules (after the event process).
On Premium PL7s, according to the processor used, the number of exchanges used is limited:
P57-2• /3• /4• Number of exchanges that can be used in event processes by processor
P57-1•
Discrete inputs/outputs
Analogue inputs/outputs
Other application specific
32 exchanges
8 exchanges
4 exchanges
128 exchanges
16 exchanges
16 exchanges
For discrete inputs/outputs an exchange involves a group of 8 channels. It is generated when using inputs from a group of 8 channels (other than the group of channels that generated the event) and when writing the output for a group of 8 channels.
For analogue inputs/outputs or another application specific, an exchange is generated when using the inputs from one channel (other than the channel which generated the event and when writing from channel outputs).
Note: z as input/output exchanges in the EVTi task are done by channel (for some analogue and application specific modules) or by group of channels (for discrete z modules and some analogue modules), if the process modifies outputs 2 and 3 of a discrete module for example, the map (automatic memory) of outputs 0 - 7 will be transferred to the module.
any exchange of an input/output in an event task can cause the loss of edge information with regard to the process carried out on this channel (or group of channels), in the task where it was declared. MAST or FAST
Displaying the number of events processed
The system word %SW48 gives the number of events processed.
This word is initialized at 0 on starting from cold, then incremented by the system when an event is launched.
This word can be modified by the user.
The system bit %S39 indicates the loss of an event.
35015365.01 07/2008
109
Lataa
Mainos