The FP4 configuration (configs/sim/multichannel/fp4, the simulation of the operator’s retrofit of a Deckel FP4 universal milling machine) shows how a machine whose tool changer is not made of NC axes is set up in the multi-channel system: a disc magazine with 20 fixed places driven by an asynchronous motor with cams, a hydraulic swivel arm with a slide and a single gripper, the spindle lock, a guard door, and a pole-changing spindle with a 21-stage gearbox. The same split serves any machine with a PLC-driven changer.

The split between the NC and the PLC

The machine has two channels. Channel 0 (BEARBEITUNG) owns X, Y and Z. Channel 1 (WECHSLER) has no axes of its own ([CHANNEL_1]COORDINATES = with nothing behind it, no JOINTS, [cha:multichannel-config]): it runs the changer program nc_files/wechsler.ngc, the event program of the channel (power-on and reset), as an endless loop like a cyclic PLC program. As on a SINUMERIK the NC program gives the sequence and the PLC executes every actuator with its interlocks:

  • The PLC is the set of HAL components of the machine: fp4_mag (the disc: positioning with the count and stop cams, the reference run, the hand loading door, the spindle place bookkeeping), fp4_arm (arm, slide, gripper, spindle lock, guard door, hydraulics, tool clamp: every single step cmd- checks its interlock, reports it as allow-, drives the valve and watches the end switch within a time limit; the arm turns towards the magazine, as away from it, only with the slide extended, else the gripper would sweep through the disc, so from the park position it goes over the spindle side; the arm’s valve stays on at the spindle side and at the magazine side so the arm is held there, and both are off in the park position) and fp4_spindle (contactors, gearbox, orientation with the index search, the lock request). They come from the operator’s retrofit and are unchanged; the automatic cycle built into fp4_arm is switched off (auto-enable 0) and stays as the fallback.

  • The changer program commands the single steps through motion’s digital and analog outputs ($A_OUT[n], $A_OUTA[n] - M64/M65/M68) and waits for the interlocks and the end positions on the inputs ($A_IN[n], $A_INA[n], the implicit read-ahead stop of the main-run variables, [cha:siemens-programming]). Every step is "wait for the interlock, pulse the command, wait for the end position"; a fault of the PLC or an interlock that stays unfulfilled ends the loop with a message, the reset event starts the program again (it acknowledges the PLC’s faults and retracts).

  • After a reset or at power-on the program retracts (FREIFAHREN). It first reconciles the booking with the PLC’s sensors, as a SINUMERIK TCS_HOME does: a reset between a gripper motion and its booking leaves the tool file one step behind, so the PLC’s "tool in the gripper" together with the arm position decides whether the gripper took the spindle tool or the tool of the place at the transfer position, or whether its tool went into the spindle or its place; the bookings are corrected, then a tool in the gripper goes back to its owner place (or into the empty spindle), the arm parks, the clamp closes, the lock and the orientation end and the door closes.

  • The bookkeeping of the tools is the tool management of channel 0 ([cha:multichannel-config], magazines and buffer places): the disc is [TOOLMAG_0] with KIND = CHAIN, PLACES = 20, FIXED = 1 and no AXIS (POSM only books the place at the transfer position, the move is the PLC’s), the buffer [TOOLBUFFER_0] has the spindle (9998/1) and the gripper (9998/2); the program books with MVTOOL and TCI.

The program is written with the Siemens language of the interpreter ([cha:siemens-programming]): DEF, IF, WHILE, R parameters, and REPEAT <start> <end> as the call of a helper section (STELL: one actuator step with the command number and the end position in R10..R12; MAG: the disc to a place; PARKEN, WZ_ENTNEHMEN, WZ_ABLEGEN, WZ_HOLEN, WZ_EINSETZEN, ABSCHLUSS). The table of the signals is at the head of wechsler.ngc and in the README of the configuration.

The machine zero and the change position

After homing every axis moves 10 mm off its switch into the travel and stands at 0 there (HOME_OFFSET X -10, Y +10, Z +10 - the position of the index in the new frame - and HOME = 0; the limits X -10 .. 550, Y -490 .. 10, Z -424 .. 10). The tool change position is X 250 Y 0 Z 0 ([EMCIO]TOOL_CHANGE_POSITION, with G49 before M6 so the spindle nose is there whatever the tool). Three PLC cams ([PLCCAM_n], [cha:multichannel-config]) report the head there; their AND is input 2 of the changer program, which checks it before any motion of the arm. While the arm is away from its park position or a tool is in the gripper, the joints of the machining channel are held by their feed enable (not by K12: the lock and slide sensors may read a wrong state before the first move, which must not keep the axes from jogging).

The operating pages (Bedienbilder)

