Software controlled inputs

This example shows how to replace any physical input signal with a software controlled signal.

Technical background

In the Pally program we use variables to define IO channels in a generic way. The address of every IO channel is defined by a special variable, which is an array. The 0th element of the array is always the IO type (standard IO, configurable IO, tool IO, MODBUS, etc. - the complete list can be found here) and the 1st element is the actual IO channel number.

Example values:

[0, 5] means standard digital signal nr. 5

[1, 6] means configurable digital signal nr. 6

[10, 5] means standard digital signal nr. 5 with inverted logic

etc.

For this article, the following special IO types are relevant:

-11: always returns True (no real physical IO channel being accessed)

-1: always returns False (no real physical IO channel being accessed)

If you want to provide mock signals for the Pally program from another thread, set the data source of the corresponding IO channel type (element 0 of the array) to either -1 or -11 in runtime.

The name of the relevant IO channel variables

The variable names are listed below.

Remember: To change the IO type, update the 0th element of the array, i.e. always put [0] behind the variable name, e.g.:

rf_in_1_product1[0] = -1

  • rf_in_1_product1: first product sensor on the primary conveyor

  • rf_in_1_product2: second product sensor on the primary conveyor

  • rf_in_1_product3...8: additional sensors on the primary conveyor (up to 8 supported)

  • rf_in_2_product1: first product sensor on the secondary conveyor

  • rf_in_2_product2: second product sensor on the secondary conveyor

  • rf_in_2_product3...8: additional sensor on the secondary conveyor (up to 8 supported)

  • rf_in_overflow1: priority sensor on the first conveyor

  • rf_in_overflow2: priority sensor on the second conveyor

  • rf_in_button_P1: right pallet confirmation signal

  • rf_in_button_P2: left pallet confirmation signal

To simulate a constant HIGH signal, set the corresponding input type to -11.

To simulate a constant LOG signal, set the corresponding input type to -1.

The complete list of available IO types can be found here.

Examples

 

Example 1) simulate the operator has pushed the Right pallet confirmation button

rf_in_button_P1[0] = -11 # simulate user pushed the button sleep(0.5) rf_in_button_P1[0] = -1 # simulate user released the button

This will detach the program from the physical IO channel and evaluate as True and False.

 

Example 2) simulate a product on the first pick position on the primary conveyor

rf_in_1_product1[0] = -11 # simulate product presence

 

Example 3) evaluate two sensors, set pick signal to HIGH only when both are HIGH

if (get_standard_digital_in(0) and get_standard_digital_in(1)): rf_in_1_product1[0] = -11 # simulate product present else: rf_in_1_product1[0] = -1 # simulate no product present