Skip to main content

Executing controls

Construct sequences of binary and analog output headers using a builder class, then send them to a particular outstation using the association id.

Choosing a mode​

operate sends the commands in one of two modes, and operate_no_ack sends them without asking for a response:

ModeExchangesWhy
Select before operate2The outstation confirms it will accept exactly this command before it acts. Use it for most breaker and switch controls.
Direct operate1Speed matters and a mis-operation is tolerable.
Direct operate without acknowledgementNo responseBroadcast-style setpoints, where no response is acceptable.

Operate​

self.association
.operate(
CommandMode::SelectBeforeOperate,
CommandBuilder::single_header_u16(
Group12Var1::from_op_type(OpType::LatchOn),
3u16,
),
)
.await?;

Calling operate begins an asynchronous operation that will complete successfully or with an error code.

The master checks that the outstation echoed each command. Success means the outstation accepted it, not that the output changed; watch the output status points for that.

The operation fails if the outstation returns a status other than CommandStatus::Success for any of the commands. In Rust the error is CommandError::Response(CommandResponseError::BadStatus(status)), carrying the status of the first command that failed, and the other CommandResponseError values report a response that doesn't echo the request. The bindings report BadStatus without the status, and HeaderMismatch for a response that doesn't echo the request. Consult the language-specific documentation for the meaning of each error code.

Direct operate without acknowledgement​

operate_no_ack sends the commands using DIRECT_OPERATE_NO_ACK. The outstation never responds to this function code, not even to report an error.

self.association
.operate_no_ack(CommandBuilder::single_header_u16(
Group12Var1::from_op_type(OpType::LatchOn),
3u16,
))
.await?;

The operation completes successfully once the request has been written to the transport. Success does not mean that the outstation received, accepted, or executed the commands. Use operate when you need the command status reported by the outstation.