Analog and Binary Output Status

748 views
Skip to first unread message

Chad Showalter

unread,
Oct 10, 2017, 6:38:15 PM10/10/17
to automatak-dnp3
I'm using the Java bindings with opendnp3 version 2.2.0 to implement a master that is able to interact with dnp3 outstations that implement DNP Application Note AN2013-001(DNP3 Profile for Advanced Photovoltaic Generation and Storage).  One of my use cases involves issuing a number of selectAndOperate control operations on analog outputs (to set an inverter curve, and then enable it).  Additionally, on startup and/or first connect with the outstation, the master needs to know the current state of these analog outputs.  I'm wanting to implement the right pattern for these interactions.
  1. What's the best way for my master implementation to stay apprised of the current state of these outputs?  Something like this?
    master.addPeriodicScan(Duration.ofSeconds(scanIntervalSeconds), Header.Range16((byte) 40, (byte) 3, rangeStart, rangeStop);
    And then implement SOEHandler's processAOS() to get the current state?
  2. Does it additionally make sense to do an ad hoc scan immediately after issuing the set of selectAndOperate()'s  to feed my SOEHandler the current state?  Or perhaps to attach a CommandTaskResult handler to each selectAndOperate() and draw conclusions about current analog output state from these results?  My goal here is simply to ensure that the master has the correct picture of the outstation's state as soon as possible after issuing the commands.
Sorry for the newbie questions.  I appreciate any nudge in the right direction including additional reading or code examples.

Chad

J Adam Crain

unread,
Oct 11, 2017, 10:00:38 PM10/11/17
to automatak-dnp3
Hi Chad,

In response to your questions:

1) Generally speaking, you want to stay away from custom scans as much as possible. Hopefully your device supports BinaryOutputStatus events, and you can get these changes with your normal event scan (class 1/2/3).

2) The *best* way to be notified of any change is to use unsolicited reporting. Otherwise, I would just rely on an event scan.

If there's some reason you can't do 1) and 2) let me know and we can discuss "next best" options.

Sorry you're having to implement AN2013-001. It's a cluster of a document/mapping =(.

-Adam

Chad Showalter

unread,
Oct 12, 2017, 2:55:02 PM10/12/17
to automatak-dnp3
Thanks Adam.  I've asked some follow on questions inline below.

On Wednesday, October 11, 2017 at 10:00:38 PM UTC-4, J Adam Crain wrote:
Hi Chad,

In response to your questions:

1) Generally speaking, you want to stay away from custom scans as much as possible. Hopefully your device supports BinaryOutputStatus events, and you can get these changes with your normal event scan (class 1/2/3).

Okay, so I'll try to avoid custom scans.  My device does not currently support Analog/BinaryOutputStatus events (or Analog/BinaryOutput Command events).  I do get AnalogInputEvents.
I can just scan for events:
master.addPeriodicScan(Duration.ofMinutes(1), Header.getEventClasses());
and get class 1, 2, and 3 events (currently just AnalogInputEvents).  Or I can scan for just class 0:
master.addPeriodicScan(Duration.ofMinutes(1), Header.allObjects((byte)60, (byte)1));
and get current state of everything (analog/binary inputs and outputs).  Or of course an integrity scan does both.

However, since I don't seem to get any events associated with state changes on binary or analog outputs, how does this sound as an approach?

1. Do a periodic event scan to pick up analog inputs changes (or my device may be able to deliver these as unsolicited events)
2. Do a periodic class 0 scan to ensure I (the master) have the currently correct values for binary and analog inputs and outputs
3. Trigger a scan immediately after manipulating a set of analog/binary outputs (i.e., setting/enabling an inverter curve).  I could scan all of class 0 or just the points I changed.  Which is better?

Or very possibly there's a better way and/or I'm missing something.  Thoughts?

For what it's worth, we plan to be connecting to more than one outstation implementation of the spec, so I'd like to implement a solution that takes advantage of a more complete/better outstation implementation later.  But of course I also need to work with  the limitations we currently have.

J Adam Crain

unread,
Oct 14, 2017, 12:07:16 PM10/14/17
to automatak-dnp3
Hi Chad,

Given the limitations of the device, that approach sounds reasonable.

You can scan for a specific range, or if there aren't that many points, you can ask for "all objects" (qualifier == 0x06) of the required types.

-Adam

jithend...@gmail.com

unread,
Oct 17, 2017, 9:25:22 AM10/17/17
to automatak-dnp3

Adam,

 

I am working with Chad on this project. The device side CommandHandler (which I am working on) updates the outstation with AnalogOutputStatus and BinaryOutputStatus immediately when the command is received from DirectOperate method as below:

 

public CommandStatus DirectOperate(ControlRelayOutputBlock command, ushort index){

            ChangeSet changeSet = new ChangeSet();

            changeSet.Update(new BinaryOutputStatus(command.code == ControlCode.LATCH_ON, (byte)BinaryQuality.ONLINE,DateTime.Now), index);

            m_outstation.Load(changeSet);

     //Do other stuff}

 

public CommandStatus DirectOperate(AnalogOutputDouble64 command, ushort index){

                ChangeSet changeSet = new ChangeSet();

                changeSet.Update(new AnalogOutputStatus(command.value, (byte)AnalogQuality.ONLINE, DateTime.Now), index);

                //Do other stuff}

 

We expect this to trigger an event which updates the master (which Chad is working on) with the Analog/Binary output status. But somehow only few of the AnalogInput events (updated in the different section of the code but on the same outstation) gets updated in the master (assuming only those events that get modified?) from an event scan in the master as below: 

 

master.addPeriodicScan(Duration.ofMinutes(1), Header.getEventClasses());

 

Note that however all the analog/binary input/outputs are available with a class 0 scan as below :


master.addPeriodicScan(Duration.ofMinutes(1), Header.allObjects((byte)60, (byte)1));


FYI, the device uses C# bindings of 2.0.X and the master uses Java bindings of 2.2.0. We appreciate any feedback on why we don’t see any analog/binary output status on the event scan.

Thanks,
Jithendar

J Adam Crain

unread,
Oct 17, 2017, 9:09:11 PM10/17/17
to automatak-dnp3
Hi Jithendar,

The 2nd stub for DirectOperate(AnalogOutputDouble64...) is missing:

m_outstation.Load(changeSet);

The default deadband is zero, i.e any change at all should trigger an event.


-Adam

jithend...@gmail.com

unread,
Oct 18, 2017, 5:09:03 PM10/18/17
to automatak-dnp3
Adam,

We may have finally found the cause of the problem. The Analog and Binary outputs were assigned to Class 0.
In OpenDNP3, Class 0 is not an event class. So the outputs didn't show up in the master from an event scan. 
Changing the events to class 1 solved the issue. Thanks for the help.
- Jithendar

J Adam Crain

unread,
Oct 18, 2017, 5:18:54 PM10/18/17
to automatak-dnp3
Ok great, glad to hear that things are working.
Reply all
Reply to author
Forward
0 new messages