.. _external_sequence_control-index: ######################### External Sequence Control ######################### .. warning:: Draft - ongoing implementation. When enabled, allows the applicator sequences to be controlled from an external system, either by :ref:`JSON-RPC `, :ref:`Digital I/O`, or :ref:`modbus-index`. A normal use case for |esc| is for e.g. pallet labeling where the print job only contains the labels (pages) needed for that product. The labels are to be ordered in the expected apply sequence. Using |esc|, the printing and applying is controlled entirely by an external system. .. _external_sequence-setup-guide: =========== Setup Guide =========== * Print and Apply -> Labels Per Product -> External Sequence Control. Click the slider to enable. .. figure:: /media/external_sequence_control/External_sequence_control_Enable.png * Select number of preconfigured sequences This is done through the Labels Per Product setting E.g. 2 sequences .. figure:: /media/external_sequence_control/External_sequence_control_Labels_sequences.png * Setup which side each sequence represents. .. figure:: /media/external_sequence_control/External_sequence_control_Sequence_side.png * Select if a scanner is to be used. The scanner must first be setup and enabled from the Peripherals menu. .. figure:: /media/external_sequence_control/External_sequence_control_Scanner.png * On the applicator page, setup the apply position for each sequence / side. .. figure:: /media/external_sequence_control/External_sequence_control_Applicator_side.png * If Protocol Emulation data (e.g. ZPL) used, disable Force Unlimited Product Count. .. figure:: /media/external_sequence_control/External_sequence_control_ZPL_disable_unlimited_product_count.png ========= Print Job ========= The active print job is used until it expires (see `product_count `_) or the jobs queue is cleared (see `jobs.clear `_). Recommendation is to disable Force Unlimited Product Count if Protocol Emulation data (e.g. ZPL) is used. New print jobs received, within the printing sequence, will be added as extra pages to the job currently active. On multi-page print jobs the next page is rendered immediately after the printing the current page. This means that the next page must be available to the printer before the current page is printed. .. comment: Multiple jobs It is possible to define different labels by creating multiple jobs using legacy protocols like e.g. ZPL. Note, that when |esc| is enabled, subsequent jobs sent for the same product is evaluated with a frozen variable set, i.e. the same time and counter values will be used for all labels in the same product sequence. This is to ensure that the same information is printed on all sides of the same product. .. _external_sequence-json_rpc: ====================== Control using JSON-RPC ====================== `JSON-RPC `_ gives full control over the external sequence control. Print The active label can be printed with the `sequence.print `_ command. Apply A printed label can be applied using JSON-RPC with the `sequence.apply `_ command. The parameter specifies the product face. Finish Sequence The sequence can be finished using JSON-RPC with the `sequence.finish `_ command. Sending sequence.finish tells the printer that the current products is fully processed and at the same time puts the printer in a state to receive data for the next product. .. _external_sequence-digital_io: ========================= Control using Digital I/O ========================= When `External Sequence Control` is activated, the digital inputs are automatically assigned to the following functions: .. csv-table:: :header: Input, Function :widths: 20, 60 TRIG1, Level activated print trigger. TRIG2, Level activated apply trigger. IN2 and IN1, Selects `Label Sequence` or `Finish Sequence` command. `IN2` and `IN1` encodes the binary value of the apply positions and the `Finish Sequence` command according to this table: Optionally, `IN3` and `IN4` can be used instead of `TRIG1` and `TRIG2` on printers using CPU3 hardware. This document uses `TRIG1` and `TRIG2` in its examples, but the functionality is equivalent if `IN3` and `IN4` are substituted for `TRIG1` and `TRIG2`. .. csv-table:: :header: IN2, IN1, Function :widths: 10, 10, 20 0, 0, Finish Sequence 0, 1, Apply Position 1 1, 0, Apply Position 2 1, 1, Apply Position 3 Print Activating `TRIG1` prints an active job immediately or a pending print job using best effort. Example: *Trigger printing of an active job on TRIG1* .. wavedrom:: { signal: [ { name: "Print Job", wave: "x.=.....", data: ["Active Job"] }, { name: "TRIG1", wave: "0...1...", node: "....A..." }, {}, { name: "Printer", wave: "=....=..", node: ".....B..", data: ["Idle", "Printing"] }, ], edge: [ 'A->B Print on positive transition of TRIG1' ] } | Example: *Trigger printing by sending job when TRIG1 is active* .. wavedrom:: { signal: [ { name: "Print Job", wave: "x...=...", data: ["Active Job"], node: "....A...", }, { name: "TRIG1", wave: "0.1.....", }, {}, { name: "Printer", wave: "=....=..", node: ".....B..", data: ["Idle", "Printing"], }, ], edge: [ 'A->B Print on Job being activated' ] } Apply Trigger applying on a product face by: 1. Selecting the associated label sequence using `IN2` and `IN1`. 2. Activate `TRIG2`. Example: *Trigger Apply Position 2 when printing is finished* .. wavedrom:: { signal: [ { name: "IN1", wave: "x..0....", node: "....C...", }, { name: "IN2", wave: "x..1....", node: "....E...", }, { name: "TRIG2", wave: "0...1...", node: "....A...", }, { name: "Printer", wave: "=..=....", data: ["Printing", "Idle"], }, {}, { name: "Applicator", wave: "=....=..", node: ".....B..", data: ["Idle", "Applying"], }, ], edge: [ 'C-D-A Apply position 2', 'A->B Apply on TRIG2' ] } | Example: *Trigger Apply Position 3 as soon as printing is finished* .. wavedrom:: { signal: [ { name: "IN1", wave: "x1......", node: "..C.....", }, { name: "IN2", wave: "x1......", node: "..D.....", }, { name: "TRIG2", wave: "0.1.....", node: "..E.....", }, { name: "Printer", wave: "=..=....", data: ["Printing", "Idle"], node: "...A....", }, {}, { name: "Applicator", wave: "=...=...", node: "....B...", data: ["Idle", "Applying"], }, ], edge: [ 'C-D-E Apply position 3', 'A->B Apply when printer is ready' ] } Finish Sequence Trigger end of sequence by setting `IN2` and `IN1` both to inactive, and then activate `TRIG2`. This tells the system that the complete product sequence is finished. Example: .. wavedrom:: { signal: [ { name: "IN1", wave: "x.0.....", node: "..'C....", }, { name: "IN2", wave: "x.0.....", node: "..'D....", }, { name: "TRIG2", wave: "0..1....", node: "...E....", }, ], edge: [ 'C-D-E Finish Sequence', 'A->B Apply when printer is ready' ] } | ======================== Control Using Modbus TCP ======================== See :ref:`modbus-index`