Using the Translation Modes

General

The translation of the reactions can be individually configured in each node and for each submodule. Configuration takes place in the Init_Reactions action. This is an extract of the default source code of this action:

Extract of the default code Init_Reactions


(* System generated code, only to be changed by experienced programmers *)
   TPL.FC_InitReactionTranslationMode(i_udiNumberOfSubModules := c_udiNumberOfSubModules,
      i_petReactionTranslationMode := ADR(aetReactionTranslationMode),
      q_etDiag => etDiag,
      q_etDiagExt => etDiagExtTPL);
   TPL.FC_InitReactionTranslationTable(i_udiNumberOfSubModules := c_udiNumberOfSubModules,
      i_pstReactionTranslationTable := ADR(aastReactionTransla­tionTable),
      q_etDiag => etDiag,
      q_etDiagExt => etDiagExtTPL);
   TPL.FC_InitReactionTranslationJobs(i_udiNumberOfSubModules := c_udiNumberOfSubModules,
      i_pstReactionTranslationJobs := ADR(astReactionTranslationJobs),
      q_etDiag => etDiag,
      q_etDiagExt => etDiagExtTPL);
(* End of system generated code, only to be changed by experienced programmers *)  

Use of ET_ReactionTranslationMode.None

Nothing needs to be switched to use the ET_ReactionTranslationMode.None mode. It is the default mode and is set by the FC_InitReactionTranslationMode function.

Since only the reaction pending at the node is passed on to the submodule in this mode, no further configuration is necessary.

Use of ET_ReactionTranslationMode.Table

In order to use the ET_ReactionTranslationMode.Table mode, this mode must be set for the desired submodule.

 

 

(* switch to the reaction translation mode "Table" for module Slave1 *)
aetReactionTranslationMode[c_udiSlave1] := TPL.ET_ReactionTranslationMode.Table;

 The table for the reaction translation has already been pre-initialized by the FC_InitReactionTrans­lationTable function. A diagonal was entered in the table of each submodule by this function. In this state, the function corresponds to that of the ET_ReactionTranslationMode.None mode except that the calculation time is considerably higher since processing is more complex. If no translation is necessary, it is recommended to use the ET_ReactionTranslationMode.None mode.

If a translation is necessary, it can be configured as follows.

If ET_Reaction.SyncStopEL is pending, the Slave1 module should receive the ET_Reaction.SyncStopEH reaction instead.

aastReactionTransla­tionTable[c_udiSlave1,TPL.ET_Reaction.SyncStopEL].axReaction[TPL.ET_Reaction.SyncStopEL]:= FALSE;
aastReactionTransla­tionTable[c_udiSlave1,TPL.ET_Reaction.SyncStopEL].axReaction[TPL.ET_Reaction.SyncStopEH]:= TRUE;

As you can see, the standard reaction set by the FC_InitReactionTranslationTable function must always be eliminated first.

The modules Slave1 and Slave3 should receive the ET_Reaction.SyncStopEL reaction if the customer-specific error reaction 19 takes place.

aastReactionTranslationTable[c_udiSlave1,19].axReaction[19]:= FALSE;
aastReactionTransla­tionTable[c_udiSlave1,19].axReaction[TPL.ET_Reaction.SyncStopEL]:= TRUE;

aastReactionTranslationTable[c_udiSlave3,19].axReaction[19]:= FALSE;
aastReactionTransla­tionTable[c_udiSlave3,19].axReaction[TPL.ET_Reaction.SyncStopEL]:= TRUE;

The use of this mode is also covered in detail in the project planning guide in the Reaction translation section.

Use of ET_ReactionTranslationMode.Jobs

In order to use the ET_ReactionTranslationMode.Jobs mode, this mode must be set for the desired submodule.

 

 

(* switch to the reaction translation mode "Jobs" for module Slave2 *)
aetReactionTranslationMode[c_udiSlave2] := TPL.ET_ReactionTranslationMode.Jobs;  

