Driver and smoothing

Find and share HowTos to various installations / configurations!
9 posts • Page 1 of 1
CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Driver and smoothing

Post by CyaNn »

Hello there,

I have experienced strange behavior with smoothing (flicker suppression) and Boolean value (WinCC 3.10).
The datapoint I used is initially filled by a driver I have written (A mobus communication driver over Serial connection)
The question I have is the following : should have to develope something special on my driver to manage smoothing or is it done by wincc after the data acquisition ?

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

Re: Driver and smoothing

Post by Gertjan van Schijndel »

Smoothing is normally handled after/by the 'DrvManager::toDp' call, so you should not have to develop something special for this. Unless you have a special driver, which has overridden this functionality.

Perhaps you could also try it the standard Modbus driver with an Ethernet-serial converter. And check if it has the same strange behavior.

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

Re: Driver and smoothing

Post by leoknipp »

Hello,

if value received from the driver shall be smoothed you have to add a _smooth-config at the dp-element where the input address is configured.
Smoothing is done by the driver and the event manager receives only smoothed values.

For details concerning the smoothing functionality please have a look at the WinCC OA online help at the explanation for the _smooth config.

Best Regards
Leopold Knipp
Senior Support Specialist

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver and smoothing

Post by CyaNn »

Gertjan van Schijndel wrote:
Smoothing is normally handled after/by the 'DrvManager::toDp' call, so you should not have to develop something special for this. Unless you have a special driver, which has overridden this functionality.

Perhaps you could also try it the standard Modbus driver with an Ethernet-serial converter. And check if it has the same strange behavior.
Thank you. It is the answer I expected !
So ok the smoothing mecanism is supported between the method toDp and the DB.... great !
I remember we already had experienced this strange behavior.

This is the parameters
Mode : Flicker suppression
Smoothing : 2000 ms (to feelthe difference)
Driver Polling : 50ms (to not impact the smoothing)

The first time the smoothing runs, it do the job correctly. It waits 2s before giving the value (it contact was held)
But after some time, the delay becomes aleatory; sometime it waits 2s, sometime less (like 300ms).... it is really strange.

Another problem with this smoothing concept we have is that we cannot manage in what transition we are.
For example, with a boolean : true to false or false to true has not the same signification if we are supervising modbus contacts.

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver and smoothing

Post by CyaNn »

Gertjan van Schijndel wrote:
Smoothing is normally handled after/by the 'DrvManager::toDp' call, so you should not have to develop something special for this. Unless you have a special driver, which has overridden this functionality.

Perhaps you could also try it the standard Modbus driver with an Ethernet-serial converter. And check if it has the same strange behavior.
I am working again on this strange smoothing behavior.
I am searching into my driver code and nothing appears that overload the toDp method.

This is the part of my driver source code that store data to dp.

Code: Select all


HWObject* SerialModbusHWService::storeToDB(QString address, PVSSchar *value, bool invalid) {
	HWObject *obj = new HWObject();

	obj->setAddress(address.toStdString().data());
	obj->setDlen(ARRAY_SIZE(value));
	obj->setData(value);

	if (invalid) {
		obj->setUserByte(0, 1);
	} else {
		obj->setUserByte(0, 0);
	}
	
	HWMapper* mapper = (HWMapper*)DrvManager::getHWMapperPtr();
	if ( mapper ) {
		HWObject* addrObj = mapper->findHWObject(obj);
		if ( addrObj ) {
			try {
				DrvManager::getSelfPtr()->toDp(obj, addrObj);
				DEBUG_DRV_USR2("Message stored to DB " getAddress()

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

Re: Driver and smoothing

Post by Gertjan van Schijndel »

Are you passing an array with different sizes to 'DrvManager::toDp'? In that case the smoothing could fail.
I have no experience with passing arrays, but I guess you would have to use the functions 'HWObject::setNumberOfElements' and 'HWObject::setSubindex'.

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver and smoothing

Post by CyaNn »

Gertjan van Schijndel wrote:
Are you passing an array with different sizes to 'DrvManager::toDp'? In that case the smoothing could fail.
I have no experience with passing arrays, but I guess you would have to use the functions 'HWObject::setNumberOfElements' and 'HWObject::setSubindex'.
No it is not an array.
What should I write to replace the

Code: Select all

obj->setDlen(ARRAY_SIZE(value));
?

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

Re: Driver and smoothing

Post by Gertjan van Schijndel »

According to the comment at the macro definition of 'ARRAY_SIZE', it should only be used on statically allocated arrays.

Perhaps you can take over the value from the 'addrObj' HWObject.

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver and smoothing

Post by CyaNn »

Thanks Gertjan , I will try it :)

9 posts • Page 1 of 1