Assembly Station
TIA Device Name = Configuration Tool Site Name (e.g., asm-st-01).
Hardware Specifications
- PLC: Siemens S7-1200 × 1 (fixture clamping / release / NG rejection)
- Industrial PC:Windows 10 × 1 + Intel i5 × 1, running Darra Profinet Slave
- Vision: Industrial area-scan camera × 1 + lens × 1 + ring light × 1
- Clamping Fixture: Air cylinder × 1, magnetic switch for clamping position × 1. PLC controls clamping, releasing, passing,NG and rejecting.
- Network: Standard Gigabit network card × 1 (on the same PROFINET network as the PLC)
Cost Analysis
| Category | Model/Specifications | Reference Unit Price (¥) | Quantity | Subtotal (¥) |
|---|---|---|---|---|
| PLC | Siemens S7-1200 CPU 1214C | 1,000 | 1 | 1,000 |
| Industrial Computer | i5 Fanless Dual Ethernet Ports | 1,200 | 1 | 1,200 |
| Area-scan camera | Hikvision MV-CA013 130 Wan USB3 | 950 | 1 | 950 |
| Lens | C-Mount Industrial Fixed-Focus Lens | 200 | 1 | 200 |
| Ring Light | Machine Vision LED | 150 | 1 | 150 |
| Pneumatic Fixtures | Yadek Magnetic Cylinder + Magnetic Switch | 120 | 1 | 120 |
| Total Reference for the Entire Line | ≈ ¥3,620 |
Common transaction prices on Taobao (2026-09), excluding racks, air tubes, cables, and fixture base plates. For PLCs, use the typical price range for genuine 1214C models; for cameras, use the store price for the Hikvision 130 Wan USB3—do not include board-level products priced at just a few dozen yuan.
Performance Metrics
- Alignment Check: Completed locally; process data returns only "OK" / NG / "Completed"
- Formula: For the "Structure" field, select "Recipe" as the local template; multiple sets can be assigned to a workstation.
- Takt time: Visual count less than 150 ms/piece (simulation uses "sleep" as a substitute)
- Figure: Offset Details Are Not Included in Process Data
Use Cases
Assembly station before press-fitting, tightening, or dispensing. Compared with Small-Scale Visual Quality Inspection it adds three paths: clamped-in-place, done edge, and multi-recipe templates. The PLC handles clamping, release, and NG rejection; the industrial PC aligns locally by recipe.
Workstation Sequence
- Part present — the PLC sets
Present. - Trigger only when clamped — the PLC clamps and waits for the magnetic switch
Clamped. Do not pullTriggerbefore clamping. The industrial PC side does the same: discard any rising edge withoutClamped. - Alignment rising edge — after
Clamped, the PLC pullsTriggerhigh. The industrial PC only recognizes 0→1, and only whenPresentandClampedare set and it is not busy. - Busy mutual exclusion — once the edge is recognized, clear the previous OK/NG/
Done, then setReady=0andBusy=1. New edges during busy are dropped. - Recipe selects a local template —
Recipeis only a template number; the alignment bitmap and offsets stay on the industrial PC. - Done edge — judgement ends:
OkorNg,Busy=0,Ready=1, andDone0→1. The PLC steps on the risingDoneedge (OK release / NG reject / unclamp).Doneis held until the next piece's edge is recognized and pulled back to 0, and the next piece's finish produces a new rising edge. - Disconnect — once connected and later disconnected:
Fault=1andReadyis taken away. After reconnecting, ready is set again; the currentTriggerlevel is not treated as a new edge.
Process data returns only "OK" / NG / "Complete" and the recipe number. Bitmaps, offset details, and archive paths remain on the industrial PC.
Process Data
| Direction | Field | Definition of a Workstation |
|---|---|---|
| From PLC (I) | Present | Part present |
| From PLC (I) | Clamped | Clamp is fully engaged; the trigger will not be recognized if it is not fully engaged. |
| From PLC (I) | Trigger | Positive-edge triggering; recognizes only the rising edge |
| From PLC (I) | Recipe | Formula Number, Select the Correct Local Template |
| Send to PLC (Q) | Ready | I can take the next one. |
| Send to PLC (Q) | Busy | Aligning positions, mutually exclusive |
| Send to PLC (Q) | Ok | Alignment Passed → PLC Approved |
| Send to PLC (Q) | Ng | Mismatch → PLC rejects the item |
| Send to PLC (Q) | Fault | Disconnection/Outage |
| Send to PLC (Q) | Done | This decision is complete; the PLC detects the rising edge. |
Once connected, do the reading and writing with the handshake described above. The simulation fakes OK/NG by part count (1 NG every 7 parts). On real hardware, replace Thread.Sleep with image capture and alignment.
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Darra.PnS;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct FromPlc
{
public bool Present;
public bool Clamped;
public bool Trigger;
public short Recipe;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ToPlc
{
public bool Ready;
public bool Busy;
public bool Ok;
public bool Ng;
public bool Fault;
public bool Done;
}
using (var device = new DarraPnS())
{
PnSErrorCode rc = device.Start();
if (rc != PnSErrorCode.Success)
return;
string[] templates = { "default.bin", "housing-a.bin", "housing-b.bin" };
ToPlc output = default;
bool lastTrigger = true;
bool wasConnected = false;
bool busy = false;
int piece = 0;
bool running = true;
while (running)
{
if (!device.Connected)
{
if (wasConnected)
{
output = new ToPlc { Fault = true };
device.ProcessData.Write(ref output);
lastTrigger = true;
busy = false;
}
wasConnected = false;
Thread.Sleep(20);
continue;
}
if (!wasConnected)
{
output = new ToPlc { Ready = true };
device.ProcessData.Write(ref output);
lastTrigger = true;
busy = false;
wasConnected = true;
}
FromPlc input = new FromPlc();
device.ProcessData.Read(ref input);
bool rising = input.Trigger && !lastTrigger;
lastTrigger = input.Trigger;
if (rising && input.Present && input.Clamped && !busy)
{
busy = true;
output = new ToPlc { Busy = true };
device.ProcessData.Write(ref output);
string template = templates[0];
int recipe = input.Recipe;
if (recipe >= 0 && recipe < templates.Length)
template = templates[recipe];
Thread.Sleep(120);
piece++;
bool ok = (piece % 7) != 0;
output = new ToPlc { Ready = true, Ok = ok, Ng = !ok, Done = true };
device.ProcessData.Write(ref output);
busy = false;
Console.WriteLine(
"第 " + piece + " 件 模板 " + template + " → " + (ok ? "OK 放行" : "NG 剔除") + " Done");
}
Thread.Sleep(10);
}
device.Stop();
}