Knowledge
homeappabout
English
English
  • Home
  • About Ardexa
    • Our Security Principles
    • What makes us different?
    • Collecting Data
    • Device Remote Control
    • Tunnel (VPN) Access
    • File Transfers
    • Machine Plugins
  • Getting Started
    • What is Ardexa?
    • Connectivity in 60 Seconds
    • The Ardexa Data Store
  • Configure the Edge Device
    • Edge and Cloud Connect
    • Edge Device Configuration
      • ArdexaLinux Operating System
      • Approved Hardware
        • Dell Industrial Computers
          • Dell PowerEdge Installation
        • Advantech Industrial Computers
          • Configuring Advantech Devices
            • UNO-2271G, UNO-2272G
            • UNO-2362G
          • Advantech ArdexaLinux Installation
          • Advantech Serial Driver
        • Siemens Industrial Computers
          • Siemens IPC 127E Installation
          • Siemens IOT2050 ArdexaLinux Installation
        • Raspberry Pi
          • Install the Raspbian Image
          • USB On-The-Go (OTG) support
          • Raspberry Pi 4 EEPROM update
          • Display hardware version of Raspberry Pi
        • Virtual machines
      • Internet Connection
        • Connecting
        • Complex Network Management
      • Networking
        • Network Configuration Using Ardexa Cloud
        • Config Static IP - Manually
        • Add static route
        • Add secondary IP
        • Access via SSH
        • Update password
        • Test Network Access
        • Reconnecting Offline Device
        • Cisco VPN Access
        • USB Tethering
      • Using a local Network Time server (NTP)
      • Serial Communications
        • Testing the serial ports
      • Antivirus
      • Time Zone
    • Connecting to Plant Equipment
      • TCP (Ethernet)
        • Standard Industrial Protocols
        • OPC Protocols
        • Database Protocols
        • PLC Protocols
        • Miscellaneous
      • Serial (RS-485, RS-422, RS-232)
        • Standard Industrial Protocols
        • Proprietary Protocols
      • Others (Bluetooth, etc.)
    • Ardexa Agent
      • Installation (ARM64 or X86/AMD64)
      • Installation Raspberry Pi
      • Install (opkg)
      • Install on Docker
      • Check it's working
      • Increase system limits
      • Data types and formats
        • Decimal
        • CSV file format
      • Scenarios
        • Run
        • How does the UNIX_SOCKET scenario work?
      • Dynamic Configuration
      • Manual Configuration
      • Replacing a Device with a New One
      • Replacing a Device with an Existing One
      • Uninstall
    • Ardexa Machine Plugins
      • Safety & Risk Notice
      • Modbus
        • Modbus Server
        • Modbus Python Plugin
        • Modbus Plugin
      • Programmable Logic Controllers (PLCs)
        • Access to OPC DA Data
        • Installing the OpenOPC utility
        • Mitsubishi PLC Plugin
        • Siemens S7 PLC Plugin
        • Omron PLC Plugin
        • README
      • OPC Plugins
        • OPCUA Plugin
      • Solar Inverter Plugins
        • Satcon Inverters
        • Sungrow Inverters
          • Sungrow SG Grid Scale Inverters
          • Sungrow SG1000MX Inverters
          • Sungrow SG String Inverters
        • Delta Inverters
        • Connecting to Huawei
        • Huawei Logger
        • Huawei Logger
        • ABB Inverters
          • Configuring ABB Inverters
          • ABB Aurora Inverters
          • ABB PowerOne Modbus Inverters
          • ABB Pro 33 Inverters
          • ABB PVS 800 Inverters
          • ABB Trio Inverters
        • SolarEdge Inverters
        • Sunspec Inverters
        • SMA Inverters
          • Connecting SMA Inverters
          • SMA Central Inverters
          • SMA Cluster Controllers
          • SMA "YASDI" Inverters
          • SMA Sunny Tripower (non Sunspec)
          • SMA Power Plant Controllers
          • SMA Central 1850-2750 Inverters
          • SMA Sunny Webbox
        • Kostal Inverters
          • Connecting via Kostal Proprietary Protocol
          • Kostal Proprietary Plugin
          • Kostal Modbus (non Sunspec) Plugin
        • Kaco Inverters
          • Configuring Kaco Inverters
          • Kaco Inverter Plugin
        • SolarMax Inverters
          • Configuring SolarMax Inverters
          • SolarMax Inverter Plugin
        • Refusol Inverters
        • JEMA IFX Inverters
        • Ginglong Solis Inverters
        • Growatt TL3 Inverters
        • HEC Freesun Inverters
        • Next Tracker Plugin
        • Ingecon 100TL Inverters
        • Tristart MPPT Charger
        • Zenergy PID Boxes
        • Eaton Inverters
        • SolarCheck Strings
        • Soltec Trackers
        • GE Inverters
        • TMEIC Solar Ware Ninja Inverters
        • Power Electronics Inverters
        • Ingeteam Inverters
        • Delta Logger
        • FTC Trackers
        • Trina Trackers
        • Solivia Inverters
        • Dunext Inverters
      • Data Logger Plugins
        • Connecting SolarLog
        • SolarLog Logger
        • MaxWeb Logger
        • Gantner Logger
        • MeteoControl Logger
        • Bluelog Logger
        • Kaco proLOG
        • Sinapsi Logger
        • Skylog Logger
        • SMA Sunny Webbox Logger
      • Electricity Meter Plugins
        • Janitza Meters
        • Cube Meters
        • ECS Meters
        • Gavazzi Meters
          • Gavazzi EM24 Meters
          • Gavazzi WM Meters
        • KBR Meters
        • Plus ES Meters
        • RPI Current Transformers
        • Schweitzer Meters
        • Schweitzer Protection Relays
        • Schneider Electric Meters
          • Schneider ION Meters
          • Schneider Sepam Meters
        • Fanox Relay
        • Elspec Meters
        • Landis Gyr Meter
      • Wind Turbines
        • Wind Park Networks
        • Vestas Wind Turbines
          • Vestas ODBC
          • Vestas OPCUA
        • Clavis XML Server
        • Gamesa Wind Turbines
          • Gamesa ODBC Wind Turbines Plugin
          • Gamesa Windnet OPCUA
          • Gamesa Wind Turbines via Config Files
        • Nordex Wind Turbines
          • Nordex OPCXML Wind Turbines Plugin
          • Nordex Plugin ODBC with Config Files
          • Nordex Plugin OPCXML with Config Files
        • Enercon Wind Turbines
          • Enercon Wind Turbines Plugin
          • Enercon Wind Turbines Plugin with Config Files
        • GE ODBC Wind Turbines
        • Senvion Wind Turbines
          • Senvion Wind Turbines Plugin
          • Senvion Plugin with Config Files
        • Siemens Wind Turbines
          • Siemens Wind Turbines
          • Siemens Wind Turbines with Config Files
      • Weather Stations
        • Kipp and Zonen
        • IMT Si-RS485 Sensors
        • Webdom
        • Lufft Weather Stations
        • Campbell Weather Stations
        • DustIQ Soiling Sensors
        • Geonica Weather Stations
        • Groundwork Zenith Meteorological Stations
        • Hukseflux Pyranometers
      • Solar Powered Computers
      • Energy Storage
        • BYD ESS C648
        • BYD ESS
        • NetMan 204
        • Narada Batteries
      • IEC
        • IEC 61850
        • IEC 60870
      • Management Plugins
        • RESI Real Time Clock Plugin
        • Logrotate Plugin
        • Interface Manager Plugin
          • Automatic Modem Connection
          • Manual Modem Connection
          • Troubleshooting Modem Usage
        • Black Box Plugin
        • Log Rotation and Deleting Old Logs
        • Antivirus
        • Backfill
      • Computer Vision
        • Photo Capture Plugin
      • Testing Plugins
        • Dynamic Test
        • JSON Test
        • Ping Test
        • Schema Test
        • Serial Test
        • Solar Demo Plugin
        • Vestas Demo Plugin
        • Service Load Test
        • Resource Usage
        • Edge Statistics
      • Control
        • Ardexa Control Plugin
    • Variable Naming Guide
    • Communications Hardware
      • USB to WIFI Converter
      • Teltonika RUT950 router
      • Huawei E8372 (3G) Modems
      • Modems
  • Ardexa Cloud
    • Ardexa Account
      • Multi-factor Authentication
      • User profile
      • Browsers
      • Navigation
    • Ardexa Remote
      • Install Ardexa Remote
      • Using the Tunnel
      • Using the VPN
      • Troubleshooting
    • Data Access
      • KPIs
      • Users and Permissions
      • Device Groups
      • Limit user access to a subset of devices
      • Limit Access to Searches
      • API Tokens
      • Device access to the API
      • Images
      • Power BI
    • Analysis
      • View Types
      • Charts
      • Formulae
      • Device Logs
    • Searches
      • Creating Searches
      • Sharing Searches
      • CSV Downloads
      • Scheduled Search
      • Search Admin
      • Search Visualisations
      • Search Statistics
      • Search Analysis
      • Audit Logs
      • Other Resources
    • Devices
      • Edge and Cloud Devices
      • Device Summary
      • Device Bulk Actions
      • General Info
      • Remote Shell
      • File Transfer
      • Machine Plugins
      • Manual Configuration
      • Live Feed
      • Network (Edge Devices)
      • Network (Cloud Devices)
      • Discovery
        • Modbus
      • Commands
      • Tunnel (Ardexa Remote)
        • Install ArdexaRemote command line interface (CLI)
      • NAT Gateway
    • Entities
      • What is an entity
      • Create new entity
      • View entities
      • Managing entities
      • Recommendations
    • Standard UI components
    • Dashboards
      • Creating and Editing
      • Card types
        • 📈Chart Card
        • Button Stack
        • Active Incidents
        • Camera Control
        • Command Template
        • Cylinder
        • Energy Summary
        • Energy Tally
        • Gauge
        • Heat Map
        • Indicator light
        • Indicator light table
        • Inverter performance
        • KPI Chart
        • KPI Value
        • Latest Values
        • Link Stack
        • Live Calculation
        • Map
        • Metadata
        • Photo
        • Radial Histogram
        • Remote Web
        • Satellite Image
        • Scatter Plot
        • Single Value
        • Switch Toggle
        • Dynamic Text
        • Static Text
        • Value Table
        • Pie Chart
      • Lookup Table Integration
      • Timeframe and Timezone
    • Alerts
      • Incident Logs
    • Administration
      • Security Services
      • Metadata
      • Workgroup Settings
      • Labelling
      • Moving a Device Across Workgroups
      • External Sources
      • Lookup Table
      • Access Control
    • Energy Solutions
      • Energy Reports
        • Configuring the Daily Energy process
        • Configuring Meter Data
        • Configuring Performance Ratio
          • Irradiation Extract
    • Control
      • Schedules
    • Photos
  • FAQ
    • Difference between "Datetime", "event_time" and "store_time"
    • How can I manually upgrade the agent?
    • What ports does the agent require?
    • Can the agent subscribe to data streams from other agents?
  • Troubleshooting
    • ardpkg error: TypeError: 'NoneType' object is not subscriptable
    • Offline device (Ardexa agent is offline)
      • Remote checks
      • On-site checks
    • Agent continually restarts
    • Workgroup Invitations
    • Slack Invitation
    • Advantech Computer will not connect to the Internet
    • Edge Computer is not fully serviceable
    • The agent won't connect
    • My agent is online, but there is no data in the cloud
    • Agent upgrade failed: Unknown error
    • Device Config Update every log interval
    • Other Agent related issue
    • Running the agent in Debug Mode
    • Agent Maintenance on SysV
    • Connecting a device securely to a network segment that does not have Internet access
    • EXPECT_ERROR: Decimal conversion failed
    • Docker Interface Conflict
    • Failed to fetch...IP Not Found
  • Ardexa API
    • API
      • API Quick Start Guide
      • Python examples
      • Automated API Token Renewal
      • General
        • Issue API token
        • Examine API Token
        • WebSockets
      • Consumer
      • Security
      • Devices
        • Websocket
      • Search
        • API Search Functions
        • Search scrolling
        • Timeframe
        • Consuming data via the API
      • Energy