Caution_Color.gifCAUTION

NO FORWARDING OF REACTIONS AS DEFAULT

Without further configuration, the changeover to ET_ReactionTranslationMode.Jobs mode results in no reactions being transferred to the submodule.

Failure to follow these instructions can result in injury or equipment damage.

Following the change of mode, you must now configure what reactions are to be forwarded and how. For this purpose, up to Gc_udiMaxNumberOfTranslationJobs jobs can be configured using the FC_AddReactionTranslationJob function.

Below, the example previously used for ET_ReactionTranslationMode.Table will be implemented.

If ET_Reaction.SyncStopEL is pending, the Slave1 module should receive the ET_Reaction.SyncStopEH reaction instead.

The modules Slave1 and Slave3 should receive the ET_Reaction.SyncStopEL reaction if the customer-specific error reaction 19 takes place. (Reaction 19 may still be transferred to the module.)

The Slave2 module should keep all reactions untranslated.

It was not mentioned above that all other reactions are to be put through untranslated. This is something we must now explicitly als Auftrag absetzen, in the event that it is necessary. For the Slave1 module it is the reactions 1 and 3 to Gc_udiMaxNumberOfReactions. For the Slave3 module, it is the reactions 1 to Gc_udiMaxNumberOfReactions.

(* Module Slave1 *)


   aetReactionTranslationMode[c_udiSlave1] := TPL.ET_ReactionTransla­tionMode.Jobs;
   

(* forward reaction 1 without translation *)


   TPL.FC_AddReactionTranslationJob(
      i_udiSourceStart := 1,
      i_udiNumReactions := 1,
      i_udiTargetStart := 1,
      iq_stReactionTranslationJobs := astReactionTransla­tionJobs[c_udiSlave1]);
   

(* translate reaction 2 as 3 *)


   TPL.FC_AddReactionTranslationJob(
      i_udiSourceStart := 2,
      i_udiNumReactions := 1,
      i_udiTargetStart := 3,
      iq_stReactionTranslationJobs := astReactionTransla­tionJobs[c_udiSlave1]);
   

(* forwared reaction 3 to TPL.Gc_udiMaxNumberOfReactions without translation *)


   TPL.FC_AddReactionTranslationJob(
      i_udiSourceStart := 3,
      i_udiNumReactions := TPL.Gc_udiMaxNumberOfReactions - 2,
      i_udiTargetStart := 3,
      iq_stReactionTranslationJobs := astReactionTranslationJobs[c_udiSlave1]);

   (* translate reaction 19 as 2 *)


   TPL.FC_AddReactionTranslationJob(
      i_udiSourceStart := 19,
      i_udiNumReactions := 1,
      i_udiTargetStart := 2,
      iq_stReactionTranslationJobs := astReactionTranslationJobs[c_udiSlave1]);

(* Module Slave2 *)


   aetReactionTranslationMode[c_udiSlave2] := TPL.ET_ReactionTranslationMode.None;

(* Module Slave3 *)


   aetReactionTranslationMode[c_udiSlave3] := TPL.ET_ReactionTransla­tionMode.Jobs;
   

(* forward reaction 1 to TPL.Gc_udiMaxNumberOfReactions without translation *)


   TPL.FC_AddReactionTranslationJob(
      i_udiSourceStart := 1,
      i_udiNumReactions := TPL.Gc_udiMaxNumberOfReactions,
      i_udiTargetStart := 1,
      iq_stReactionTranslationJobs := astReactionTransla­tionJobs[c_udiSlave3]);
   

(* translate reaction 19 as 2 *)


   TPL.FC_AddReactionTranslationJob(
      i_udiSourceStart := 19,
      i_udiNumReactions := 1,
      i_udiTargetStart := 2,
      iq_stReactionTranslationJobs := astReactionTranslationJobs[c_udiSlave3]);