Skip to content

Valve Selector

Multi-position valve control for fluid routing.

SIA_API.devices.valve_selector.ValveSelector

ValveSelector(port: str, num_positions: int = 8, prefix: str = '/Z', address: str = '', baudrate: int = 9600)

Bases: CommandSender

Control multi-position valve selectors for automated fluid routing.

Supports VICI and compatible valve selectors with 2-12 positions. Provides reliable positioning with automatic retry and validation.

Attributes:

Name Type Description
num_positions int

Number of valve positions available

Examples:

Basic valve control:

>>> valve = ValveSelector(port="COM4", num_positions=8)
>>> valve.position(1)  # Move to position 1
>>> valve.position(5)  # Move to position 5

Custom configuration:

>>> valve = ValveSelector(
...     port="COM4", 
...     num_positions=6,
...     prefix="/Z",
...     baudrate=19200
... )

Initialize valve selector controller.

Parameters:

Name Type Description Default
port str

COM port for valve selector (e.g., "COM4")

required
num_positions int

Number of valve positions

8
prefix str

Command prefix for valve protocol (default: "/Z")

'/Z'
address str

Device address (usually empty for valve selectors)

''
baudrate int

Serial communication speed (default: 9600)

9600

Raises:

Type Description
ValueError

If num_positions is outside valid range

SerialException

If COM port cannot be opened

Note

Most VICI valve selectors use "/Z" prefix and empty address. Some models may require different communication parameters.

Functions

position

position(position: int, num_attempts: int = 3) -> None

Move valve to specified position.

Parameters:

Name Type Description Default
position int

Target position (1 to num_positions)

required
num_attempts int

Number of command attempts for reliability

3

Raises:

Type Description
ValueError

If position is outside valid range

Note

Multiple attempts help ensure reliable valve positioning, as some valves may not respond to the first command.

Examples:

>>> valve.position(1)          # Move to position 1
>>> valve.position(8, num_attempts=5)  # Extra attempts for reliability