Skip to main content

Outstation configuration

You create outstations using three types of components:

  • Static configuration values
  • Callback interfaces
  • Transport-specific configuration (e.g., TCP vs. serial parameters)

The following static configuration is required to create an outstation.

OutstationConfig​

OutstationConfig contains parameters that modify outstation behavior. See the generated API documentation for field definitions. All fields have defaults except the master and outstation link addresses and the EventBufferConfig. Defaults aren't optimized for every use case, so you may need to adjust timeouts for higher latency links.

// create an outstation configuration with values from CLI
let mut config = OutstationConfig::new(
// outstation address
cli.outstation_address,
// master address
cli.master_address,
get_event_buffer_config(),
);

// override the default decoding
config.decode_level.application = AppDecodeLevel::ObjectValues;

EventBufferConfig​

EventBufferConfig controls the number of events buffered for each type. Space is pre-allocated during initialization. When a buffer fills, the oldest event of that type is discarded and the master is told the buffer overflowed.

There's a tradeoff between preserving events and memory/CPU usage. Consider these factors when sizing buffers:

  • How many measurements the outstation database contains
  • How often the measurements change
  • How often and for how long the master may be disconnected or otherwise unable to empty the event queues via READ or unsolicited reporting
  • How important it is to preserve events for a particular type.

Not all events are created equal. For example, it may be important to capture every binary state transition, while missing an analog or counter value might not matter at all.

fn get_event_buffer_config() -> EventBufferConfig {
EventBufferConfig::new(
10, // binary
10, // double-bit binary
10, // binary output status
5, // counter
5, // frozen counter
5, // analog
5, // analog output status
3, // octet string
)
}
note

Setting the event count to 0 for a type disables event recording and reporting for that type.