fwConfigs
fwPeriphAddressS7.ctl File Reference

Functions

 _fwPeriphAddressS7_set (string dpe, dyn_anytype addressConfig, dyn_string &exceptionInfo, bool setWait=true)
 
int fwPeriphAddressS7_parseInt (string parsedString, int errCode=EXC_S7PARSEINT, int startPos=0, int length=0)
 
private void fwPeriphAddress_parseS7Address_DBx (string addr)
 
private void fwPeriphAddress_parseS7Address_main (string addr)
 
private errClass throwS7Exception (int errCode, string errTxt="")
 
 fwPeriphAddress_checkS7Parameters (dyn_string dsParameters, dyn_string &exceptionInfo)
 
 _fwPeriphAddressS7_get (string dpe, dyn_anytype &addressConfig, bool &isActive, dyn_string &exceptionInfo)
 
 _fwPeriphAddressS7_delete (string dpe, dyn_string &exceptionInfo)
 
 _fwPeriphAddressS7_initPanel (string dpe, dyn_string &exceptionInfo)
 
string _fwPeriphAddressS7_setValuesFromRef (string reference, string sSystemName)
 
int _fwPeriphAddressS7_getTransfo ()
 
string _fwPeriphAddressS7_encodeAddress ()
 
int _fwPeriphAddressS7_getDir (int directionModeS7, int receiveMode)
 
 _fwPeriphAddressS7_setIOMode (int io, int im, string sSystemName)
 

Variables

const unsigned fwPeriphAddress_S7_LOWLEVEL = 11
 
const unsigned fwPeriphAddress_S7_SUBINDEX = 12
 
const unsigned fwPeriphAddress_S7_START = 13
 
const unsigned fwPeriphAddress_S7_INTERVAL = 14
 
const unsigned fwPeriphAddress_S7_POLL_GROUP = 15
 
const string UN_S7_FORMAT_BIT = "DBX"
 
const string UN_S7_FORMAT_BYTE = "DBB"
 
const string UN_S7_FORMAT_WORD = "DBW"
 
const string UN_S7_FORMAT_DOUBLE = "DBD"
 
const unsigned UN_S7_ADDR_MODE_INOUT_TSPP = 6
 
const unsigned UN_S7_ADDR_MODE_INOUT_POLL = 7
 
const unsigned UN_S7_ADDR_MODE_INOUT_SQ = 8
 
const string S7_PLC_INT_DPTYPE_CONN = "_S7_Conn"
 
const int fwPeriphAddress_S7_TYPE_MIN = 700
 
const int fwPeriphAddress_S7_TYPE_UNDEFINED = 700
 
const int fwPeriphAddress_S7_TYPE_INT16 = 701
 
const int fwPeriphAddress_S7_TYPE_INT32 = 702
 
const int fwPeriphAddress_S7_TYPE_UINT16 = 703
 
const int fwPeriphAddress_S7_TYPE_BYTE = 704
 
const int fwPeriphAddress_S7_TYPE_FLOAT = 705
 
const int fwPeriphAddress_S7_TYPE_BIT = 706
 
const int fwPeriphAddress_S7_TYPE_STRING = 707
 
const int fwPeriphAddress_S7_TYPE_UINT32 = 708
 
const int fwPeriphAddress_S7_TYPE_DATETIME = 709
 
const int fwPeriphAddress_S7_TYPE_BLOB = 710
 
const int fwPeriphAddress_S7_TYPE_MAX = 710
 
const int EXC_S7ADDR_WRONG_NUM_PARAM =1
 
const int EXC_S7ADDR_WRONG_ADDRTYPE =2
 
const int EXC_S7ADDR_WRONG_DRIVER_NUMBER =3
 
const int EXC_S7ADDR_WRONG_DATA_TYPE =4
 
const int EXC_S7ADDR_WRONG_MODE =5
 
const int EXC_S7ADDR_WRONG_INTERVAL =6
 
const int EXC_S7ADDR_WRONG_ACTIVE =7
 
const int EXC_S7ADDR_WRONG_LOWLEVEL =8
 
const int EXC_S7ADDR_EMPTY =10
 
const int EXC_S7ADDR_TOO_MANY_COLONS =11
 
const int EXC_S7ADDR_BAD_NUM_OF_GROUPS =12
 
const int EXC_S7ADDR_BAD_DATALEN =13
 
const int EXC_S7ADDR_DBX_BADZBIT =21
 
const int EXC_S7ADDR_DBX_BADDBXY =22
 
const int EXC_S7ADDR_DBX_BADYNUMBER =23
 
const int EXC_S7ADDR_DBX_BADDBX =24
 
const int EXC_S7ADDR_DBX_BADXNUMBER =25
 
const int EXC_S7ADDR_DBX_BADTZNUMBER =26
 
const int EXC_S7ADDR_DBX_FNOTALLOWED =27
 
const int EXC_S7PARSEINT =99
 

Detailed Description

This library contains function associated with S7 addressing. Functions are provided to set, get and delete the addressing for a dpe

