Skip to main content

AssociationConfig

AssociationConfig sets how the master works with one outstation. The outstation's address isn't part of it: you pass the address separately when you create the association. The configuration answers these questions:

DecisionWhy it matters
What to read at startupThe integrity poll gives you the current value of every point, at startup and after the outstation restarts
Whether the outstation reports unsolicitedWhich event classes the master turns off and back on at startup. Choose none for an outstation that doesn't report unsolicited, and poll it instead
Whether and how to synchronize timeWhether the master sets the outstation's clock when it asks for the time, and with which procedure. See Time Synchronization
How to react to the outstation's indicationsWhich event classes the master scans when the outstation reports events, and whether it runs an integrity poll when the outstation's event buffer overflows
How long to wait, and how to retryHow long the master waits for each response, and how it retries automatic tasks that fail
When to check a quiet linkHow long the link can be silent before the master sends a keep-alive, if at all
How many requests can waitHow many of your requests can queue on the association before new ones fail at once

The examples configure an association like this:

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
}

Initialization​

The master turns unsolicited reporting off, reads everything with an integrity poll, then turns unsolicited reporting back on. That way it starts from the current value of every point before changes stream in. If the outstation asks for the time and automatic time synchronization is configured, the master synchronizes it before the integrity poll:

The master skips any step whose classes you leave empty. For an outstation that doesn't support unsolicited reporting, set the classes to disable and to enable at startup to none, and the master performs only the integrity poll.

Scheduling​

The master runs these startup tasks, and others such as clearing the restart bit and automatic event scans, alongside your requests and polls. See Automatic Tasks and Scheduling for when each one runs and how a channel orders the work of its associations.