CODESYS library · Flying saw / flying shear

X FlyingShear Library

Cut on the fly, exactly to length: one function block for a carriage that syncs to line speed, cuts and returns.

In short

X FlyingShear Library (ONX FlyingShear) is ONX Control's CODESYS library for cutting continuously running pipe, profile, sheet and wire to length without stopping the line. Its core, the OnxFlyingShearFB function block, synchronizes the carriage that carries the cutter to the line encoder with an EtherCAT servo; the cut profile, length and count, limit calculations, the optimum working stroke and error handling are all in one block. The axis layer is X Motion Library.

Product brochure (PDF)
X FlyingShear: the carriage syncs to line speed, the saw cuts, the carriage returns One cut cycle: 3600 mm cut length, 1950 mm working stroke, ramp ratios 0.2. The chart shows carriage speed over line speed against line position; the return speed is about 3.1 times the line speed. Master · line → Slave · carriage Q_Kesimde Par_Kesim_State forward acceleration forward sync, Q_Kesimde forward deceleration return acceleration return at constant speed return deceleration Par_Baslangic_Offset Par_Araba_Boyu working stroke ONX encoder cut pieces → 2 · FA 3 · Forward sync · cut 4 · FD 5 · RA 6 · Ret. 7 · RD +1 0 −k carriage speed = line speed k ≈ 3.14 line position → one cut length (Par_Kesilecek_Uzunluk) carriage / line speed
One cut cycle with the manual's example recipe: 3600 mm length, 1950 mm stroke, ramp ratios 0.2. The chart and the carriage are drawn from the same calculation.
1 ms
EtherCAT cycle

Profile calculation and axis control in the bus task, every cycle.

7
segment S profile

Forward and return ramps are 5th-order polynomials: zero velocity and acceleration at segment boundaries.

One FB
axis + line + profile + diagnostics

Power, homing, jog, line encoder, cutting, limits and error handling.

Virtual
axis and line

A full cycle with the same application software, without drive or line.

Cut on the fly instead of stop-and-cut

On stop-and-cut lines the line slows down, stops and accelerates again for every cut. X FlyingShear cuts on the move: the carriage matches line speed, cuts at zero relative speed and returns in time for the next piece.

Non-stop production

Cuts without stopping the line. Cutting follows the measured line position, not time, so length holds even when line speed changes.

Length errors don't accumulate

Line travel carried over from each 1 ms cycle is passed to the next segment. Encoder filtering and length calibration included.

Knows its own limits

Maximum line speed and minimum cut length are calculated live from the recipe; the working stroke is optimised from the measured cut time.

Commission at your desk

A virtual axis and a virtual line let you test the full cycle before the machine is built.

PC-based, no motion card

No separate motion card: CODESYS runs on an industrial PC, servos and I/O share one EtherCAT network.

Clear diagnostics

Bit-coded errors and warnings, a process status text and an operator message that rotates every 2 seconds.

Applications: Flying saw on pipe / profile lines Roll-formed profiles Sheet and strip cut-to-length Wire and bar Cable trays Roof / façade panels Plastic and aluminium extrusion Retrofit of existing flying shear lines
Par_Kesim_State

Motion tied to line position, not time

The carriage makes one full cycle each time the line advances by one cut length. The profile is defined on the line position (master, mm), so it scales by itself when the line speed changes and the cut lands at the right point on the material.

Every ramp is a 5th-order polynomial: s(u) = 10u³ − 15u⁴ + 6u⁵. Velocity and acceleration are zero at segment boundaries, so mechanical shock and servo following error are minimal. In every 1 ms cycle the line travel that overshoots one segment is carried into the next, so length errors never accumulate.

Key quantities
  • H_A = Par_Araba_Boyu − Par_Baslangic_Offset
  • forward sync = H_A · (1 − 2·rİ)
  • forward total (line) = H_A · (1 + 2·rİ)
  • Lgeri = L − wait − forward total
  • k = H_A / (Lgeri · (1 − H_C)),  H_C = rG / (0,5 + rG)
CodeSegmentWhat happens
2Forward accelerationThe carriage accelerates from 0 to line speed on an S-curve. At the end the cut length is recorded, count +1.
3Forward syncCarriage at line speed, zero relative speed: the cut happens here (Q_Kesimde = TRUE).
4Forward decelerationThe carriage stops; the return is recalculated at the end.
5Return accelerationAccelerates in reverse to k times the line speed.
6Return at speedConstant return speed: k × line speed.
7Return decelerationStops at the start offset.
8WaitIf Par_BeklemeMesafe ≠ 0, waits until that much line has passed; reduces servo load on long pieces.
Limit calculator