Creation Date
24/04/2005
Modification History

09/07/2014 Marco Boccioli

09/07/2014 Marco Boccioli

01/08/2014 Marco Boccioli

12/11/2012 Marco Boccioli

12/11/2012 Marco Boccioli

  • FWCORE-3101 : Modified line on fwPeriphAddressS7_set() : if(strlen(pollGroup) && strpos(pollGroup,"</em>")!=0) pollGroup = "_"+pollGroup;

13/09/2011 Marco Boccioli

  • #49981: Poll groups for S7 driver: inconsistency in poll group name. On fwPeriphAddressS7_set(), the leading "</em>" is now added automatically if not specified.

Constraints
None
Usage
Public
PVSS managers
VISION, CTRL
Author
Enrique BLANCO (AB-CO)

Function Documentation

_fwPeriphAddressS7_set ( string  dpe,
dyn_anytype  addressConfig,
dyn_string &  exceptionInfo,
bool  setWait = true 
)
Set the S7 addressing

Note: This function should not be called directly. Call the fwPeriphAddress_set instead.

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Parameters
dpeinput, data point element to configure
addressConfiginput, object containing address configuration details
exceptionInfooutput, details of any exceptions are returned here
int fwPeriphAddressS7_parseInt ( string  parsedString,
int  errCode = EXC_S7PARSEINT,
int  startPos = 0,
int  length = 0 
)
private void fwPeriphAddress_parseS7Address_DBx ( string  addr)

Parse the DBx part of the address, throwing exceptions as necessary

private void fwPeriphAddress_parseS7Address_main ( string  addr)

Allowed patterns {T,Z}y {DBx.DBX , M , E , I , A , Q}y[.z] {DBx.DB, M , E , I , A , Q}{B,W,D}y {DBx.DB, M}DyF

Note that "DB*y" are supposed to be already truncated to "B*y" and bit-included "Qy.z" are converted to "Q#y.z" (actually "Q#y"), and "DBXy.z" into "X#y.z" (actually "X#y"). similarly Ty and Zy were changed to T::y and Z::y

In short: the "addr" will always have two letters: either padded with "#" on 2nd char, or DBX truncated to BX

private errClass throwS7Exception ( int  errCode,
string  errTxt = "" 
)
fwPeriphAddress_checkS7Parameters ( dyn_string  dsParameters,
dyn_string &  exceptionInfo 
)
Check if data is Ok to set a S7 address

The address is generally a dot-separated string, with:

  • the first item: the name of the S7 Connections as configured in WinCC OA
  • the second item: the identification of the data block (DBx)
  • the third item: the starting address of the data inside the data block, plus some typing information
  • optionally, the fourth: the bit number inside a byte variable In addition, there may be a colon plus a number, telling the length of the (blob) variable. Note that in the PLC-world, the addressing would be the tokens 2,3 (and eventually 4).

There may also be the symbolic addressing. Again, the first item (before the dot) is the connection name, while the second has some specific formatting.

It may also be a timer or a counter, in which name there are again only 2 items.

Alarm addresses ("TestS7.:1:2:3") are not supported.

Here are a couple of examples:

MyS7Connection.DB498.DBB512:200 - data block 498, start at byte 512, take a blob, and extract 200 bytes; the connection is defined as "MyS7Connection" inside WinCC OA

MyS7Connection.DB1.DBX30.3 - data block 1, start at byte 30, take bit 3 in "MyS7Connection"

MyS7Connection.T5 - timer 5

MyS7Connection.Z3 - counter 3

Constraints
None
Usage
Public
PVSS managers
VISION, CTRL
Parameters
dsParametersparameters used to set the _address config (see constants definition)
exceptionInfofor any error. If a parameter is incorrect, exceptionInfo is not empty !
_fwPeriphAddressS7_get ( string  dpe,
dyn_anytype &  addressConfig,
bool &  isActive,
dyn_string &  exceptionInfo 
)
Get the S7 addressing

Note: This function should not be called directly. Call the fwPeriphAddress_get instead.

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Parameters
dpeinput, data point element to read
addressConfigoutput, object containing address configuration details
isActiveoutput, TRUE is addressing is active, else FALSE
exceptionInfooutput, details of any exceptions are returned here
_fwPeriphAddressS7_delete ( string  dpe,
dyn_string &  exceptionInfo 
)
Delete the S7 addressing

Note: This function should not be called directly. Call the fwPeriphAddress_delete instead.

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Parameters
dpeinput, data point element to configure
exceptionInfooutput, details of any exceptions are returned here
_fwPeriphAddressS7_initPanel ( string  dpe,
dyn_string &  exceptionInfo 
)
Initialise the graphics of the address panel symbol.

Note: This function should only be called from fwPeriphAddres.pnl.

Constraints
None
Usage
Internal
PVSS managers
VISION
Parameters
dpeinput, data point element to configure
exceptionInfooutput, details of any exceptions are returned here
string _fwPeriphAddressS7_setValuesFromRef ( string  reference,
string  sSystemName 
)
Set S7 panel values

