It is currently Thu Sep 18, 2014 7:46 pm




Post new topic Reply to topic  [ 6 posts ] 
 Help for custom Driver 
Author Message
Trooper
Trooper

Joined: Thu Nov 24, 2011 1:41 am
Posts: 18
Post Help for custom Driver
Hi,
I'm implementing a custom driver that reads a HTML page in a equipement that has an embedded web server.
This driver just reads the datas in a table in this page, create the opc-ua nodes on connect() with the header line found and updates the nodes at each update() with the values founded in the cells.
I actually used as the weather driver example an AbstractDriver.
As I saw in a other post, U say that if we want to make a real driver we have to make a AbstractNioDriver, so I'm going to do so.
My question is this one : I have to timestamp the datas with the datetime I found in the web page, as I need to history datas with the source timestamp and not the gateway timestamp. Would it be possible with a NioDriver and how ? I didn't see the waay to do that in the modbus V2 sample.
Can we access the "LastChange" property of the tag ? Or is there an more "official" way to do this ?

Thanks for your help :scratch:


Mon Jul 09, 2012 5:51 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 2025
Location: Folsom, CA
Post Re: Help for custom Driver
GermainN wrote:
Hi,
As I saw in a other post, U say that if we want to make a real driver we have to make a AbstractNioDriver, so I'm going to do so.


By "real" driver I mean one that talks to a PLC. For a driver like this extending NodeMapDriver, or even better the new AbstractTagDriver, is perfectly suited.

GermainN wrote:
My question is this one : I have to timestamp the datas with the datetime I found in the web page, as I need to history datas with the source timestamp and not the gateway timestamp. Would it be possible with a NioDriver and how ? I didn't see the waay to do that in the modbus V2 sample.


When you create a DataValue object you can set the source timestamp. Use the public DataValue(Variant value, StatusCode statusCode, UtcTime sourceTimestamp, UtcTime serverTimestamp) constructor.

GermainN wrote:
Can we access the "LastChange" property of the tag ? Or is there an more "official" way to do this ?


Not from a driver, that's a SQLTag property, not an OPC property.

_________________
Kevin Herron
Software Developer
Inductive Automation


Mon Jul 09, 2012 6:35 am
Profile WWW
Trooper
Trooper

Joined: Thu Nov 24, 2011 1:41 am
Posts: 18
Post Re: Help for custom Driver
Thanks Kevin.

I love this forum, your answers are so quick and effficient ! :D

I didn't mind of that, cause in the weather driver the DataNode .java did instanciate the DataVariableNode with a new UtcTime()... and I didn't saw it.
I'm going to try this.


Mon Jul 09, 2012 7:07 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 2025
Location: Folsom, CA
Post Re: Help for custom Driver
You might also want to explore implemented a SQLTag provider instead of a driver. There's an example of that in the SDK as well, I think it's called SimpleTagProvider.

_________________
Kevin Herron
Software Developer
Inductive Automation


Mon Jul 09, 2012 7:30 am
Profile WWW
General
General

Joined: Tue Mar 24, 2009 9:14 am
Posts: 901
Location: Hudson, MI
Post Re: Help for custom Driver
You may also want to take a look at this topic.

_________________
Jordan

Duct tape is like The Force. It has a light side, a dark side, and it holds the universe together.


Mon Jul 09, 2012 9:42 am
Profile
Trooper
Trooper

Joined: Thu Nov 24, 2011 1:41 am
Posts: 18
Post Re: Help for custom Driver
It won't be possible for me to use a TagProvider as I need to add a lot of devices with their own parameters (IP address, ...). The OPC-UA driver correspond exactly to what I want to do. The equipement is a PLC but with no external protocol, this is why I use the embedded web server to catch the data.

I successfully tried the timestamping with the DataVariableNode, but I still have a problem...

If I change the value of the Node, I get it in the Tag in the Ignition Designer with the good timestamp on the LastChange Property. If I only change the timestamp (as the data value didn't change in my web page), the tag is not refreshed in the Ignition designer.

If I use history, it archives the data only if the value changes (I use the Value timestamping for history of course).
When I use a transaction group, as the tag is calculated directly by the group, I always have the good value and timestamp.

Is there's a way to use the History Provider the same way ?

Thanks again for your help :oops:


Tue Jul 10, 2012 12:23 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: