教程

虚拟调试与PLCSIM Advanced

在触碰真实机器之前,在数字孪生上验证您的PLC逻辑和HMI接口。

T
T-IA Connect团队
阅读约12分钟
2026年3月12日更新

零风险,100%可靠

虚拟调试可以大幅减少现场错误。通过将PLCSIM Advanced与T-IA Connect结合使用,您可以模拟整个安装,测试边缘情况,并验证机器安全性,无需承担任何硬件损坏的风险。

前提条件

  • 已安装Siemens PLCSIM Advanced V4.0或更高版本
  • T-IA Connect(AI Pro或Enterprise版本)
  • 已为模拟编译的TIA Portal项目

步骤1:配置PLCSIM实例

通过API创建并启动虚拟模拟实例。您可以配置网络接口(PLCSIM Virtual Ethernet Adapter)以实现真正的TCP/IP通信。

curl — POST /api/simulation/instances
curl -X POST http://localhost:9000/api/simulation/instances \
  -H "Content-Type: application/json" \
  -d '{
    "instanceName": "Sim_Conveyor_V1",
    "cpuType": "S71500",
    "ipAddress": "192.168.0.10",
    "subnetMask": "255.255.255.0",
    "startAfterCreate": true
  }'
Response
{
  "success": true,
  "instance": {
    "name": "Sim_Conveyor_V1",
    "id": "inst_01j2k3l4",
    "status": "Running",
    "ip": "192.168.0.10",
    "cpu": "S71500",
    "port": 102
  }
}

步骤2:将程序加载到模拟器

使用API将您的TIA Portal项目直接加载到活动的PLCSIM实例中,就像对物理PLC所做的那样。

curl — POST /api/simulation/instances/load
curl -X POST http://localhost:9000/api/simulation/instances/Sim_Conveyor_V1/load \
  -H "Content-Type: application/json" \
  -d '{
    "projectPath": "C:\\Projects\\Machine_V1\\Project.ap19",
    "stationName": "PLC_Main",
    "fullDownload": true
  }'
Response
{
  "success": true,
  "loadStatus": "Completed",
  "blocksLoaded": 42,
  "hardwareConfigured": true,
  "executionMode": "RUN"
}

步骤3:运行单元测试和场景

程序加载完成后,使用API强制输入、读取输出,并以自动化方式验证您的逻辑序列。

curl — POST /api/simulation/tags/force
curl -X POST http://localhost:9000/api/simulation/tags/force \
  -H "Content-Type: application/json" \
  -d '{
    "tagName": "Sensor_Pallet_At_Stop",
    "value": true,
    "durationMs": 500
  }'
Response
{
  "success": true,
  "currentValue": true,
  "monitoredOutputs": [
    { "name": "Conveyor_Motor_Start", "value": false },
    { "name": "Conveyor_Brake_Active", "value": true }
  ],
  "testResult": "PASS"
}

虚拟调试可以在第一个电气柜接线之前识别多达80%的软件缺陷。

在现场节省数周时间

准备充分的虚拟调试是成功项目的关键。它可以保证以最小压力平稳过渡到实际生产。

准备好模拟您的项目了吗?下载T-IA Connect开始虚拟调试。