C# Example Demo

230 views
Skip to first unread message

Michael LeTan

unread,
Dec 6, 2020, 2:35:02 PM12/6/20
to opendnp3
I have successfully downloaded and run the C# example of the master and outstation. I can see the value change in the outstation reflecting in the master. The issue I am having, the timestamp mode and the timestamp within the master are showing "INVALID" and "1/1/1970 12:00:00 AM respectively.

Any advice would be greatly appreciated.


Thank you!

 

Adam Crain

unread,
Dec 6, 2020, 3:08:54 PM12/6/20
to opendnp3
Hi Michael,

Many DNP3 variations, including all of the static ones, don't carry a timestamp.

If you produce an event that carries a timestamp, then you'll see the value become "synchronized" and have a non-epoch value.

-Adam

Michael LeTan

unread,
Dec 8, 2020, 2:11:06 PM12/8/20
to Adam Crain, opendnp3
Adam,

Thank you so much for replying! 

I have created a SimpleConsoleCommandHandler. It is very similar to the SimpleCommandHandler. In the SimpleConsoleCommandHandler, I returned CommandStatus.Success for all the implemented functions. I have placed a breakpoint in each function so I can inspect the behavior. I then added the instance to the channel.AddOutstation as seen below. When I run it, it would not stop for debugging. The snippet below, very similar to the example, I added two instances for debugging.

var outstation = channel.AddOutstation("outstation", SimpleConsoleCommandHandler.Instance, ConsoleOutstationApplication.Instance, config);

The attachments are:
  • SimpleConsoleCommandHandler - simple implementation that returns CommandStatus.SUCCESS
  • ConsoleOutstationApplication - something simple to test and explore.
I am unable to simulate the value with a timestamp at the same time debugging and learning.

Any guidance would be appreciated.

Thank you for your time!


Michael




--
You received this message because you are subscribed to the Google Groups "opendnp3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automatak-dnp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automatak-dnp3/42c51014-e89b-428d-98f2-c30be02be787n%40googlegroups.com.
SimpleConsoleCommandHandler.cs
ConsoleOutstationApplication.cs

Michael LeTan

unread,
Dec 8, 2020, 2:11:10 PM12/8/20
to opendnp3
Adam,

Thank you so much for replying! 

I have created a SimpleConsoleCommandHandler. It is very similar to the SimpleCommandHandler. In the SimpleConsoleCommandHandler, I returned CommandStatus.Success for all the implemented functions. I have placed a breakpoint in each function so I can inspect the behavior. I then added the instance to the channel.AddOutstation as seen below. When I run it, it would not stop for debugging. The snippet below, very similar to the example, I added two instances for debugging.

var outstation = channel.AddOutstation("outstation", SimpleConsoleCommandHandler.Instance, ConsoleOutstationApplication.Instance, config);

The attachments are:
  • SimpleConsoleCommandHandler - simple implementation that returns CommandStatus.SUCCESS
  • ConsoleOutstationApplication - something simple to test and explore.
The purpose of what  I am trying to do is to simulate the value with a timestamp at the same time debugging and learning.

Any guidance would be appreciated.

Thank you for your time!


Michael

ConsoleOutstationApplication.cs
SimpleConsoleCommandHandler.cs

Michael LeTan

unread,
Dec 8, 2020, 2:11:26 PM12/8/20
to Adam Crain, opendnp3
Adam,
After reading through other emails, I was able to solve the double issue along with the time stamp.
On the Outstation, when adding an analog type, once I set the eventVariation and the staticVariation, both the double value and the timestamp showed up in the Master.
The snippet below illustrates what was done:

outstationStack.databaseTemplate.analog.Add(key, new AnalogConfig()
                    {
                        eventVariation = EventAnalogVariation.Group32Var7,
                        staticVariation = StaticAnalogVariation.Group30Var5
                    });

Thank you for your time!
Michael

Adam Crain

unread,
Dec 8, 2020, 2:20:48 PM12/8/20
to opendnp3
Thanks for sharing that you got this worked out.

-Adam

Michael LeTan

unread,
Dec 9, 2020, 11:39:10 PM12/9/20
to opendnp3
Going back to the example demo, I am trying to get the OctetString to show up. I have simulated updates for strings less than 200 bytes.
I have set the OctStrings in the Outstation as follow:
outstationStack.databaseTemplate.octetString.Add(key, new OctetStringConfig()
                    {
                        eventVariation = EventOctetStringVariation.Group111Var0,
                        staticVariation = StaticOctetStringVariation.Group110Var0
                    });

I would simulate them by calling the changeset.Update:
changeset.Update(value, dataType.Key);

When getting it from the Master, I do not see any updates from the OctStrings.

Not sure what I am doing wrong. I am doing the same steps as the Binary and for the Analog. Please advise.

Thank you!


Michael

Adam Crain

unread,
Dec 14, 2020, 2:36:02 PM12/14/20
to opendnp3
Michael,

Just letting you know I haven't had a chance to try out the C# examples yet with octet strings.

-Adam
Reply all
Reply to author
Forward
0 new messages