Note: This function fills the panel fields in funciton of the REFERENCE selected by the user in several fields of the fwPeriphAddressS7.pnl

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Parameters
referenceinput, user introduced reference
sSystemNameinput, system name
Returns
output, encoded S7 address
int _fwPeriphAddressS7_getTransfo ( )
Recuperate transformation type

Note: This function recuperates the selected trasnforamtion type selected by the user in several fields of the fwPeriphAddressS7.pnl

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Returns
output, transformation type: i.e.: "701 --> int 16"
string _fwPeriphAddressS7_encodeAddress ( )
Encode the S7 address

Note: This function encodes the S7 address introduced by the user in several fields of the fwPeriphAddressS7.pnl

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Returns
correct address S7 type. i.e.: "DB100.DBX200.1"
int _fwPeriphAddressS7_getDir ( int  directionModeS7,
int  receiveMode 
)
Get the S7 IO mode

Note: This function gets the IO mode from the user selection in the _fwPeriphAddressS7.pnl. new constants are defined to the In/out modes

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Parameters
directionModeS7input, direction mode (Output, Input, Input/Output)
receiveModeinput, type mode (TSPP, Polling, Single Query)
_fwPeriphAddressS7_setIOMode ( int  io,
int  im,
string  sSystemName 
)
Set the S7 IO mode

Note: This function sets the IO mode from the user selection. There is the case "1" which is also used to set up the INPUT mode when user introduce an PLC peripherial INPUT from the address field.

Constraints
None
Usage
Internal
PVSS managers
VISION, CTRL
Parameters
ioinput, direction mode (Output, Input, Input/Output)
iminput, type mode (TSPP, Polling, Single Query)
sSystemNameinput, system name

!!pollgroup

Variable Documentation

const unsigned fwPeriphAddress_S7_LOWLEVEL = 11
const unsigned fwPeriphAddress_S7_SUBINDEX = 12
const unsigned fwPeriphAddress_S7_START = 13
const unsigned fwPeriphAddress_S7_INTERVAL = 14
const unsigned fwPeriphAddress_S7_POLL_GROUP = 15
const string UN_S7_FORMAT_BIT = "DBX"
const string UN_S7_FORMAT_BYTE = "DBB"
const string UN_S7_FORMAT_WORD = "DBW"
const string UN_S7_FORMAT_DOUBLE = "DBD"
const unsigned UN_S7_ADDR_MODE_INOUT_TSPP = 6
const unsigned UN_S7_ADDR_MODE_INOUT_POLL = 7
const unsigned UN_S7_ADDR_MODE_INOUT_SQ = 8
const string S7_PLC_INT_DPTYPE_CONN = "_S7_Conn"
const int fwPeriphAddress_S7_TYPE_MIN = 700
const int fwPeriphAddress_S7_TYPE_UNDEFINED = 700
const int fwPeriphAddress_S7_TYPE_INT16 = 701
const int fwPeriphAddress_S7_TYPE_INT32 = 702
const int fwPeriphAddress_S7_TYPE_UINT16 = 703
const int fwPeriphAddress_S7_TYPE_BYTE = 704
const int fwPeriphAddress_S7_TYPE_FLOAT = 705
const int fwPeriphAddress_S7_TYPE_BIT = 706
const int fwPeriphAddress_S7_TYPE_STRING = 707
const int fwPeriphAddress_S7_TYPE_UINT32 = 708
const int fwPeriphAddress_S7_TYPE_DATETIME = 709
const int fwPeriphAddress_S7_TYPE_BLOB = 710
const int fwPeriphAddress_S7_TYPE_MAX = 710
const int EXC_S7ADDR_WRONG_NUM_PARAM =1
const int EXC_S7ADDR_WRONG_ADDRTYPE =2
const int EXC_S7ADDR_WRONG_DRIVER_NUMBER =3
const int EXC_S7ADDR_WRONG_DATA_TYPE =4
const int EXC_S7ADDR_WRONG_MODE =5
const int EXC_S7ADDR_WRONG_INTERVAL =6
const int EXC_S7ADDR_WRONG_ACTIVE =7
const int EXC_S7ADDR_WRONG_LOWLEVEL =8
const int EXC_S7ADDR_EMPTY =10
const int EXC_S7ADDR_TOO_MANY_COLONS =11
const int EXC_S7ADDR_BAD_NUM_OF_GROUPS =12
const int EXC_S7ADDR_BAD_DATALEN =13
const int EXC_S7ADDR_DBX_BADZBIT =21
const int EXC_S7ADDR_DBX_BADDBXY =22
const int EXC_S7ADDR_DBX_BADYNUMBER =23
const int EXC_S7ADDR_DBX_BADDBX =24
const int EXC_S7ADDR_DBX_BADXNUMBER =25
const int EXC_S7ADDR_DBX_BADTZNUMBER =26
const int EXC_S7ADDR_DBX_FNOTALLOWED =27
const int EXC_S7PARSEINT =99