Skip to main content

AssociationConfig

The AssociationConfig struct provides the configuration information you need to communicate with a particular outstation on the communication channel, including:

  • Timeout for responses on this association
  • 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.

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 DNP3 standard requires that the master perform these actions during initialization before normal polling can occur:

sequenceDiagram Master->>Outstation: Disable Unsolicited Reporting; Outstation->>Master: Response; Master->>Outstation: READ Class 3,2,1,0; Note over Master,Outstation: multiple responses/ACK possible here; Master->>Outstation: Enable Unsolicited Reporting; Outstation->>Master: Response;

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:

  1. User requests such as control operations get top priority.
  2. The association then considers automatic and initialization tasks in this order:
    1. Clear the RESTART IIN bit if previously observed in a response.
    2. Disable unsolicited reporting if configured to do so during initialization.
    3. Perform an integrity scan if configured to do so during initialization.
    4. Perform automatic time synchronization if enabled, and the master observes the 'NEED_TIME IIN' bit in a response.
    5. Enable unsolicited reporting if configured to do so during initialization.
  3. 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.

The RESTART IIN bit is automatically cleared by the master whenever the outstation reports it.