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)

Let's look at the static configuration required to create an outstation.

OutstationConfig

The OutstationConfig structure contains the parameters that modify the behavior of the outstation. The generated API documentation provides a definition for each field. All fields have default values except for the master and outstation link addresses. Keep in mind that we didn't optimize these default values for every use case; for example, you may need to adjust the timeout parameters for higher latency links.

// create an outstation configuration with default values
let mut config = OutstationConfig::new(
// outstation address
EndpointAddress::try_new(1024).unwrap(),
// master address
EndpointAddress::try_new(1).unwrap(),
get_event_buffer_config(),
);
// override the default decoding
config.decode_level.application = AppDecodeLevel::ObjectValues;

EventBufferConfig

The EventBufferConfig struct controls the number of events buffered for each type that the outstation can report. During the outstation initialization, space is internally pre-allocated for each type based on this configuration. When all the space in the buffer for a particular type has been used, adding another event will cause the oldest event to be discarded, and the outstation will assert IIN 2.3 (Event Buffer Overflow) per the specification.

When determining how many events to configure, remember that there is a fundamental tradeoff between saving events for future reporting and your memory/CPU usage. Determine your event buffer sizes based on these factors:

  • 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.
tip

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.

// Rust example only uses analogs so that's all we need to configure
fn get_event_buffer_config() -> EventBufferConfig {
EventBufferConfig::all_types(100)
}
note

Setting the number of events for a particular type to 0 ensures that you will never record or report events for that type.