Skip to content

Detailed Description

Binary I/Os

Functional Description

The SQ1-TRACK has two groups of 4 binary I/Os each. Each group is galvanically isolated from the other group and from the system ground.

All binary I/Os are handled via the same function block instance, the channels are accessed by channel number 0..7.

Channel Modes

Each binary I/O channel can be used as input or output-with-readback.

The mode of each channel can be configured to one of the following:

  • High Active Input (Default)
  • Low Active Input
  • High Active Output (Load to V-)
  • Low Active Output (Load to V+)

In case the channel is configured as an output, the actual pin state can be read back. See Reading Inputs and Channel Diagnostics below.

Output Characteristics

When configured as output, each channel can switch a load to ground (high active output) or to supply (low active output). The voltage must be supplied externally to the corresponding group connector via V+ and V- pins.

The I/Os support the full EN50155 voltage range of 24 V to 110 V, plus the tolerances specified in EN50155.

Each output can switch 0.5 A max.

Output Watchdog

By default, the outputs keep their commanded state forever, even if the host program has terminated or crashed.

To ensure that outputs are turned off in such cases, the firmware implements a watchdog functionality. The watchdog timeout (in milliseconds) can be set individually for each channel.

Example: When watchdog has been enabled and the timeout is set to 2000, the host must periodically re-set the switch to the opposite value of the "initial value" within 2 seconds. If it fails to do so, the firmware turns off the output (i.e. sets it back to "initial value").

Overload Handling

The outputs are overcurrent protected. In case an overcurrent condition is detected on one output, the output is turned off. The firmware attempts after some milliseconds to turn on the output again, because the overcurrent may come from a capacitive load or from a temporary short circuit.

If the overcurrent condition remains longer than a configurable timeout, the output enters overload error state.

In the overload error state

  • The output can’t be set; input value can still be read.
  • The channel LED lights up red

Application may clear the error state by trying to set the output again to the active state. If this succeeds, the overload error state is cleared.

Input Hysteresis

For inputs, a hysteresis is applied. The switching levels depend on the supply voltage of the corresponding group:

  • High Active channels: The default input state is inactive. If the pin level raises above 75 % * V+, it becomes active. If the pin level drops below 25 % * V+, it becomes inactive.
  • Low Active channels: The default input state is inactive. If the pin level drops below 25 % * V+, it becomes active. If the pin level raises above 75 % * V+, it becomes inactive.

Input Fritting

The current drawn by the input circuitry is low (500kOhm Input Impedance). To avoid contact corrosion, it is advisable to draw a higher current from time to time. Therefore, the product supports an optional fritting current of 1.1 mA.

It is only applied to channels configured as input. For low active inputs, the fritting current is drawn to V+, for high active inputs, the fritting current is drawn to V-.

LED function:

The channel LED states reflect the read-back pin state (except for overload error state):

  • Off: group supply voltage is missing
  • Yellow: pin state is inactive
  • Green: pin state is active
  • Red: channel is in error state

Use Cases

How to Connect the Load

Load may be connected to ground (high side switch) or to supply (low side switch).

Use Outputs

Using Inputs

In case you want to use a pin as input, you can

  • monitor a switch to that is connected to supply
  • monitor a voltage source, referenced to ground

Use Inputs

Using the io4edge API to access the Binary I/O Function

First, install the io4edge client library.

Want to have a quick look to the examples? See our Github repository.

First, install the io4edge client library.

Want to have a quick look to the examples? See our Github repository.

Connect to the Binary I/O Function

To access the Binary I/O function, create a Client and save it to the variable c. Pass as address either a service address or an IP address with port. Example:. Example:

  • As a service address: SQ1-geo_addr04-binio
  • As an IP/Port: e.g. 192.168.201.1:10000

We need this client variable for all further access methods.

import (
    "flag"
    "fmt"
    "os"
    "time"

    "log"

    binio "github.com/ci4rail/io4edge-client-go/v2/pkg/protobufcom/functionblockclients/binaryiotyped"
    biniopb "github.com/ci4rail/io4edge_api/binaryIoTypeD/go/binaryIoTypeD/v1"
)