Powered by GitBook
On this page

Was this helpful?

Last updated 2 years ago

Was this helpful?

Purpose

This is a plugin to read data from a Siemens S7 PLC.

Usage

You run a log to send data to the cloud, or a discover to only display information. There must be a config file when running log or a discover. The config file defines which variables need to be collected, what names they appear on the the Ardexa cloud, units and scaling, what table(s) they variables will be sent to, and the source name(s). Example config file as follows. Always verify data accuracy by running a discover first, before committing the plugin to collect data.

NOTES:

  • Anything that starts with # is a comment line, and will be ignored

  • The Memory Area is sometimes referred to as the "block". Valid values can be things like OB, DB, SDB, FC, SFC, FB, SFB. However, they can also be customised implementations.

  • In Block Number, this is an integer value, usually in the range [0...127]. Check with the PLC project manager.

  • Memory Address MUST be formatted as follows:

    • Boolean values: eg; MX13.1. The value M is ignored, but the X denotes a bit wise mapping. 13 is the memory location, and .1 is bit 1.

    • Integer values: eg; MW2. The value M is ignored, but the W denotes a WORD (2 byte) entry, or b denotes a byte. 2 is the memory location, in this case.

    • Real (decimal) values: eg; freal334. The value freal is used to denote a real (4 bytes value). 334 is the memory location, in this case.

    • DWORD: The use of dd (where the second letter is a d indicates a double word. In these cases, the result may be interpreted as a floating point number or an integer. - To interpret the result as a floating point number, use the --use_float_dword argument discussed below. Otherwise the result will be treated as an integer.

  • Scale will only be used for decimal and integer types. An error will be reported if you try and divide an integer, or multiply by anything other than a whole number. The scale can also be a value such as 0.75-9, where the -9 is a BIAS value (addition or subtraction). In which case it will FIRST subtract the 9, THEN multiply by 0.75. If using a bias value, then it can ONLY be used with a decimal type.

  • Invalidate. This column will only do the following task": If an entry starts with >, it will invalidate ALL entries in a configuration file, if the value for this entry is greater than the specified amount. For example; if the Invalidate column entry is >10000, then a value of 12,000 will ensure ALL readings in the configuration file are invalidated. Use this item with caution. Also, it will ONLY work on dec values. This invalidation feature is intended for those machines that have poor quality control, and sometimes transmit wildly wrong values.

  • in Lookup Table; Sometimes you want to convert an INT to a keyword, through a lookup table. Or you may want to get a register bit and convert it to a keyword, or the string length. See examples below.

  • Allowable Type column values are as follows:

    • dec ... Converts the S7 location to a decimal. Can be scaled (including division).

    • int ... Converts the S7 location to an integer. Can only be scaled upwards (not divided). So a scale value that is not a whole number will be rejected. See also the explanation for scale above, since it can include a bias and scale factor.

    • bool ... S7 location is converted to an INT. This value is then check as follows: Anything other than 0 will output a True. Else, output will be False.

    • int_bool ... S7 location is converted to an INT. This value is then check as follows: Anything other than 0 will output a 1. Else, output will be 0.

    • bin ... Converts the S7 location to an integer, then to a binary representation.

    • bit ... Used with a lookup table (in the Lookup Table column) to define a bit being turned or off. See example contents of file below. Bits start at "1" (not "0"), and are defined in the Lookup Table column.

    • bitb ... If a bit in the S7 location is turned on/off, it will reflect a boolean ("True"/"False") output.

    • bitb_int ... If a bit in the S7 location is turned on/off, it will reflect a boolean ("1"/"0") output.

    • str ... Treated as an ASCII character. If it can't be converted, it will output an empty field

    • str_rep ... Same as str, but it will clear \0 values in the resultant string.

    • str_raw ... Treated as raw characters without ANY conversion. Note the INTEGER in the example above specifies the LENGTH of the string to the PLC

Arguments

  • ip_address This is the IP Address of the S7 PLC. Make sure that Port 102 is open.

  • config_path. This is the config file location

  • --attempts Is the number of attempts to make to get data from the PLC. The default=2

  • --rack and --slot values are both integers. They default to rack=0 and slot=1. The Rack (0..7) and Slot (1..31) can be found in the hardware configuration of the project. There is however some special cases for which those values ​​are fixed or can work with a defaults, as shown:

  • --use_float_dword Use this flag to treat a DWORD as a floating point number. Otherwise it will be treated as an integer.

Write Arguments

This plugin can be used to write to an S7 PLC. Only a single value can be written at any one time. A log record is written anytime a memory location is written. This log record is written to the S7_write table, and is available in SEARCHES on the Ardexa front end. The command is s7_ardexa set_command {arguments}. The arguments for the write capability include, in order:

  • The IP address if the IP Address of the S7 PLC

  • The area (eg; DB)

  • The block (eg; 99)

  • The memory address (eg; MW916)

  • The --rack and --slot values are both optional integers. See the above Read Arguments

For example: s7_ardexa set_command 192.168.1.2 db 2 MW876 1193

Example of "bit" lookup

Bit starts at 1. Include a 0 value to display something (or blank) if no bits are turned on

Example of "str" lookup file

Numbers can be anything, since they are read from a single modbus (16 bit) register

    # Table,    Source Name,    Variable Name,      Memory Area,   Block Number,   Memory Address,  Type,       Units,  Scale,  Invalidate,    Lookup Table/Num Bytes
    solar,      hec,            AC Voltage 1,       DB,             1,             MW23,            dec,        V,      1+10,     , 
    solar,      hec,            Grid Freq,          DB,             1,             freal9,          dec,        Hz,     0.01,     , 
    solar,      hec,            Cos Phi,            DB,             1,             freal7,          dec,        .,      100,      , 
    solar,      hec,            PT100 Temperature,  DB,             1,             freal6,          dec,        C,      1,        , 
    solar,      hec,            Total Hours,        DB,             3,             freal3,          dec,        h,      0.1,      , 
    solar,      hec,            Total Hours 4,      DB,             3,             dd45,            dec,        h,      0.1,      , 
    solar,      hec,            DC Current 1,       DB,             3,             freal5,          dec,        A,      1,        , 
    solar,      hec,            HDG Setpoint Mode,  DB,             6,             MX0.0,           bitb,       bool,   1,        ,             1
    solar,      hec,            Run Auto,           DB,             6,             MX0.1,           bitb,       bool,   1,        ,             2
    solar,      hec,            Run Manual,         DB,             6,             MX0.2,           bitb_int,   bool,   1,        ,             3
    solar,      hec,            Key Switch,         DB,             6,             EW33,            str,        ,       1,        ,             mode.dict
    solar,      hec,            Key Switch2,        DB,             9,             EW34,            str_rep,    ,       1,        ,             mode.dict
    solar,      hec,            Program Name,       DB,             9,             DW3467,          dec,        ,       1,        ,             20
    solar,      pid_box,        PV- Voltage,        DB,             9,             EW35,            int,        V,      1,        , 
    solar,      pid_box,        PV- Current,        DB,             9,             EW63,            int,        mA,     1,        ,
    solar,      alarm,          Alarm 0 Keyword,    DB,             9,             MX6.3,           bit,        ,       1,        ,             container_alarm0.dict
    solar,      alarm,          Alarm 1 Keyword,    DB,             9,             MX7.4,           bit,        ,       1,        ,             container_alarm1.dict
    solar,      alarm,          Alarm 2 Keyword,    DB,             9,             MX8.5,           bit,        ,       1,        ,             container_alarm2.dict
    solar,      alarm,          Alarm 3 Keyword,    DB,             9,             MX9.6,           bit,        ,       1,        ,             container_alarm3.dict
    solar,      alarm,          Alarm 1,            DB,             9,             MX1.0,           bool,       ,       1,        ,
    solar,      alarm,          Alarm 2,            DB,             9,             MX2.0,           bool,       ,       1,        , 
    solar,      alarm,          Alarm 3,            DB,             9,             MX3.0,           bool,       ,       1,        ,
    solar,      alarm,          Alarm 4,            DB,             9,             MX4.0,           int_bool,   ,       1,        ,
    solar,      hec,            Total Current,      DB,             10,            MW888,           dec,        h,      0.1,    >100000,
    solar,      status,         Binary Status Raw,  DB,             10,            MX0.1,           bin,        ,       1,        ,
    S7 TYPE     RACK        SLOT        Comments
    ========================================================================
    S7 300 CPU  0           2           Always
    S7 400 CPU  ....Not fixed...        Follow the hardware configuration.
    Win AC CPU  ....Not fixed...        Follow the hardware configuration.
    S7 1200 CPU 0           0           Or 0, 1
    S7 1500 CPU 0           0           Or 0, 1
    WinAC IE    0           0           Or follow Hardware configuration.
0 : 
1 : leakage sensor#1
2 : AC surge protection device
3 : key-operated switch
4 : scram button
5 : switcher signal from UC PCB Control Board
6 : leakage sensor#2
7 : leakage sensor#4
8 : leakage sensor#3
9 : signal 8 abnormal 
10 : energy-saving contractor KM1 return signal
11 : bad leakage sensor #2
12 : bad leakage sensor #1
13 : bad leakage sensor #4
14 : bad leakage sensor #2
15 : signal 4 abnormal
16 : signal 4 abnormal
-1 : 
51 : Closed
267 : Inverter
276 : Instantaneous value
295 : MPP
303 : Off
308 : On
309 : Operation
311 : Open
336 : Contact the manufacturer
337 : Contact the installer
338 : Invalid
381 : Stop
455 : Warning
569 : Activated
1041 : Leading
  1. Configure the Edge Device
  2. Ardexa Machine Plugins
  3. Programmable Logic Controllers (PLCs)

Siemens S7 PLC Plugin

PreviousMitsubishi PLC PluginNextOmron PLC Plugin
  • Purpose
  • Usage
  • Arguments
  • Write Arguments
  • Example of "bit" lookup
  • Example of "str" lookup file