Documentation Home Page HYPERSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Applicom S7 | Configuration

The Applicom S7 I/O interface uses the legacy file system for configuration. It needs two configuration files to be able to work properly in HYPERSIM : the APPLICOM.IO and APPLICOM_CFG.OPAL files.

APPLICOM.IO

This file lists a series of important details needed by the HYPERSIM simulation. The name of the .io file must be specified in the hyServMain.cfg file (found at /export/local/ssr/hyconfig) with the line

IOFILE             IO_DRIVER.io


The name of the .io file can be changed as needed, but it is very important that you update the above mentioned line in the hyServMain.cfg file as well.

The file has three main sections, named as follows: [HARDWARE_DIL], [MAPPING] and [SENSORS_DIL]. Below is an explanation of how these sections must be completed in order to use the Applicom S7 driver in your simulation.

First of all, the [HARDWARE_DIL] section lists the drivers that will be used in the simulation. For the Applicom S7 driver to be included, the section should look as follows:

[HARDWARE_DIL]

!Tag

Type

Identification

IOMode

Config

!---

----

--------------

------

------

OPAL_ 1

Applicom

none

1

export/local/ssr/hyconfig/applicom_cfg.opal


You can choose the tag name as you wish; this tag is used to identify the driver further down in the next sections of the .io file. The config column must contain the full path to the configuration file of the driver.

The [MAPPING] section binds the tags defined in the section described above to cores of the simulator. Example:

[MAPPING]
!Tag                             Node
!---                                ----
OPAL_ 1                       1
Finally, the [SENSORS_DIL] section is used to bind sensors in the simulation to drivers identified with their tags.
The connections regarding the Applicom S7 cycles must be defined depending the configuration file, for instance:
cycles {
item {
card=1 channel=0 dataCount=8
databaseAddrOffset=0 id=10
period_ms=200 plcAddrOffset=524288 plcId=1 rw_mode=WRITE_BIT stateAfterStart=1 statusAddrOffset=1001
}
item {
card=1 channel=0 dataCount=8
databaseAddrOffset=50 id=20
period_ms=500 plcAddrOffset=524288 plcId=1 rw_mode=READ_BIT stateAfterStart=1 statusAddrOffset=1002
}
}