How fast can the line run with this recipe?

On site the block calculates two limits every cycle: the carriage must return at the servo's maximum speed in time for the next piece, and the cut must fit into the sync zone. The calculation below uses the block's own formulas; change the values and the result and the profile update instantly.

Q_MaxHatHizi_m_dak
–m/min
Q_MinKesilecekUzunluk
–mm
Cuts / minute
–at this speed
Q_SenkronSuresi
–s
Return speed ratio k
–×
Servo max linear speed
–mm/s
Motor speed on return
–rpm

This is a preliminary estimate. On site the block runs the same formulas live with the filtered line speed and the measured cut time. Torque and acceleration limits for the carriage mass must be checked separately: flying shear servo motor sizing · motor sizing

Komut_ArabaBoyuHesapla · Q_OptCalismaBoyu

The block finds the optimum working stroke

With a short stroke the forward sync distance is not enough and the cut does not finish in the sync zone. With a long stroke there is not enough line travel for the return and the servo would exceed its maximum speed. The block calculates the safe range from the cut time measured with a manual cut and picks the start offset inside it; it waits for the new maximum speed and repeats, up to 16 steps, until the offset changes by less than 0.5 mm and the speed by less than 0.05 m/min.

Sync too short
Safe range
Return too slow
short strokePar_OptBolgeSecim = 0,30long stroke
1 · Measure the cut time
Cut once in manual with Komut_Manuel_Kes; the time from the cutter leaving the up position until it is back becomes Q_Kesim_Suresi.
2 · Run the calculation
Komut_ArabaBoyuHesapla starts the iteration; the block writes Par_Araba_Boyu to the mechanical maximum and Par_Baslangic_Offset to the optimum.
3 · Go to start
Since the offset changed, Komut_BaslangicPos is given; the result is read as Q_OptCalismaBoyu and the new Q_MaxHatHizi_m_dak.
v1.0.3 · online test in CODESYS

Running in CODESYS

In the sample project the block is in CFC, carriage position and speed are in Trace and the machine is on the WebVisu operator screen: process status, current and cut length, maximum line speed, minimum length, cut and sync time, carriage and plunge axis positions.

X FlyingShear v1.0.3 CODESYS online test: Trace, OnxFlyingShearFB connections and WebVisu screen
Trace on the left with carriage speed, cut segment and position; the block in the middle; the operator screen on the right. Virtual master 30 m/min, cut length 3600 mm. Licence codes hidden.
X FlyingShear sample project WebVisu operator screen
The sample project's operator screen: homing, jog, auto, length wait and saw-done modes, recipe and limits. The variable contract for a C# / web HMI is in the manual.

Block interface

The block is used with its namespace: fbShear : X_FlyingShear.OnxFlyingShearFB. The EtherCAT master, the servo slave and its connector, the licence code and persistent recipe variables are connected; the block limits and optimises stroke, offset and ramp ratios and writes them back.

Axis and mechanics

Scale from encoder, gearbox and pinion diameter; servo speed limit from the motor's maximum speed.

Axis_Encoder_Cozunurluk Axis_Reduksiyon Axis_Disli_Cap Axis_Motor_Max_RPM Axis_ArabaBoyu_Max Axis_Yon Axis_Virtual

Line measurement

32-bit line encoder or built-in virtual master; moving-average filter, a separate filter window during the cut, length calibration (0.8–1.2).

Encoder_Deger Encoder_TekerCapi Par_EncoderDuzeltme Komut_Filtre_Aktif Par_Kesimde_Filtre_Zaman Komut_Virtual Par_Virtual_Master_Speed

Recipe and profile

Cut length, stroke, ramp ratios and wait distance. Start without a crop cut and saw mode.

Par_Kesilecek_Uzunluk Par_Araba_Boyu Par_Baslangic_Offset Par_IleriRampa_Oran Par_GeriRampa_Oran Par_BeklemeMesafe Mod_Boy_Bekleme Mod_Testere_Kesti

Commands and sensors

Jog, homing, start position, auto start/stop, manual cut, reset; NC-logic home, limit, emergency and cutter-up inputs.

Komut_Home Komut_JogIleri Komut_BaslangicPos Komut_Otomatik_Start Komut_Manuel_Kes Komut_Ariza_Reset I_Home_SW I_Limit_SW I_Acil_Stop I_Makas_Yukarda

Process and limits

Cut window, line speed, last cut length, count; maximum line speed, minimum length, cut and sync time, following error.

