Within the framework, regardless of the type of technological process controlled by the IACS, typical instrumentation objects are defined at the Control Module (CM) level across at least three levels:
The place of CM in the equipment hierarchy is described in more detail in Equipment Hierarchy in PAC Framework.

This section covers the general rules for working with CMs.
For each CM object, the following are defined (replacing the abbreviation CM with the class or level abbreviation):
Examples:
AIVAR_CFG – structural type for a process variable of the AIVAR classVAR.T101_TT100 of type AIVAR_CFG – PLC variable of type AIVAR_CFG in the VAR data block, used to store and process all settings of the corresponding process variableExamples:
AIVAR_HMI – structural type for AIVAR class process variables for HMI exchangeAIH.T101_TT100 of type AIVAR_HMI – PLC variable of type AIVAR_HMI in the AIH data block for PLC-HMI exchangeExamples:
VARBUF – structural type for a buffer variable working with VAR variables (AIVAR, DIVAR, etc.)BUF.VARBUF of type VARBUF – VARBUF instance in the BUF data blockExample:
// Calling the processing function for an analog process variable
"AIVARFN"(CHCFG := "SYS".CHAI["VAR".T101_TT100.CHID],
AIVARCFG := "VAR".T101_TT100,
AIVARHMI := "AIH".T101_TT100);
Each structure should include:
Example DIVAR_CFG structure (LVL1 process variable):

Example VLVD_CFG structure (LVL2 actuator):

The CM_BUF structural type generally includes all fields of the structural types corresponding to the CMs it interacts with, making it universal.
For process variables and channels, an alternative structure without CM_HMI.CMD is proposed, as the only command from the HMI is to load into the buffer. All other commands are handled via the buffer.
A 32-bit word can be used when 16 bits are insufficient, and the platform has no bit field restrictions.

Example of CM_CFG.CMD bit commands for an actuator:

CM_CFG.STA as a word.CM_CFG.STA as a word.Alternative CM_HMI.STA (for LVL0 and LVL1) includes the STA and a read-to-buffer command bit (X15).
Common STA bits:
CM_CFG.ID = CM_BUF.ID)Using CM_HMI.STA and CM_BUF.STA as INT/UINT words reduces I/O points and simplifies alarm handling in SCADA/HMI.
Example of CM_CFG.STA bit structure:

Buffer initialization occurs upon a read command (CM_HMI.CMD = 16#0100) or when bit X15=1 in CM_HMI.STA. The buffer receives all CM_CFG data.
Buffer occupation is checked:
#INBUF := (#AIVARCFG.ID = "BUF".VARBUF.ID) AND (#AIVARCFG.CLSID = "BUF".VARBUF.CLSID);
If true:
CM_CFG data.CM_BUF.CMD are processed and then cleared.Configuration data changes in the buffer only update within the buffer. Sending CM_CFG.CMD = 16#0101 writes configuration data from the buffer to CM_CFG.
Each function interacts externally through CM_CFG, CM_HMI, CM_BUF, and receives the ID. Other interface variables depend on the function.
| Interface Variable | Type | Purpose | Note |
|---|---|---|---|
| CM_CFG | INOUT | structure for CM_CFG | |
| CM_HMI | INOUT | structure for CM_HMI | |
| CM_BUF | INOUT | structure for CM_BUF | may be called directly if global |
| PLCCFG | INOUT | structure for CM_PLC | may be called directly if global |
Functions should be called in every cycle of the main cyclic task (MAST, OB1, etc.)! Multi-tasking rules depend on the platform and task specifics.
1) Each CM structure (except LVL0) should include STEP1 (UINT), T_STEP1 (UDINT), T_PREV for step-wise execution based on time.
Example:
#dT := "SYS".PLCCFG.TQMS - #AIVARCFG.T_PREV;
#AIVARCFG.T_PREV := "SYS".PLCCFG.TQMS;
#AIVARCFG.T_STEP1 := #AIVARCFG.T_STEP1 + #dT;
IF #AIVARCFG.T_STEP1 > 16#7FFF_FFFF THEN
#AIVARCFG.T_STEP1 := 16#7FFF_FFFF;
END_IF;
2) When using bit-packed STA, use internal variables for unpacking/packing, enabling edge detection.
Example:
#STA := #AIVARCFG.STA;
#BRK := #STA.BRK;
...
#INBUF := (#AIVARCFG.ID = "BUF".VARBUF.ID) AND (#AIVARCFG.CLSID = "BUF".VARBUF.CLSID);
#CMDLOAD := #AIVARHMI.STA.%X15;
...
Example of PLC general alarm logic:
#ALM := (#LOLO OR #HIHI) AND NOT #BAD;
IF #ALM THEN
"SYS".PLCCFG.ALM1.ALM := true;
"SYS".PLCCFG.CNTALM := "SYS".PLCCFG.CNTALM + 1;
IF NOT #AIVARCFG.STA.ALM THEN
"SYS".PLCCFG.ALM1.NWALM := true;
END_IF;
END_IF;
Each CM_FN corresponds to a CM class. It is convenient to implement all class functions within one function, using CLSID, ID, or PRM for subclass handling, similar to polymorphism and inheritance.
See Concept of Object Classification and Customization for details.