func main() {
    const timeout = 0 // use default timeout

    c, err := binio.NewClientFromUniversalAddress("SQ1-geo_addr04-binio", timeout)
    if err != nil {
        log.Fatalf("Failed to create client: %v\n", err)
    }

To access the binary I/Os, create a Client and save it to the variable binio_client. Pass as address either a service address or an IP address with port. Examples:

  • As a service address: SQ1-geo_addr04-binio
  • As an IP/Port: 192.168.201.1:10000

We need this client variable for all further access methods.

import io4edge_client.binaryiotyped as binio

def main():
    binio_client = binio.Client("SQ1-geo_addr04-binio")
    ...

Configuring Channels

To configure a one or more channels, provide a "channel configuration" array to the UploadConfiguration method. Each entry in the array defines the configuration for one channel.

The following settings can be configured:

  • channel mode: input or output, high or low active
  • For output channels:
    • initial value for outputs: active or inactive. This is also the value after a watchdog timeout.
    • overload recovery timeout for outputs: How long the firmware tries to turn on an output again after an overload before entering overload error state
    • watchdog timeout for outputs: How long the firmware waits before resetting an output after an overload
  • For input channels:
    • fritting current enabled/disabled: Whether a small current is drawn from time to time to avoid contact corrosion

Channels that are not included in the configuration array are not changed.

  err = c.UploadConfiguration([]*fspb.ChannelConfig{
    {
      Channel:    0,
      Mode:       biniopb.ChannelMode_BINARYIOTYPED_OUTPUT_HIGH_ACTIVE,
      InitialValue: False,
      OverloadRecoveryTimeoutMs: 100,
      WatchdogTimeoutMs: 2000,
    },
    {
      Channel:    1,
      Mode:       biniopb.ChannelMode_BINARYIOTYPED_INPUT_HIGH_ACTIVE,
      FrittingEnable: true,
    },
  })
  if err != nil {
    ...
  }
    config = binio.Pb.ConfigurationSet()

    # channel 0 = high active output
    config.channelConfig.add(
        channel=0,
        mode=binio.Pb.ChannelMode.BINARYIOTYPED_OUTPUT_HIGH_ACTIVE,
        initialValue=False,
        overloadRecoveryTimeoutMs=100,
        watchdogTimeoutMs=2000,
        )

    # channel 1 = high active input
    config.channelConfig.add(
        channel=1,
        mode=binio.Pb.ChannelMode.BINARYIOTYPED_INPUT_HIGH_ACTIVE,
        frittingEnable=True,
        )

    binio_client.upload_configuration(config)

Controlling Output Values

The API provides two methods to control channel output values

  • Control a single pin
  • Control multiple pins

Control a single pin:

    // activate first channel
    err = c.SetOutput(0, true)

Control multiple pins using a bit mask. The second parameter to SetOutputs is a mask that specifies which channels are affected:

    // activate first binary output, deactivate second output, don't change other channels
    err := c.SetOutputs(0x1, 0x3)

    // activate first 4 channels, don't change other channels
    err := c.SetOutputs(0x0, 0xf)

The SetOutput and SetOutputs methods return an error if

  • the channel number is out of range
  • a channel that shall receive a new output value is configured as input
  • the channel's group has no power
  • the channel is in overload error state

The actual pin state of channels configured as outputs can be read back using the Inputs methods below.

Control a single pin:

    # output high value on first channel
    binio_client.set_output(0, True)

Control multiple pins using a bit mask. The second parameter to set_outputs is a mask that specifies which channels are affected:

    # set first binary output to high, set second output to low, don't change other channels
    binio_client.set_outputs(0x1, 0x3)

    # set first 4 channels to low, don't change other channels
    binio_client.set_outputs(0x0, 0xf)

The set_output and set_outputs methods raise a RuntimeError if

  • the channel number is out of range
  • a channel that shall receive a new output value is configured as input
  • the channel's group has no power
  • the channel is in overload error state

The actual pin state of channels configured as outputs can be read back using the get_channels methods below.

Reading Inputs and Channel Diagnostics

The API provides a method to read the actual pin states and a diagnostic value for each channel.

    inputs, diags, err := c.Inputs()
    if err != nil {
        ...
    }
    for ch, diag := range diags {
        input := inputs & (1 << ch)
        fmt.Printf("Channel %d: value=%v diag=%v\n", ch, input != 0, diag)
        if diag != uint32(biniopb.ChannelDiag_NoDiag) {
            log.Printf("diagnostic error ch %d: %v", ch, diag)
        }
    }
The diagnostic value(s) contain a bit mask with the following flags:

  • ChannelDiag_NoSupplyVoltage: The channel's group has no power
  • ChannelDiag_Overload: The channel is in overload error state

    res = binio_client.get_channels()
    for i in range(len(res.diag)):
        input = res.inputs & (1 << i)
        print(f"Channel {i}: value={input} diag={res.diag[i]}")
The diagnostic value(s) contain a bit mask with the following flags:

  • NoSupplyVoltage: The channel's group has no power
  • Overload: The channel is in overload error state

24V Binary Outputs

The SQ1-TRACK has two binary outputs. The outputs are high side switching, so the load shall be connected to the positive supply voltage. The outputs are galvanically isolated from the rest of the SQ1-TRACK.

Features

The SQ1-TRACK has a binary output function block providing:

  • 2 galvanically isolated channels from the rest of the SQ1-TRACK.
  • Each pin can be only used as a binary output.
  • Switching capability of each pin is 35 mA
  • Overcurrent/Overload protection

Using the io4edge API to access the 24V Binary Output Function

First, install the io4edge client library.

Want to have a quick look to the examples? See our Github repository.

First, install the io4edge client library.

Want to have a quick look to the examples? See our Github repository.

Connect to the Binary I/O Function

To access the 24V Binary Outputs, create a Client and save it to the variable c. Pass as address either a service address or an IP address with port. Example:. Example:

  • As a service address: SQ1-geo_addr04-binio
  • As an IP/Port: e.g. 192.168.201.1:10001

We need this client variable for all further access methods.

import (
    "os"
    "time"

    log "github.com/sirupsen/logrus"
    binio "github.com/ci4rail/io4edge-client-go/binaryiotypeb"
)

func main() {
    c, err = binio.NewClientFromUniversalAddress(address, timeout)
    if err != nil {
        log.Fatalf("Failed to create binio client: %v\n", err
    }
}

To access the 24V Binary Outputs, create a Client and save it to the variable binio_client. Pass as address either a service address or an IP address with port. Examples:

  • As a service address: SQ1-geo_addr04-binio
  • As an IP/Port: 192.168.201.1:10001

We need this client variable for all further access methods.

import io4edge_client.binaryiotypeb as binio

def main():
  binio_client = binio.Client(address)

Controlling Output Values

The API provides two methods to control channel output values

  • Control a single pin
  • Control multiple pins

Control a single pin:

    // Turn first channel on
    err = c.SetOutput(0, true)
    // Turn first channel off
    err = c.SetOutput(0, false)

Control multiple pins using a bit mask. The second parameter to SetAllOutputs is a mask that specifies which channels are affected:

    // Turn first channel on, and turn the second channel off
    err := c.SetAllOutputs(0x1, 0x3)

The SetOutput and SetAllOutputs methods return an error if the channel number is out of range

Control a single pin:

    # Turn first channel on
    binio_client.set_output(0, True)
    # Turn first channel off
    binio_client.set_output(0, False)

Control multiple pins using a bit mask. The second parameter to set_outputs is a mask that specifies which channels are affected:

    # Turn first channel on, and turn the second channel off
    binio_client.set_all_outputs(0x1, 0x3)

The set_output and set_outputs methods raise a RuntimeError if the channel number is out of range