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.
- Rust
- C
- C++
- Java
- C#
// 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;
dnp3_outstation_config_t config = dnp3_outstation_config_init(
// outstation address
OUTSTATION_ADDRESS,
// master address
MASTER_ADDRESS,
// event buffer sizes
get_event_buffer_config()
);
// override the default application decoding level
config.decode_level.application = DNP3_APP_DECODE_LEVEL_OBJECT_VALUES;
OutstationConfig config(OUTSTATION_ADDRESS, MASTER_ADDRESS, get_event_buffer_config());
// override the default application decoding level
config.decode_level.application = AppDecodeLevel::object_values;
// create an outstation configuration with default values
OutstationConfig config =
new OutstationConfig(
// outstation address
ushort(OUTSTATION_ADDRESS),
// master address
ushort(MASTER_ADDRESS),
// event buffer sizes
getEventBufferConfig())
.withDecodeLevel(new DecodeLevel().withApplication(AppDecodeLevel.OBJECT_VALUES));
// create an outstation configuration with default values
var config = new OutstationConfig(
// outstation address
OutstationAddress,
// master address
MasterAddress,
// event buffer sizes
GetEventBufferConfig()
).WithDecodeLevel(DecodeLevel.Nothing().WithApplication(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.
- Rust
- C
- C++
- Java
- C#
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
)
}
dnp3_event_buffer_config_t get_event_buffer_config(void)
{
return dnp3_event_buffer_config_init(10, // binary
10, // double-bit binary
10, // binary output status
5, // counter
5, // frozen counter
5, // analog
5, // analog output status
3 // octet string
);
}
EventBufferConfig get_event_buffer_config()
{
return EventBufferConfig(
10, // binary
10, // double-bit binary
10, // binary output status
5, // counter
5, // frozen counter
5, // analog
5, // analog output status
3 // octet string
);
}
private static EventBufferConfig getEventBufferConfig() {
return new EventBufferConfig(
ushort(10), // binary
ushort(10), // double-bit binary
ushort(10), // binary output status
ushort(5), // counter
ushort(5), // frozen counter
ushort(5), // analog
ushort(5), // analog output status
ushort(3) // octet string
);
}
private static EventBufferConfig GetEventBufferConfig()
{
return new EventBufferConfig(
10, // binary
10, // double-bit binary
10, // binary output status
5, // counter
5, // frozen counter
5, // analog
5, // analog output status
3 // octet string
);
}
Setting the event count to 0 for a type disables event recording and reporting for that type.