Skip to content

PROFINET IO device (experimental)

With type: profinet-device, nautilus appears on a PROFINET network as an IO device. A PLC (an S7-1500 in TIA Portal, for example) configures it from a GSDML file like any other station, connects, and exchanges cyclic data with it. Data flows both ways:

  • The PLC’s outputs arrive as nautilus input tags.
  • nautilus output tags are the PLC’s inputs.
profinet_device.yaml
interface: eth1 # the NIC on the PROFINET network
station: nautilus-1 # NameOfStation the PLC looks for
vendor-id: 0x.... # what the GSDML and DCP say this device is
device-id: 0x....
min-cycle: 8ms # the shortest cycle offered (MinDeviceInterval)
slots:
- slot: 1
module-ident: 0x00000101
subslots:
- {subslot: 1, submodule-ident: 0x00000001, inputs: 8, outputs: 4}
tags:
- {name: Bin1_Level, slot: 1, subslot: 1, dir: input, offset: 0, format: float32}
- {name: Bin1_Fill, slot: 1, subslot: 1, dir: output, offset: 0, bit: 0, format: bool}

Directions are the PLC’s, because that is how the GSDML and the engineering tool show them:

  • inputs: and dir: input are data nautilus provides;
  • outputs: and dir: output are data the PLC commands.

Formats are bool (with bit: 0–7), int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32 and float64, all big-endian as PROFINET is. naut check rejects a tag that overlaps another or does not fit its subslot. The limits are 24 subslots and 244 bytes each way.

nautilus.yaml
driver:
type: profinet-device
manifest: profinet_device.yaml
tag-files: [tags/profinet.yaml]
Terminal window
naut profinet tags profinet_device.yaml # tags/profinet.yaml, IEC types, the PLC's outputs as inputs
naut profinet gsdml profinet_device.yaml # GSDML-V2.35-…xml for the engineering tool

Import the GSDML into the engineering tool (TIA Portal: Options → Manage general station description files) and add the station. The GSDML and the driver come from the same manifest, so the PLC is configured with exactly the layout the driver serves. If they differ anyway, because the manifest changed and the GSDML was not re-imported, the device answers the connection with a module difference. The status row then says which modules differ, and their data is marked invalid both ways.

Update time. The GSDML offers RT_CLASS_1 at a 1 ms send clock with reduction ratios 1, 2, 4 … 512, so the update times an engineering tool can set are 1, 2, 4 … 512 ms, and never below min-cycle. When nautilus configures a Siemens CPU itself (a profinet-manifest: device in the CPU’s station, target: siemens), it also keeps to 16 ms or more, so the allowed times are 16, 32, 64, 128, 256 and 512 ms. Any other time is refused at deploy. With no update time set, the deploy picks the first of those at or above min-cycle (min-cycle: 20ms gives 32 ms) and writes it explicitly, so TIA never picks a faster one.

PROFINET runs on raw Ethernet, so the process needs CAP_NET_RAW:

Terminal window
sudo setcap cap_net_raw+ep "$(command -v naut)"
# or, under systemd: AmbientCapabilities=CAP_NET_RAW

Without it the project still loads, checks and runs. The driver’s status row says what is missing and the driver keeps retrying.

The connection setup (DCE/RPC) uses UDP 34964 on the host’s IP stack, so the interface needs an address on the PROFINET subnet. The port is opened only on the station’s own address, once the PLC has assigned it. It is never open on all of the host’s networks, and replies always come from the address the PLC talks to.

nautilus never changes the host’s network settings. A PLC assigns its devices’ IP addresses over DCP, and DCP has no authentication.

  • An address assignment is accepted only when it names an address the interface already holds. Give the device that address in the PLC’s project.
  • Any other assignment is refused, and the status row shows the refusal with the addresses the interface has.
  • A station name the PLC assigns is used until restart and never saved. The manifest stays the source of truth.

profinet_device__Online (or <driver name>__Online) is true while a PLC holds an AR and its frames arrive.

The input tags (the PLC’s outputs) carry quality:

QualityWhen
NotConnectedUntil the first good value. The tag reads its init:, as for every communications driver.
GoodThe PLC is in run and its status for the subslot is good.
BadThe PLC is in STOP, its status for the subslot is bad, or the module differs from the layout.
StaleThe connection ended: the PLC stopped sending, released it, or the cable is out.

The last good value is held through Bad and Stale. When the connection ends, the input tags go Stale with their last good value and profinet_device__Online goes false. They read Good again only once a new connection delivers fresh data.

The data nautilus provides is marked invalid to the PLC (IOPS bad) in three cases:

  • until the program has written every output tag once;
  • while the write gate is closed, for example when scans hang;
  • after the gate reopens, until every output has been written again.

The PLC sees invalid data rather than zeros or a frozen value, and handles it as it would a faulty module.

naut check still refuses PROFINET together with redundancy:. On takeover the new leader must already hold the station’s address, and redundancy: cannot name and check that floating address yet. What follows is how it will behave once it can.

Under redundancy:, only the leader is a PROFINET device. Every frame it sends first checks that its lease is still current, so a leader that was frozen past its lease sends nothing when it resumes. A standby holds no socket on the interface. It answers no DCP and sends no LLDP, so two replicas never answer for one station name. Its input tags read Stale and keep their last value, and its status row says standby.

On takeover:

  1. The old leader goes silent, and the PLC’s connection to it times out.
  2. The PLC looks for the station name again and finds it at the new leader’s MAC address.
  3. The PLC connects, and the data turns valid with the new leader’s first full push.

The PLC also assigns the station’s IP address again. nautilus accepts that only when the new leader’s interface already holds the address (see above), and two hosts cannot hold one address on one network at once. So for now, have the station’s address move with the leader (a floating address managed outside nautilus). Hand-over against a real PLC, including how long the PLC takes to reconnect, has not been measured yet.

  • Run with redundancy:: refused until the floating station address can be named and checked (see above); the hand-over is not measured yet.
  • Be a PROFINET controller that drives devices. That comes next.
  • IRT, MRP, system redundancy, PROFIsafe, more than one AR, alarms raised to the PLC, strings or arrays.
  • Cycle times under 8 ms until measured on the target.

The design brief is docs/design/profinet.md.

nautilus is free and open source (Apache 2.0), built by Joy Automation. For implementation or support on your site, see Joy Automation services. Privacy.