Q_Kesimde Par_Hat_Hiz Par_Kesilen_Boy Par_Kesilen_Adet Q_MaxHatHizi_m_dak Q_MinKesilecekUzunluk Q_Kesim_Suresi Q_SenkronSuresi Q_OptCalismaBoyu Q_FollowingErrorUnit

Status, diagnostics and licence

Run and ready bits, error/warning bit masks, process text, operator message, device key and licence status.

Q_Run Q_Otomatik_Hazir Q_Otomatik_Aktif Q_Home_Done Q_ErrorID Q_WarningID Q_AkisDurum Q_Info Onx_Key_Code LicenseStatus Versiyon
runMod

Startup, manual, automatic, error

On an error the carriage stops on the stop ramp, drive power is removed, the profile is reset and enable is dropped. In automatic any warning stops the cycle; if the cutter is down in the cut window, the block waits for the cut to finish.

runMod 0
Startup

Drive powered with X_Power; error 4 if not in Operation enabled within 5 s.

runMod 1
Manual

Jog, homing, start position, manual cut and cut time measurement. Q_Otomatik_Hazir when there are no warnings.

runMod 2
Automatic

Calculate → length wait → gear-in → profile. Stopped with the same button, returns to manual via gear-out.

runMod −1
Error

Fix the cause → Komut_Ariza_Reset → enable → Startup → Manual → Home.

Error and warning codes

Q_ErrorID and Q_WarningID are bit masks; Q_Info rotates the active messages every 2 seconds and shows "Hazir" (ready) when there are none. Example: Q_WarningID = 33 → not homed and carriage not at start.

Errors · Q_ErrorID (reset required)
BitValueName and meaning
01
Error_Acil_Stop
Emergency stop pressed
12
Error_Servo_Takip_Hatasi
Following error above Par_TakipHatasiRef
24
Error_Drv_Hata
Drive fault / enable lost while running
38
Error_Araba_Enable
Carriage enable removed
416
Error_Drv_Runa_Gecmedi
Drive not in Operation enabled within 5 s
664
Error_ProfilHesap_Hatasi
Profile calculation: invalid length, stroke, ratio or offset
7128
Error_ArabaBoyuHesap_Hatasi
Optimum working stroke could not be calculated
Warnings · Q_WarningID (stop automatic)
BitValueName and meaning
01
Warning_HomeYok
Not homed
12
Warning_LimitPosAsti
Home/forward limit sensor hit in auto
38
Warning_KesimSureAsti
Cut did not finish in the sync zone
416
Warning_External
External system permission lost
532
Warning_BaslangicPosError
Carriage not at start position
664
Warning_MakasPosKontrol
Shear/saw not in start position

Commissioning in five stages

The manual's 24-step checklist is grouped into five stages; the first is done before the machine exists.

  1. A
    At the desk (virtual)

    Libraries installed, block called in the 1 ms EtherCAT task. With Axis_Virtual and Komut_Virtual the profile runs through segments 2→8 and the cut length matches the recipe; licence entered.

  2. B
    Drive and mechanics

    Slaves in OP; encoder, gearbox and pinion values entered, a measured jog distance checked with a tape measure. The line encoder's 32-bit count and the NC sensors are verified.

  3. C
    Manual motion

    Enable, jog, limits, homing and stroke. The following error limit is set to 3–5 times the value measured while jogging.

  4. D
    Cutting

    Q_Kesimde is wired to the cut command; the cut time is measured with a manual cut and the optimum working stroke is calculated.

  5. E
    Automatic

    Virtual master, then encoder without material; first cut with material, Par_EncoderDuzeltme calibration from measured lengths and stepwise speed increase.

System architecture

No motion card, one EtherCAT network

Motion control runs in the soft PLC on the industrial PC. Servo, line encoder and remote I/O sit on one EtherCAT network with Distributed Clocks on the same time base.

Operator panel · recipes, WebVisu or C#/web HMI
Industrial PC · CODESYS Control RTE
X FlyingShearX Motion
EtherCAT · Distributed Clocks · 1 ms
Servo · carriage
CiA402 CSP
Line encoder
measuring wheel, master
Remote I/O
sensors · blade · press

One source, ONX products

Requirements
  • CODESYS V3.5 (tested with SP22 Patch 3), CODESYS Control runtime, EtherCAT master
  • X Motion Library, OSCAT BASIC 3.31, IoDrvEtherCAT
  • EtherCAT CiA402 servo for the carriage; rack and pinion with gearbox
  • Line encoder with a continuous 32-bit count; home, forward limit, emergency and cutter-up inputs
Licensing

