SIEMENS S7/SINUMERIK Plugin
The Siemens S7 and SINUMERIK Plugin are used to read data from S7 PLCs (S7 300, S7 400, S7 1200, S7 1500) and SIEMENS SINUMERIK 840D controls.
Configuration location:
These configs are only used for the Edge instance Luna.Console, executed directly from the [Edge Main Folder]. Click the "Service Application" tab above to check the location for Edge services.
Use the default DataMappings.xml for most use cases.
SiemensPlcSettings.xml
The SiemensPlcSettings.xml defines which data to read.
Example configuration
Setting
Description
AGLinkConfigFilePath
File path to the PLC connection definition file (see the section below)
DeviceNr
device number which refers to the corresponding PLC connection definition file. 0 for most use cases.
PLCNr/NCKPLCNr
SF Edge requires two separate connections to the PLC and the NCK part of the PLC. The settings should be the same as defined in the PLC connection definition file; 1 for PLCNr and 0 for NCKPLCNr for most use cases
RackNr
Rack number of the controller
PLCSlotNr
Slot number of the PLC controller
NCKSlotNr
Slot number of the NCK controller (only required if connecting to a SINUMERIK
Reading data blocks by their Item name
Datablocks in SIEMENS controllers (PLC and NCK) are uniquely identified by it's item name (eg. DB100.DBD4 for PLCs and /Nck/Configuration/chanAssignment[1] to access OPC conform datablocks of a SINUMERIK control)
Refer to lines 22 to 54 in the above example configuration.
You may add as many NCDDEDataBlock-elements as required. Each NCDDEDataBlock may contain as many NCDDEData elements as required. All NCDDEData elements inside an NCDDEDataBlock are sampled at the same time. Place NCDDEData elements that need different sampling intervals in different NCDDEDataBlocks!
Configuration options for each NCDDEDataBlock:
Setting
Description
PollingIntervalMilliseconds
Defines the polling interval for all data points in this NCDDEDataBlock.
OnlySendChanges
If set to true, data points that did not change compared to the previous polling cycle are thrown away. The rate of change is defined with DeltaToIgnore of each NCDDEData element.
Configuration options for each NCDDEData element inside an NCDDEDataBlock:
Setting
Description
ItemName
Name of the item to read. Eg. DB100.DBD4 or /Nck/Configuration/chanAssignment[1]
IsReal
Defaults to false; If set to true and the data point to read is of type DWORD, this data point is interpreted as REAL (a floating-point number). Is ignored for other types than DWORD
DeltaToIgnore
Sets the threshold a variable has to change to be considered as "changed". Use in combination with OnlySendChanges (see above)
RelativeDeltaToIgnorePercent
Sets the relative threshold a variable has to change to be considered as "changed". A variable is ONLY marked as "changed", when this threshold as well as the DeltaToIgnore threshold are exceeded.
Example: The current value is 5, DeltaToIgnore is 1 and RelativeDeltaToIgnorePercent is 10 (=10%). This means, the value needs to change for AT LEAST more than 1 (as DeltaToIgnore is higher than RelativeDeltaToIgnorePercent). If, for example, the current value is 50, then it needs to change more than 5, as the RelativeDeltaToIgnorePercent is higher. This combination of both features allows to set a minimum absolut value for change detection and use the relative value beyond this minimum change. This provides best resource utilization.
Use in combination with OnlySendChanges (see above)
Filter: Comparer
Relational operator to use for the condition (valid: Greater, Less, GreaterOrEqual, LessOrEqual, Equal, NotEqual)
Filter: Value
Filter value to compare the data with. If the filter value combined with filter comparer evaluates to false, the read data for this specific data point are thrown away
MathOperations
Applies all the defined mathematical operations to the variable in the given order.
MathOperations: Operation
Defines the mathematical operations which should be applied to the variable.
Valid operations for numerical variables are: Add, Subtract, Multiply, Divide, Power
Valid operations for boolean variables are: Invert
Operations that are defined for a variable it is not valid for (e.g. Add for a boolean variable) are ignored.
MathOperations: Value
All mathematical operations also require a Value that is used as an operand. This can be a decimal number.
Consider that Filters are always applied after the MathOperations! Otherwise, this could lead to results you are not expecting.
Applying MathOperations to variables of any integer datatype can cause them to be a decimal number. But this is no problem because when inserting the data in our database the value will be converted to an integer or long (depending on the definition of the attribute in the event schema, see Event Schema Management).
Using absolute address as ItemName
If you are using absolute addresses as ItemNames (like XXX) in the NCDDEDataBlock definitions. The name has to adhere to the following schema:
DBn.DBYz.i
n ... Address of the data block
Y ... Data type of the variable
z ... Start address/index of the variable within this data block
i ... Index of bit (only used for BOOL and BIT)
The notation of all possible data types are summarized in the following table:
Data type
Absolute address
Example
Description
BOOL, BIT
DBn.DBXx.y
DB13.DBX2.0
The first bit of byte 2 in data block address 13
BYTE, CHAR, SINT, USINT
DBn.DBBy
DB123.DBB1
data byte 1 in data block 123
WORD, INT, UINT
DBn.DBWy
DB42.DBW6
data word 6 in data block 42
DWORD, DINT, UDINT, REAL, TIME
DBn.DBDy
DB25.DBD2
data double word 2 in data block 25
Reading blocks by their memory location definition
Alternatively to reading data by its name, it is possible to use the exact memory location definition of a data point for reading specification.
It is recommended to use the reading by item name for most use cases.
Refer to the comments in the above sample configuration (lines 69 to 143) for how to configure blocks by their memory location.
Reading PLC alarms
PLC alarms are read by defining a PLCAlarmBlocks definition (line 145 to 154).
Start times of alarms are created at the PLC, Stop times are created by SF Edge as soon as a previously active alarm is terminated.
Only one PLCAlarmBlock for each PLCAlarmType must be inside the PLCAlarmBlocks definition.
Setting
Configuration
PollingIntervalMilliseconds
Interval in milliseconds defining how often to check for changes in alarms.
PLCAlarmType
Type of Alarm to read from PLC. Valid values: Symb, SFC or SFB.
Each type needs to be wrapped in an individual PLCAlarmBlock.
Reading NCK alarms
NCK alarms are read by defining an NCKAlarmBlock definition (lines 156 to 162).
Start times of alarms are created at the NCK, Stop times are created by SF Edge as soon as a previously active alarm is terminated.
Setting
Configuration
PollingIntervalMilliseconds
Interval in milliseconds defining how often to check for changes in alarms.
ExtendedInfo
Define if additional "Alarm Filltext" information should also be sent. For each available FillText, a datapoint with key InfoValueX is created - with X being a number from 1 to 15.
Connection State
This plugin automatically creates a "Connection_State" message, when the state of the connection to the PLC changes. The following message is created, when the connection to the PLC is established:
The following messages is created, when the connection to the PLC is dropped (eg. due to the PLC restarting, or due to networking issues)
You might use the data point "Connection_State" in your "EventDefinition.xml" for mapping this state message to our outgoing message stream. For example, to rename the data point to "my_state" and send it to the MQTT-Plugin, add the following line to your "Datas" section in your EventDefinition.xml
Last updated