Writing a Driver: transmitting the contents of multiple output DPs in one packet

Find and share HowTos to various installations / configurations!
9 posts • Page 1 of 1
willw
Posts:22
Joined: Thu Nov 19, 2015 4:40 pm

Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by willw »

I am writing a driver for WinCC OA API 3.14. (Using Windows + Visual Studio 2013, although I do not believe this is relevant to my problem)

I have subclassed HWService successfully, and am using my writeData() method to transmit the values of individual DPs. This part works fine.

I now have the situation where the driver's workProc() can receive from the remote hardware a message meaning 'Send me the value of ALL your DPs'. I need to do something that

1. identifies all the output DPs that belong to the driver,
2. reads their current values
3. applies the relevant transformation
4. composes the transformed data into a message packet and sends it

Part 1 I guess can be attempted with HWMapper methods such as getFirstComponentMatch()/getNextComponentMatch().

Part 4 is straightforward.

Parts 2 and 3 I have no idea at all how to approach!

All the references to transmitting DPs that I can find seem to refer to writeData(), which just sends one DP at a time.

Pointers/suggestions/examples warmly appreciated.

Will

vogler
Posts:122
Joined: Thu Oct 28, 2010 8:32 am

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by vogler »

maybe you can just set the internal datapoint "_Driver.IGQ" with "*", then the driver should send all configured commands (outgoing addresses)... but I am not 100% if this is implemented in the driver api, or if this must be implemented by you... but you can try...

willw
Posts:22
Joined: Thu Nov 19, 2015 4:40 pm

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by willw »

Thanks for the reply, but...

If I did this (and I am not sure how) wouldn't the driver call writeData() for each outgoing HWObject? How could I accumulate the output data into one message?

I think I need a way of querying the command value DPs under my own control.

Regards

Will

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by leoknipp »

The GQ and IGQ functionaility is part of the common driver in WinCC OA. The common driver DP _Driver is used to start a GQ/IGQ.
If your driver is based on the common driver this functionality should be available.

I do not know if data is send in one packet or not if an IGQ. At my tests with an IEC driver the number of packets send was not the same as the number of configured output addresses. Therefore it looks like not data for every output address is send in an own packet.
Can you please test it with your own driver.

Best Regards
Leopold Knipp
Senior Support Specialist

willw
Posts:22
Joined: Thu Nov 19, 2015 4:40 pm

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by willw »

Thanks. I'll give it a go.

Am I correct in thinking that the way to access DP_Driver is through an instance of DrvIntDp? Or is there a different mechanism for this pre-existing internal DP?

Regards

Will

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by Gertjan van Schijndel »

1. Trigger the internal general query as Andreas suggested, it will call your overloaded HWService::writeData for every output value
2. In your overloaded HWService::writeData do not send data when 'objPtr->getObjSrcType() == srcGeneralQ'
3. Overload HWService::flushHW to send the data in one packet

willw
Posts:22
Joined: Thu Nov 19, 2015 4:40 pm

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by willw »

That looks like exactly the extra bit of information that I want - TVM!

Regards

Will

willw
Posts:22
Joined: Thu Nov 19, 2015 4:40 pm

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by willw »

The IGQ works as advertised, and I can now trigger HWService::writeData using it. Many thanks for this.

My output DP-Types comprise structs of 20 elements - ie they are array types. Each array is mapped to a single peripheral address.

Up until now this seemed to work. For updates of single elements, writeData() is called with the sub index of the HWObject set to the index that has been changed.

When the IGQ fires, I can see the transformation called for each element in the array in turn. However, writeData() is called only once for the whole array, with the HWObject sub index set to the last item.

Clearly I am doing something stupid, but I cannot figure out what it is.

In Mapper.addDpPa() I call setDLen() to set a buffer sufficient for the whole array. But in the Transformation.toPeriph() call, the subix parameter is always 0, which I suspect is a clue to my error.

Hints warmly received.

Regards

Will

willw
Posts:22
Joined: Thu Nov 19, 2015 4:40 pm

Re: Writing a Driver: transmitting the contents of multiple output DPs in one packet

Post by willw »

For the record, this problem behaviour - calling writeData() only once for an array of elements - has been confirmed as a bug by tech support, and a fixing patch is expected to be issued in due course.

9 posts • Page 1 of 1