Skip to main content

Darra Profinet Slave

Darra Profinet Slave · Python SDK

把 Windows 主机作为 PROFINET IO 从站设备使用,受主站系统(如西门子 PLC)控制:RT Class 1 实时周期,DCP 设备发现 / 命名 / 地址分配,过程数据 IO,报警与诊断(含 I&M),GSDML 导入 TIA V15+;SDK 以服务模式使用。

Use a Windows host as a PROFINET IO device under a master (e.g. a Siemens PLC) — RT Class 1, DCP, process-data IO, alarms and diagnostics (I&M), GSDML for TIA V15+. The SDK is used in service mode.


能力 · Capabilities

  • 从站设备 — Windows 主机作为 PROFINET IO Device,受 PLC 等主站控制
  • 实时周期 — RT Class 1
  • 发现与组态 — DCP 发现 / 命名 / 地址;GSDML 导入 TIA V15+
  • 过程数据 — 写 Q、读 I;报警、诊断、I&M
  • 0 拷贝 — 过程映像映射成结构体,供高性能直接读写(读可并发;写请调用方串行化)

开始 · Get started

  1. 先安装官方安装包:下载页 · https://download.darra.xyz/profinet/client/Darra-Profinet-Setup.exe
  2. 本包是 Python SDK:
pip install darra-profinet-slave
  1. 新人:基础知识 · 从 SDK 继续 · Python 文档

升级 / 重装:先卸载旧版 → 重启电脑 → 再安装新版。操作前请先保存好工程和配置文件。


最佳用法 · 0 拷贝

Start 后把 I / Q 映射成结构体,之后当普通变量读写即可——读是当前周期,写下个周期发出。

import ctypes
from darra_pns import PnSService

class FromPlc(ctypes.BigEndianStructure):   # I:控制器 → 设备
    _pack_ = 1
    _fields_ = [("present", ctypes.c_uint8),
                ("recipe", ctypes.c_int16)]

class ToPlc(ctypes.BigEndianStructure):     # Q:设备 → 控制器
    _pack_ = 1
    _fields_ = [("ready", ctypes.c_uint8),
                ("busy", ctypes.c_uint8)]

svc = PnSService()                          # 构造随时可调
svc.start()                                 # 启动服务 + 建立过程数据通道

inp = svc.process_data.inputs_mapping(FromPlc)   # 映射一次(I 只读)
outp = svc.process_data.outputs_mapping(ToPlc)   # 映射一次(Q 可写)

outp.ready = 1                              # 写下的下个周期发出
present = inp.present                       # 读到的永远是当前周期

要整段一次读出用 svc.read()(一次调用取一份,同一拍自洽)。

i = svc.read()   # I 区整段字节

连本机服务 127.0.0.1:18840,启动后读 connected,再读诊断里的 iocr_active 和 rx_rt_frames。

from darra_pns import PnSService

svc = PnSService()          # 本机服务 127.0.0.1:18840
svc.start()
print(svc.connected)
diag = svc.get_diag()
print(diag.connected, diag.iocr_active, diag.rx_rt_frames)

变量表 · Variables

从运行配置 XML 解析变量名→地址映射,支持层级前缀联想:

svc.set_config_xml("config.xml")
vars = svc.variables
print(vars.count)
v = svc.get_variable("Module1.Sub1.Item1")
list = svc.suggest_variables("Module1.")

API 速查 · API Reference

属性 类型 类别 读写
connected bool 状态 只读
state PnSState 状态 只读
is_running bool 状态 只读
wait_reason str 状态 只读
error_code PnSRuntimeErrorCode 诊断 只读
error_message str 诊断 只读
process_data ProcessData 过程数据 只读
alarms list[PnSServiceAlarm] 报警 只读
alarm_count int 报警 只读
events PnSEvents 事件 只读
variables PnSVariables 变量 只读

其它语言 · Other SDKs

语言 / Language 包 / Package 来源 / Source
C darra_profinet_c-win-x64.zip 下载页
C++ darra_profinet_cpp-win-x64.zip 下载页
C# Darra.Profinet.Slave NuGet
Java xyz.darra:darra-profinet-slave Maven Central
Python darra-profinet-slave PyPI(本包 / this SDK)
Rust darra-profinet-slave crates.io

许可 · License

专有软件 · Proprietary — © Darra Technology,使用须遵守随产品提供的许可协议。

Metadata

Release files for Darra-Profinet-Slave 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for Darra-Profinet-Slave 1.5.0
File Interpreter ABI Platform
darra_profinet_slave-1.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details

Release files / darra_profinet_slave-1.5.0-cp312-cp312-win_amd64.whl

Download URL darra_profinet_slave-1.5.0-cp312-cp312-win_amd64.whl
Size 22.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
27e5077d860db68366bfc60dc746c7e361b05fe655f7577a83c8e12fa30c69ce
BLAKE2b-256 checksum
How to use checksums
60bcc3ba742a0d893f8af64b57fc6647bc9af829db73c62ad4ec04d7a4d968ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for Darra-Profinet-Slave 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page