fp4_screens.json ([DISPLAY]USER_SCREENS, [cha:mchmi]) gives mchmi the three pages of the machine’s hand operation, each with the states of its PLC and the keys of its single functions:

  • WECHSLER: the state, fault and wait reason of the arm, its positions, the lamps of the sensors; the keys arm back / mid / front, slide back / front, gripper in / out, orient the spindle and end it, lock and unlock, release and clamp the tool, door open / close, hydraulics on / off - every key enabled by the matching allow-* pin of fp4_arm (the interlock) and lit by the position reached; softkeys abort, acknowledge, and the test mode (a level key with confirmation).

  • MAGAZIN: the place at the transfer position, the target, the spindle place, state, fault and wait reason, the motor and door lamps; the inputs target place and spindle place with the softkeys reference run, go to the place, set the spindle place, acknowledge.

  • SPINDEL: state, fault, the gear stage found by the switches, the target and wanted stage, the nominal speed, the step of the orientation, the positions of the three blocks; the input of the target stage, the softkeys shift, oscillate (test), orient and end it, stop, acknowledge, the test mode with its mask, and the key "brake released while held".

The keys of the page and the commands of the changer program reach the PLC through or2 components (fp4.hal), the place numbers of the page through a mux2 selected by the key that uses them, so that the program and the operator share the same single-step interface of the PLC (fp4_postgui.hal nets mchmi.u.*).

The simulated hardware

fp4_hwsim stands in for the machine behind the three PLC components in the sim: from their valve and contactor outputs it returns the sensors (the cams of the disc, the end switches of arm, slide and gripper, the lock switches S216/S217, the index mark S218, the pressure, the tool release, the gear block switches S36..S44) with travel times, and exports the continuous positions (disc angle, arm angle, slide, gripper lift, spindle angle) for the 3D model. The real machine wires the same pins to the Mesa cards instead (the configuration configs/fp4).

The 3D model

fp4_model.py is the vismach model of the machine for mchmi’s 3D column ([DISPLAY]MACHINE_MODEL), with the geometry of the operator’s FP4-HMI: the base and column, the console (knee) that carries the table up and down (Z), the table (X) with its T-slots, the ram with the vertical head (Y), the disc magazine with the tools of the tool file standing in their places, the swivel arm with the telescopic slide, the gripper and the tool it carries (buffer place 9998/2), the guard door. The three axes come from the joints; the disc angle, the arm angle, the slide and gripper travel and the door come from HAL pins named in the module’s HAL_PINS ([cha:mchmi]) - in the sim the pins of fp4_hwsim, on the machine the same-named pins of its animation. The machine zero and the placeholders of the HMI (the tip touches the table centre at X 270, Y -240, Z -424) give the offsets of the model.

The machine configuration

configs/fp4 runs the machine itself (Mesa 5i25 with 7i77, 7i66 and 7i70, the xhc-whb04b-6 pendant). The folder is self-contained - it is copied as a whole to ~/linuxcnc/configs - and carries copies of what it shares with the simulation, so that the two stay one: fp4_plc.hal (the PLC components and their coupling to the changer program, the cams, the interlock of the axes, mcwatch), fp4_postgui.hal, the changer program nc_files/wechsler.ngc, the model fp4_model.py and the screens fp4_screens.json. The simulation is the master: sync-from-sim.sh refreshes the copies, the test tests/multichannel/fp4 fails when they differ. Its own files are fp4_machine.hal (the axes with their PID loops, encoders and index, the estop chain), whb.hal (the pendant) and fp4_hw_mesa.hal: the valves, contactors and sensors of the PLC on the Mesa cards, the pendant keys of the brake and the clamp, and the animation of the 3D model - fp4_hwsim integrates the PLC’s valves on the machine too and is pulled to the sensed positions through its sync-* pins whenever nothing moves; the simulation’s fp4_hw_sim.hal is what the machine replaces.

Files

File Content

fp4.inc

machine data: channels, axes, joints, cams, tool management, mcwatch

fp4_sim.ini

mchmi (the simulation; the machine’s INI is configs/fp4/fp4.ini)

fp4_sim.hal, fp4_plc.hal, fp4_hw_sim.hal

motmod with two channels and fp4_hwsim; the PLC components and the NC <→ PLC signals (shared with the machine); the PLC’s valves and sensors to fp4_hwsim

fp4_screens.json, fp4_postgui.hal

the user screens and their pins to the PLC

fp4_model.py

the vismach model

configs/fp4/

the machine: fp4.ini, fp4_machine.hal, whb.hal, fp4_hw_mesa.hal

nc_files/wechsler.ngc

the changer program (retract, reference, prepare, change)

nc_files/demo.ngc

a face milling pass and a pocket with two tool changes

fp4.tools

the tools of the machine (T1 face mill 63, T2 end mill 8, T3 ball mill 6)

tests/multichannel/fp4

the test: power-on, two changes, a change interrupted by a reset