CIMWAY

Concept Link IconSee also Concept Link IconExample

Communication control for most of the polling-based data acquisition drivers.

WebVue support - Yes.

Mode

Mnemonic

Syntax

0 OFF 1
1

ON

1
2 STATCIM 1
3 SCANMDF 2
4 STATUS 3
5 ERROR 4
7 EXIST 3
8 CFG 6
9 START 3
10 STOP 3
11 READAFTERWRITE 7
12 SCANALWAYS 1
13 WRITEGROUP 8
14 OVERWRITEFILE 9
15 SENDMSG 12
17 SEQUENCINGWRITE 1, 10
18 GETPENDINGWRITE 1
19 READFRAME

11

Syntax 1

IntVal = CIMWAY (Mode);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

0

OFF

Stop the communication manager.

 

 

Return: 1 if successful, else 0.

1

ON

Start the communication manager.

 

 

Return: 1 if successful, else 0.

2

STATCIM

Return the state of the communication manager.

 

 

Return: 1 if running, else 0.

12

SCANALWAYS

Force all cyclic frames to be scanned even if they are not connected to any variables.

 

 

Return: 1 if successful, else 0.

17

SEQUENCINGWRITE

Enable or disable the sequential mode of recording.

 

 

Return: 1 if successful, else 0

18

GETPENDINGWRITE

Obtain the number of entries in the communication manager's queue.*

 

 

Return: number of entries.

*GETPENDINGWRITE returns a LONG.

Syntax 2

IntVal = CIMWAY(Mode, Network.Node.Frame, Period);

Return type: INTEGER.

Argument

Meaning

Period

The new period in seconds at which the specified frame is to be scanned. The maximum number is 3276. Any numeric type.

Execution

Mode

Mnemonic

Action

3

SCANMDF

Modify the scan period of a communication frame. The behavior caused by the Period argument is as follows.

>0 Use that period.
0 Disable scanning.
-1 Use the previous period only if the current period is 0 or after a CIMWAY("STOP", "frame object"). Else, nothing happens.
-2 Use the scan period from the frame configuration.

 

 

Return: 1 if the frame exists, -1 if the scan period is out of bounds (less than -2 or greater than 3276), else 0 (frame not found...).

Example

Using a configured frame scan period of 20 seconds.

Period Actual scan period
5 5 seconds
-2 20 seconds
10 10 seconds
0 Stop scanning
-1 10 seconds
5 5 seconds
-1 5 seconds

Syntax 3

IntVal = CIMWAY(Mode, CommObjectName);

Return type: INTEGER.

Argument

Meaning

CommObjectName

The communication object. It may be a network, a node or a frame.

 

Network: Network name

 

Node: Network_name.Node_name

 

Frame: Network_name.Node_name.Frame_name

Execution

Mode

Mnemonic

Action

4

STATUS

Returns the current status of the communication object.

 

 

Return: 1 if OK, 0 if failed, -1 if it does not exist.

7

EXIST

Test if a communication object exists.

 

 

Return: 1 if it exists, else 0.

9

START

Enable the communication object.

 

 

Return: 1 if OK, 0 if syntax error or the object is unknown.

10

STOP

Disable the communication object.

 

 

Return: 1 if OK, 0 if syntax error or the object is unknown.

 

 

 

Variables linked to the communication object are not flagged as invalid.

Syntax 4

LongVal = CIMWAY(Mode, CommObjectName);

Argument

Meaning

CommObjectName

The communication object. It may be a network, a node or a frame.

 

Network: Network name

 

Node: Network_name.Node_name

 

Frame: Network_name.Node_name.Frame_name

Return type: LONG.

Execution

Mode

Mnemonic

Action

5

ERROR

Return the error counter for the specified communication object.

 

 

Return: The value of the error counter.

The error counter represents the number of failed requests.

Syntax 6

IntVal = CIMWAY(Mode, CommObjectName, Modif, Param, [, ResultVar]);

Return type: INTEGER.

Argument

Meaning

CommObjectName

Configuration element to modify: A network, a device or a frame.

Modif

The property you want to modify:

 

PORT_NUMBER: Modification of the port number used to connect to the network. ComObj is the name of a network. For example, Net1. In general only used for drivers using a serial port.

 

EQT_ADDRESS: Modification of the equipment address. ComObj is the name of a device attached to the network. For example, Net1.Dev1.

 

MEMORY_ADDRESS: Modification of a frame address. ComObj is the name of a frame attached to the device. For example, Net1.Dev1.Frame1.

Param

Depending on the value of Modif.

  • If Modif is PORT_NUMBER, then Param is the port number in the range 1 to 64 (COM1 to COM64). Type STR.

  • If Modif is EQT_ADDRESS, then Param is a string with a typical syntax like Param1#Param2#Param3...#ParamN. Type STR.
    The exact syntax depends on the communication driver being modified. For more information, please refer to the SCADA Basic section in the topic describing the Equipment driver of interest.

  • If Modif is MEMORY ADDRESS, then Param is the address to apply to the frame. The value depends on the equipment type. Type INTEGER.

ResultVar

Specifies the name of the variable where the status of the modification is stored.

Execution

Mode

Mnemonic

Action

8

CFG

Modify the parameters of a communication element. The status of the modification can be returned in the optional register VarName:

0 = Modification in progress
1 = Modification completed successfully
2 = Modification failed

 

 

Return: 1 if OK, 0 if the configuration element to modify is unknown or if the parameters are incorrect.

Syntax 7

IntVal = CIMWAY(Mode, network_name.Equipment_name.Frame_name, RM);

Return type: INTEGER.

Argument

Meaning

RM

The read after write mode:

 

1 - YES

 

2 - NO

Execution

Mode

Mnemonic

Action

11

READAFTERWRITE

Control read after every write.

 

 

Return: 1 if OK, 0 if the frame is unknown or syntax error.

Syntax 8

IntVal = CIMWAY(Mode, network_name.Equipment_name.Frame_name, Delay, Mode, Flag);

Return type: INTEGER.

Argument

Meaning

Delay

A period in seconds.

Mode

A flag corresponding to the mode in the instruction SENDLIST:

 

0 for block mode.

 

1 for multiple mode.

Flag

Either 1 or 0.

Execution

Mode

Mnemonic

Action

13

WRITEGROUP

Optimize processing of write frames by CIMWAY.

Normally a write frame is processed when any of the variables linked to it change. This instruction causes changes to be buffered and the frame processed once every Delay number of seconds.

If the flag is set to 1 then all changes of a variable are sent. If the flag is 0 then changes may be lost.

For example, if the delay is set to 5 and a variable changes from 1 to 0 and then back to 1 again within the processing period, the change will not be seen.

 

 

Return: 1 if OK, 0 if the frame is unknown or there is a syntax error.

If you enter a fraction for Delay, it will be rounded down to a whole number (e.g. 0.5 will become 0 and 1.8 will become 1).

Syntax 9

IntVal = CIMWAY (Mode, FileName);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

14

OVERWRITEFILE

Replaces the communication configuration file.

The file FileName is renamed to COMM.DAT and copied to the C and TEMP folders of the project.

 

 

Return: 0 if successful, else:

-1 if the file to be imported is not found
-2 is the file name is for a folder
-3 if writing to COMM.DAT is not possible (write permissions etc.)
-4 if writing to CTEMP\COMM.DAT is not possible (write permissions etc.)

 

The original COMM.DAT file is discarded.

Syntax 10

IntVal = CIMWAY (Mode, Sequence/not);

Return type: INTEGER.

Argument

Meaning

Sequence/not

"YES" - enable.

"NO" - disable.

Execution

Mode

Mnemonic

Action

17

SEQUENCINGWRITE

Enable or disable the sequential mode of recording.

 

 

Return: 1 if successful, else 0.

Syntax 11

IntVal = CIMWAY (Mode, Frame, ResultVar);

Return type: INTEGER.

Argument

Meaning

Frame

To identify the frame, e.g. "NETWORK.EQUIPMENT.FRAME1"

ResultVar

Name of variable in which the status of the reading is to be provided.

Execution

Mode

Mnemonic

Action

19

READFRAME

To request updating of the frame and obtain the status of the reading via the variable.

 

 

Return: 1 if successful, else:

0 if the arguments are incorrect.

2 if the variable is already in use by another READFRAME request.

 

 

States indicated in the variable named VarName:

0 Request in progress.

1 Reading was successful: variables updated.

2 Reading error: the variables are incorrect.

Syntax 12

IntVal = CIMWAY (Mode, CommObjectName, CommandString);

Return type: INTEGER.

Argument

Meaning

CommObjectName

Identifies the target object identifier, for access to:

All networks: Empty string.

One network: NetworkId.

One device: NetworkID.EquipmentId.

One frame: NetworkID.EquipmentId.FrameId.

Type STR.

CommandString

The command to send to the driver. Type STR.

The list of commands and syntax depend on the communication driver.
For more information, please refer to the SCADA Basic section in the topic describing the Equipment driver of interest.

Execution

Mode

Mnemonic

Action

15

SENDMSG

Sends a message to communication objects.

 

 

Return: 1 if successful (communication object took account of the message), else 0.

Examples

To activate the sequential mode of recording:

CIMWAY("SEQUENCINGWRITE", "YES");

To obtain the number of entries in the queue:

IntVal = CIMWAY ("GETPENDINGWRITE");

To update the communication frame:

CIMWAY("READFRAME","NETWORK.EQT1.WORD","RESULT");

For a larger example, select the Example link above.