Device-bound licence, no SoftMotion needed

The library is delivered compiled. Since the carriage axis is driven by X Motion, no CODESYS SoftMotion axis licence is needed; the controller's CODESYS Control runtime licence is enough.

  1. 1The project is downloaded with an empty licence code; the device key on Onx_Key_Code is read.
  2. 2The key is sent to ONX and a device-specific BlokCode is issued.
  3. 3BlokCode is written to a persistent variable; BlokCodeAktif and LicenseStatus show the licence.
Delivery package
  • Compiled X_FlyingShear library and device licence
  • Working sample project: carriage + saw plunge axis, operator screen
  • User and commissioning manual
  • Commissioning and cut-test record sheet

The block is motion control software, not a safety function. Emergency stop, guard doors and cutting-zone protection must be provided with a safety relay / safety PLC and STO in the drive.

From the field

From our flying saw and flying shear projects

X FlyingShear brings together what ONX Control learned building flying saws and flying shears on pipe, profile and sheet lines into one block.

180
m/min line speed
±0.5
mm length tolerance
60
cuts/min

Best values reached in the field on ONX Control flying shear projects; they were not achieved together on one machine. Achievable speed, tolerance and cycle rate are largely set by the mechanics (carriage mass, stroke, drive train, measuring wheel).

Double-head flying saw
Double-head flying saw
Double-head flying shear control
Double-head flying shear control
With AI

Flying shear and cut-to-length + vision measurement

The length and cut quality of every piece can be measured by camera at the end of the line. The trend of the measured deviation is fed back to the flying shear's cut-length correction, so measuring-wheel slip or wear is caught before parts drift out of tolerance. The servo torque trace of each cut cycle shows the condition of the carriage, blade and drive mechanics for predictive maintenance.

Industrial AI and machine vision

Frequently asked questions

What is X FlyingShear Library?

A flying saw and flying shear library developed by ONX Control for CODESYS. Its core is the OnxFlyingShearFB function block: it synchronizes the cutting carriage to the running line with an EtherCAT servo and cuts the material to length without stopping the line. Axis handling, line measurement, the cut profile, length and count, limit calculations, the optimum working stroke and error handling are all in one block.

Is the same block used for saws, shears and presses?

Yes. The block gives the cut window on its Q_Kesimde output, which is wired as the cut command to a saw's plunge axis, a shear blade or a press valve. With a saw, if Mod_Testere_Kesti is on, the carriage decelerates as soon as the cut is finished and the saw is up, without waiting for the end of the stroke, so the cycle gets shorter.

Which drives and hardware does it work with?

It needs an industrial PC or PLC with the CODESYS Control runtime, an EtherCAT master and an EtherCAT CiA402 servo drive for the carriage axis; v1.0.3 was tested with an Estun ED3L. Line measurement uses a line encoder with a continuous 32-bit count. The axis layer is X Motion Library.

Can it be tested before the machine is built?

Yes. With Axis_Virtual the carriage axis runs without a drive, and with Komut_Virtual the line runs on a built-in virtual master. The full cut cycle, the Q_Kesimde window, stopping and the limit calculations are tried at the desk, so less time is spent on site.

How is the maximum line speed determined?

The block calculates two limits every cycle and outputs the smaller as Q_MaxHatHizi_m_dak: the speed at which the carriage can still return at the servo's maximum speed in time for the next piece, and the speed at which the measured cut time still fits into the sync zone. The shortest length that can be cut at the current line speed is output as Q_MinKesilecekUzunluk.

How does licensing work, is SoftMotion needed?

The library is delivered compiled and protected by X Motion's lock code mechanism: the device key on the Onx_Key_Code output is sent to ONX and a device-specific BlokCode is entered. Since the axis is driven by X Motion, no CODESYS SoftMotion axis licence is needed; a CODESYS Control runtime licence is.

Does it also provide personnel safety?

No. The block is motion control software, not a safety function. Emergency stop, guard doors and cutting-zone protection must be provided in hardware with a safety relay or safety PLC and the drive's STO; the I_Acil_Stop input is only for controlled stopping and error handling.

What is delivered?

The compiled X_FlyingShear library and device licence, a working sample project with carriage and saw plunge axes and an operator screen (WebVisu), the user and commissioning manual, and a commissioning and cut-test record sheet. Motor sizing, retrofit and on-site commissioning are available as services.

Talk to our engineers about your flying shear

For preliminary sizing and an architecture proposal, this is all we need:

Material and cross-section Line speed range Cut length range Tolerance Carriage mass · stroke Cutter type Existing control system