Operate switch

Description

This function obtains, and optionally sets, the state of a switch. It allows explicit access to the individual switches making up a sub-unit, in types where their operation is normally handled automatically by the driver. The main purpose of this is in implementing fault diagnostic programs for such types; it can also be used where normal automated behaviour does not suit an application.

Prototype

DWORD PIPLX_OpSwitch(SESSION session, DWORD CardNum, DWORD OutSub, DWORD SwitchFunc, DWORD SegNum, DWORD SwitchNum, DWORD SubSwitch, DWORD SwitchAction, BOOL *State);

Parameters:

Session - The session variable obtained from the PICMLX_Connect call

CardNum - card number

OutSub - sub-unit number

SwitchFunc - code indicating the functional group of the switch, see below

SegNum - the segment location of the switch

SwitchNum - the number of the switch in its functional group (unity-based)

SubSwitch - the number of the subswitch to operate (unity-based)

SwitchAction - code indicating the action to be performed, see below

State - pointer to variable to receive the state of the switch (after performing any action)

Returns:

Zero for success, or non-zero error code.

Applicable sub-unit types

This function is only usable with matrix sub-units having auto-isolation and/or auto-loopthru features. For further information see: segmented matrix, unsegmented matrix.

SwitchFunc value

A value indicating the functional group of the switch to be accessed.

Value

Ident

Function

0

SW_FUNC_CHANNEL

A channel (matrix crosspoint) switch

1

SW_FUNC_X_ISO

A matrix X-isolation switch

2

SW_FUNC_Y_ISO

A matrix Y-isolation switch

3

SW_FUNC_X_LOOPTHRU

A matrix X-loopthru switch

4

SW_FUNC_Y_LOOPTHRU

A matrix Y-loopthru switch

 

SegNum value

The segment location of the switch. The numbers and sizes of segments on each matrix axis can be obtained using PIPLX_SubAttribute.

 

In an unsegmented matrix, use SegNum = 1.

 

In a segmented matrix, segment numbers for crosspoint and isolation switches are determined logically.

SwitchNum value

The number of the switch in its functional group (unity-based).

 

For channel (crosspoint) switches, the switch number can be either:

SubSwitch value

The number of the subswitch to operate (unity-based). This parameter caters for a situation in which a logical channel, isolation or loopthru switch is served by more than one physical relay (as for example when 2-pole operation is implemented using independently-driven single-pole relays).

 

The numbers of subswitches for each functional group can be obtained using PIPLX_SubAttribute.

SwitchAction value

A code indicating the action to be performed.

Value

Ident

Function

0

SW_ACT_NONE

No switch change - just set State result

1

SW_ACT_OPEN

Open switch

2

SW_ACT_CLOSE

Close switch

 

Loopthru switches

Loopthru switches are initialised by the driver to a closed state, which may mean that they are either energised or de-energised depending upon their type. In normal automated operation loopthru switches open when any crosspoint on their associated line is closed. Actions SW_ACT_CLOSE and SW_ACT_OPEN close or open loopthru switch contacts as their names imply.

Operational considerations

This function can be used to alter a pre-existing switch state in a sub-unit, set up by fuctions such as PIPLX_OpBit or PIPLX_WriteSub. However once the state of any switch is changed by PIL_OpSwitch the logical state of the sub-unit is considered to have been destroyed. This condition is flagged in the result of PIPLX_SubStatus (bit STAT_CORRUPTED). Subsequent attempts to operate it using 'ordinary' switch functions such as PIPLX_OpBit, PIPLX_ViewBit etc. will fail (result ER_STATE_CORRUPT). Normal operation can be restored by clearing the sub-unit using PIPLX_ClearSub, PIPLX_ClearCard or PIPLX_ClearAll.