AssociationConfig

The AssociationConfig struct provides configuration information needed 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

The outstation address is supplied 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 certain actions during initialization before normal polling occurs:

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 an outstation does not support unsolicited reporting, you may turn the DISABLE/ENABLE unsolicited requests off by setting AssociationConfig.DisableUnsolClasses and AssociationConfig.EnableUnsolClasses to EventClasses.None(). The master will skip unsolicited configuration during initialization and only perform the integrity poll.

Scheduling#

The standard leaves a lot up to implementations regarding scheduling. The algorithm used to schedule requests on a channel follows the steps outlined below. Each association maintains its own task queue, and the channel uses a round-robin queue to ensure fairness across associations on the channel.

  1. Users requests such as control operations are always given the highest priority
  2. Automatic and initialization tasks are then considered in this order:
    1. Clear the RESTART IIN bit if it has been 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 configured and the NEED_TIME IIN bit has been observed in a response
    5. Enable unsolicited reporting if configured to do so during initialization
  3. Periodic polls are then executed if there is nothing else to do.