AssociationConfig
The AssociationConfig
struct provides the configuration information you need to communicate with a particular outstation on the communication channel, including:
- Startup handshaking
- If and how to perform time synchronization
- Per-association task queue size
Note that the outstation address is provided as a separate argument when adding an association to a channel.
- Rust
- C
- Java
- C#
fn get_association_config() -> AssociationConfig {
let mut config = AssociationConfig::new(
// disable unsolicited first (Class 1/2/3)
EventClasses::all(),
// after the integrity poll, enable unsolicited (Class 1/2/3)
EventClasses::all(),
// perform startup integrity poll with Class 1/2/3/0
Classes::all(),
// don't automatically scan Class 1/2/3 when the corresponding IIN bit is asserted
EventClasses::none(),
);
config.auto_time_sync = Some(TimeSyncProcedure::Lan);
config.keep_alive_timeout = Some(Duration::from_secs(60));
config
}
dnp3_association_config_t get_association_config()
{
dnp3_association_config_t config = dnp3_association_config_init(
// disable unsolicited first (Class 1/2/3)
dnp3_event_classes_all(),
// after the integrity poll, enable unsolicited (Class 1/2/3)
dnp3_event_classes_all(),
// perform startup integrity poll with Class 1/2/3/0
dnp3_classes_all(),
// don't automatically scan Class 1/2/3 when the corresponding IIN bit is asserted
dnp3_event_classes_none());
config.auto_time_sync = DNP3_AUTO_TIME_SYNC_LAN;
config.keep_alive_timeout = 60;
return config;
}
private static AssociationConfig getAssociationConfig() {
AssociationConfig config =
new AssociationConfig(
// disable unsolicited first (Class 1/2/3)
EventClasses.all(),
// after the integrity poll, enable unsolicited (Class 1/2/3)
EventClasses.all(),
// perform startup integrity poll with Class 1/2/3/0
Classes.all(),
// don't automatically scan Class 1/2/3 when the corresponding IIN bit is asserted
EventClasses.none());
config.autoTimeSync = AutoTimeSync.LAN;
config.keepAliveTimeout = Duration.ofSeconds(60);
return config;
}
private static AssociationConfig GetAssociationConfig()
{
var config = new AssociationConfig(
// disable unsolicited first (Class 1/2/3)
EventClasses.All(),
// after the integrity poll, enable unsolicited (Class 1/2/3)
EventClasses.All(),
// perform startup integrity poll with Class 1/2/3/0
Classes.All(),
// don't automatically scan Class 1/2/3 when the corresponding IIN bit is asserted
EventClasses.None()
);
config.AutoTimeSync = AutoTimeSync.Lan;
config.KeepAliveTimeout = TimeSpan.FromSeconds(60);
return config;
}
Initialization
The DNP3 standard requires that the master perform these actions during initialization before normal polling can occur:
If your outstation doesn't support unsolicited reporting, you can turn the DISABLE/ENABLE unsolicited requests off by setting
AssociationConfig.DisableUnsolClasses
and AssociationConfig.EnableUnsolClasses
to EventClasses.None()
. The master will then skip unsolicited configuration during initialization, only performing the integrity poll.
Scheduling
The following algorithm is used to schedule requests within an association:
- User requests such as control operations get top priority.
- The association then considers automatic and initialization tasks in this order:
- Clear the RESTART IIN bit if previously observed in a response.
- Disable unsolicited reporting if configured to do so during initialization.
- Perform an integrity scan if configured to do so during initialization.
- Perform automatic time synchronization if enabled, and the master observes the 'NEED_TIME IIN' bit in a response.
- Enable unsolicited reporting if configured to do so during initialization.
- Finally, the system will then execute periodic polls.
note
The standard does not specify how requests should be scheduled for multiple associations on a channel. Our implementation uses a per-association task queue. The channel scheduler round-robins through the associations to ensure fair access.