In the case of the above point, its connection point in the .io file will be the following:

  • S7_Cycle_{id}_DatabaseToWrite[0:dataCount-1] with id=10 (Write function)
  • S7_Cycle_{id}_DatabaseToRead[0:dataCount-1] with id=20 (Read function

For each cycle, connection on parameters can be set, full list of parameters that can be set:

  • S7_Cycle_$id$_$parameter$[0:$vectorSize$].

Possible parameter values are:

DatabaseToWritefor a 'write' cycle, this connection contains the element to write in the card database.
DatabaseToReadfor a 'read' cycle, this connection contains the element to read from the card database.
Enablethis connection is used to activate or deactivate a cycle. If the cycle is set to be launched at the load of the model, this signal will be bypassed until be put to true then false again.
Triggerthis connection is used to activate a single event of the cycle. If the cycle is enabled, putting this signal to true won't have any impact.
ErrorStatusthis connection provides a status code for the cycle. Code 0 means no issue, code 35 means no data has been transferred (improper configuration or server not started) and code 65530 means the cycle has been deactivated.
DataCountStatuscontains the number of data transferred (written or read) by the cycle.
DataTypeStatus1=bit, 2=byte, 3=word, 4=dword, 5=float.
DataExchangedcontains the data transferred during the last execution of the cycle. This example can also be seen below in the excerpt from the .io file.

The example .io file contains connections on parameters Enable, Trigger, ErrorStatus, DataCountStatus, DataTypeStatus, DataExchanged only for float type. These connections are optional, for instance, the user can define the state of each cycle (enabled or disabled) in the configuration file but if the user needs to change the state of a cycle during simulation, he can add connection on Enable. Trigger, ErrorStatus, DataCountStatus, DataTypeStatus, DataExchanged can be used to debug.

Here is a part of the file:

!Type

Sensors

Tag

ConnectionPoint

Modifier

!----

-------

---

---------------

--------

DA

20001 20008

OPAL_1

"S7_Cycle_10_DatabaseToWrite[0:7]"

none

DA

20009 20009

OPAL_1

"S7_Cycle_30_DatabaseToWrite[0]"

none

DA

20010 20010

OPAL_1

"S7_Cycle_50_DatabaseToWrite[0]"

none

DA

20011 20011

OPAL_1

"S7_Cycle_70_DatabaseToWrite[0]"

none

DA

20012 20012

OPAL_1

"S7_Cycle_90_DatabaseToWrite[0]"

none

DA

20013 20016

OPAL_1

"S7_Cycle_110_DatabaseToWrite[0:3]"

none

DA

20017 20017

OPAL_1

"S7_Cycle_110_Enable[0]"

none

DA

20018 20018

OPAL_1

"S7_Cycle_110_Trigger[0]"

none

DA

20019 20019

OPAL_1

"S7_Cycle_120_Enable[0]"

none

DA

20020 20020

OPAL_1

"S7_Cycle_120_Trigger[0]"

none

AD

25001 25008

OPAL_1

"S7_Cycle_20_DatabaseToRead[0:7]"

none

AD

25009 25009

OPAL_1

"S7_Cycle_40_DatabaseToRead[0]"

none

AD

25010 25010

OPAL_1

"S7_Cycle_60_DatabaseToRead[0]"

none

AD

25011 25011

OPAL_1

"S7_Cycle_80_DatabaseToRead[0]"

none

AD

25012 25012

OPAL_1

"S7_Cycle_100_DatabaseToRead[0]"

none

AD

25013 25016

OPAL_1

"S7_Cycle_120_DatabaseToRead[0:3]"

none

AD

25017 25017

OPAL_1

"S7_Cycle_110_ErrorStatus[0]"

none

AD

25018 25018

OPAL_1

"S7_Cycle_110_DataCountStatus[0]"

none

AD

25019 25019

OPAL_1

"S7_Cycle_110_DataTypeStatus[0]"

none

AD

25020 25023

OPAL_1

"S7_Cycle_110_DataExchanged[0:3]"

none

AD

25024 25024

OPAL_1

"S7_Cycle_120_ErrorStatus[0]"

none

AD

25025 25025

OPAL_1

"S7_Cycle_120_DataCountStatus[0]"

none

AD

25026 25026

OPAL_1

"S7_Cycle_120_DataTypeStatus[0]"

none

AD

25027 25030

OPAL_1

"S7_Cycle_120_DataExchanged[0:3]"

none


A few comments can be made on the content of these lines:

  • The offsets of the signals can differ based on how many other drivers are used in the simulation.

Therefore, the above excerpt should be taken only as an example.

  • The connection point type is “DA” when it is a point controlled by the model (i.e. writing in the PLC database) and it is “AD” when the Applicom S7 driver is reading from PLC.

The file also contains a relative path to the applicom_cfg.opal file. This file is very important, as it is used to configure the card and the cycles created. It is described in more detail below.

APPLICOM_CFG.OPAL

This file can be used for two purposes: you can configure the card by setting the .ply path to file used to initialize the card and you can set all the attributes and properties of every cycle.

For the driver, there are only one parameter: the .ply path:


OPAL-1.0 Object Applicom::Configuration {
plyFile=x32/Data/Drivers/Applicom/applicom.ply


If no .ply path specified, the driver will stop its execution and prompt the user with an error message.

Configuration of the Card with PLY File

A .ply file is necessary before running the model, without the ply file, the card cannot be initialized. For this, the software applicom console is required.

Install the software, then open the applicom console:

Right click on "Boards Configuration", select "Configuration manager" then click on "New" and check "Without" under the "Board Connexion" panel. Choose a name for your new configuration and write a short description.

Click "OK". You might have to re-launch the software for the new configuration to be taken in account. Right click on "Boards Configuration" and select "Add board". Choose your board and set the EPROM Version to the one of your Applicom card.

Double click on "Channel 0" and select "TCP/IP and ISO, Client/Server"

Select "Industrial Ethernet Siemens"

Configure parameters of the Applicom card, IP address, Gateway IP address and Sub-Network mask

Insert a new Equipment (which is the PLC) (make sure you select Server Equipment under TCP/IP)

Configure its IP address (you may have to deselect "Link Parameters") which is IP of the PC, make sure to keep in mind the "Number" of the PLC which will be used in the configuration

Then generate file, go under "File" then "Board Initialization", you will find your .ply file on the location (Configuration path) specified (second screenshot)

Quick Summary:

The user must use Snap7 server to connect with the Applicom card client running on the simulator. The IP address that has to be used in Snap7 server to connect with the Applicom card is the IP address defined in the .ply file for the PLC.

 The user must use their own .ply file to exchange data with the Applicom card.

.ply file currently present in the example model is configured with the following IP addresses:

Applicom card: 192.168.20.120 and PLC (IP of the PC): 192.168.20.166

Cycles Configuration

Below you can see again an example of how a point should be configured. cycles is a list of each cycle that will be created.

cycles {
item {
card=1 channel=0 dataCount=8
databaseAddrOffset=0 id=10
period_ms=200 plcAddrOffset=524288 plcId=1 rw_mode=WRITE_BIT stateAfterStart=1 statusAddrOffset=1001
}
item {
card=1 channel=0 dataCount=8
databaseAddrOffset=50 id=20
period_ms=500 plcAddrOffset=524288 plcId=1 rw_mode=READ_BIT stateAfterStart=1 statusAddrOffset=1002
}
}


Each cycle has:

  • card is the card number (between 1 and 8)
  • channel is the channel number on card (between 0 and 31)
  • dataCount is the number of data to read or write (should be between 1 and 1024)
  • databaseAddrOffset offset address in card database to read or write
  • id is the identification number of Cycle (between 1 and 255)
  • period_ms is the period of the cyclic function, should be multiple of 100ms (if 0, no delay)
  • plcAddrOffset is the offset address in PLC to read or write
  • plcId is the ID of PLC defined in *.ply (between 0 and 255)
  • rw_mode is the type of read or write to execute.


Possible values are:

WRITE_BIT , READ_BIT , WRITE_BYTE , READ_BYTE , WRITE_WORD , READ_WORD ,
WRITE_BCD_WORD , READ_BCD_WORD , WRITE_DWORD , READ_DWORD , WRITE_FLOAT , READ_FLOAT

  • stateAfterStart is the state of the cycle after starting the model (0=stopped, 1=started)
  • statusAddrOffset is the offset address in card database storing cycle status


Complete Configuration File Example

OPAL-1.0 Object
Applicom::Configuration {
plyFile=x32/Data/Drivers/Applicom/applicom.ply
cycles {
item {
card=1
channel=0
dataCount=8
databaseAddrOffset=0
id=10
period_ms=200
plcAddrOffset=524288
plcId=1
rw_mode=WRITE_BIT
stateAfterStart=1
statusAddrOffset=1001
}
item {
card=1
channel=0
dataCount=8
databaseAddrOffset=50
id=20
period_ms=500
plcAddrOffset=524288
plcId=1
rw_mode=READ_BIT
stateAfterStart=1
statusAddrOffset=1002
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=100
id=30
period_ms=200
plcAddrOffset=65552
plcId=1
rw_mode=WRITE_BYTE
stateAfterStart=1
statusAddrOffset=1003
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=150
id=40
period_ms=500
plcAddrOffset=65552
plcId=1
rw_mode=READ_BYTE
stateAfterStart=1
statusAddrOffset=1004
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=200
id=50
period_ms=200
plcAddrOffset=131072
plcId=1
rw_mode=WRITE_WORD
stateAfterStart=1
statusAddrOffset=1007
}
item {
card=1BCDWord
channel=0
dataCount=1
databaseAddrOffset=250
id=60
period_ms=500
plcAddrOffset=131072
plcId=1
rw_mode=READ_WORD
stateAfterStart=1
statusAddrOffset=1008
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=300
id=70
period_ms=200
plcAddrOffset=131088
plcId=1
rw_mode=WRITE_BCD_WORD
stateAfterStart=1
statusAddrOffset=1009
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=350
id=80
period_ms=500
plcAddrOffset=131088
plcId=1
rw_mode=READ_BCD_WORD
stateAfterStart=1
statusAddrOffset=1010
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=400
id=90
period_ms=200
plcAddrOffset=131104
plcId=1
rw_mode=WRITE_DWORD
stateAfterStart=1
statusAddrOffset=1011
}
item {
card=1
channel=0
dataCount=1
databaseAddrOffset=450
id=100
period_ms=500
plcAddrOffset=131104
plcId=1
rw_mode=READ_DWORD
stateAfterStart=1
statusAddrOffset=1012
}
item {
card=1
channel=0
dataCount=4
databaseAddrOffset=500
id=110
period_ms=200
plcAddrOffset=196608
plcId=1
rw_mode=WRITE_FLOAT
stateAfterStart=1
statusAddrOffset=1013
}
item {
card=1
channel=0
dataCount=4
databaseAddrOffset=550
id=120
period_ms=500
plcAddrOffset=196608
plcId=1
rw_mode=READ_FLOAT
stateAfterStart=1
statusAddrOffset=1014
}
}
}

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter