Common Industrial Protocol

The Common Industrial Protocol (CIP) is a protocol used in industrial applications. Packet Tracer supports Identity and TCP/IP Interface Objects defined by the CIP through the PTINTERNAL script module.

 

Devices

In a simulated device such as "Things", create an empty JavaScript program. Enable CIP by calling CIP.setup within the program.

CIP device

 

To obtain device information via CIP, create a CIPClient in a JavaScript program.

CIP client

 

Running CIP

Create a topology with devices capable of running script programming.

CIP topology

 

  1. Enable CIP on the device.
  2. Set the identity of the device.
  3. Create an object that represents the capabilities of the device.
  4. Obtain the device information through the CIPClient.
    (Note: Refer to the API description for detailed instructions on how to perform each step.)
CIP programming

 

JavaScript API

Program Structure and Events

Function 

Return Type

Description 

Example 

setup()

N/A

Enables CIP on the device.

CIP.setup();

setIdentity(identity)

N/A

Sets identity object of the device.

var identity='{"vendor":939,"type":1,"code":9046,"revision":"1.1","status":"","serial":12346,"name":"pt cip1"}';
CIP.setIdentity(identity);

addObject(classCode, instanceId, data)

N/A

Creates a new object type for the device.

var ptObject = {};
ptObject.data = 0;
CIP.addObject(3000,1,JSON.stringify(ptObject));

removeObject(classCode, instanceId)

N/A

Removes an existing object type from the device.

CIP.removeObject(3000,1);

getObjectAttribute(classCode, instanceId, attributeId)

attribute

Gets object attribute value.

CIP.getObjectAttribute(3000,1,2);

listIdentityAll()

N/A

Finds all CIP enabled devices and lists their identities.

CIP.listIdentityAll();

connect(ip)

bool

Connects to a CIP device.

var client = new CIPClient();
client.connect("10.0.0.2");

close()

N/A

Closes a CIP connection.

client.close();

listIdentity()

N/A

Retrieves identity of the device.

client.listIdentity();

getAttributeSingle(classId, instanceId, attributeId)

N/A

Retrieves an attribute of an object based on the class, instance, and attribute.

client.getAttributeSingle(1,1,7);

getAttributesAll(classId, instanceId)

N/A

Retrieves all attributes of an object based on the class and instance.

client.getAttributesAll(245,0);

setAttributesAll(classId, instanceId, data)

N/A

Sets all attributes of an object based on the class and instance.

var ptObject = {};
ptObject.data = 900;
client.setAttributesAll(3000,1,JSON.stringify(ptObject));

forwardOpen(ip, classId, instanceId, timer)

bool

Initiates communication with a device using the IP address, class, and instance.

client.forwardOpen("10.0.0.2", 3000, 1, 5000);

forwardClose()

N/A

Closes the connection opened by forwardOpen.

client.forwardClose();

onConnectionChange(event)

N/A

Sets the callback that is invoked when TCP connection state changes.

client.onConnectionChange = function(event) {};

onReceive(data)

N/A

Sets the callback that is invoked when data is received.

client.onReceive = function(data) {};

 

Examples

Sample File Description

cip-identity.pkt

Demonstrates how to use identity object in CIP.

cip-implicit.pkt

Demonstrates implicit and explicit messaging in CIP.

cip-object.pkt

Demonstrates how to create objects in CIP.

 

Current Modeling Limitations

CIP PDUs can be viewed in simulation by enabling the "TCP" and "UDP" filters. The PDUs do not show CIP in detail.