Outstation Configuration

Outstations are created using a few types of components:

  • static configuration values
  • callback interfaces
  • transport specific configuration (e.g. TCP vs serial parameters)

This section describes the static configuration required to create and outstation. The two other types of information are covered in subsequent sections.

OutstationConfig#

The OutstationConfig structure contains parameters that modify the behavior of the outstation. Refer to the generated API documentation for the meaning of each field. All of the fields, with the exception of the master and outstation link addresses, have default values. This does not mean that these defaults will function well for all use cases. The timeout parameters, for example, may need to be adjusted for higher latency links.

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

EventBufferConfig#

The EventBufferConfig struct controls how many events are buffered for each type that can be reported by the outstation. Space for each type is pre-allocated during outstation initialization. When all of the space in the buffer for a particular type has been exhausted, 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.

There is no "correct" number of events to configure. There is a fundamental tradeoff between saving events for future reporting and memory/CPU usage. You should scale your event buffer sizes based on several factors:

  1. How many measurements are contained in the outstation database and how often they change.
  2. How often and for how long the master may be disconnected or otherwise unable to empty the event queues via READ or unsolicited reporting.
  3. How important it is to never loose events for a particular type. For example, it may be more important to never miss binary state transitions but 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 {
// initialize the config to zero for every type
let mut config = EventBufferConfig::no_events();
// event buffer space for 100 analog events
config.max_analog = 100;
config
}
note

Setting the number of events for a particular type to 0 ensures that events will never be recorded or reported for that type.