Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
TpsParserFunction not working if one of input variables is marked as "ReadOnly"
November 30, 2015
10:55, EET
Avatar
Luca Pretti
Member
Members
Forum Posts: 4
Member Since:
November 25, 2015
sp_UserOfflineSmall Offline

The TpsParserFunction component works perfectly if all input variables are writable.
When you mix “read only” and “writable” variables, calculation is not fired anymore when the writable variables change but only when read only ones change.

To reproduce the issue you can drop on a form a TpsParserFunction and three TpsBool.
Set the first TpsBool variable as “Readonly”.
Drop two TpsCheckbox on the form and connect them to the first two TpsBool components.
Drop a TpsLabel and connect it to the third TpsBool.
Drop on the form also a button to toggle the value of the read only TpsBool (using the SetPropValue method).

Double click on the TpsParserFunction and add the first two TpsBool variables as inputs for the component.
Set the output property variable of the component to the third TpsBool (the result of calculation).
Set the Expression property of the component as ‘a*b’ (this is an ‘AND’ combination between input variables).

Run the application.
Toggle the value if the read only variable by pressing the button.
Check the second check-box and the result of the function will remain “False” (it should turn to “True”).
When you change the value of the read only TpsBool (pressing the button repeatedly) the result changes according to the espression we have set.
If you just toggle the check-boxe linked to the writable TpsBool nothing happens.

November 30, 2015
12:12, EET
Avatar
Luca Pretti
Member
Members
Forum Posts: 4
Member Since:
November 25, 2015
sp_UserOfflineSmall Offline

—————UPDATE————–
Making some more tests I found that the problem is not connected to the read only property of the tag but arises when the SetPropValue method is called for the first time (and this is required for changing the value of a read only tag).

So, referring to the test I described in the previous post, to reproduce the problem is enough to use the SetPropValue method on one tag (even if all the inputs variables are marked as writable).
From that moment to fire the calculation in the TpsParserFunction component you will be forced to use that method and nothing will be fired if you just use the check-box user interface or the OPCProvider address-space via an OPC client.

December 1, 2015
11:11, EET
Avatar
Luca Pretti
Member
Members
Forum Posts: 4
Member Since:
November 25, 2015
sp_UserOfflineSmall Offline

——————-UPDATE——————-
The same identical problem appens with the TpsFunction component.
If you set one of the input variables with the SetPropValueAt method all the triggers do not work anymore (and the Calc event is not fired) unless you use the SetPropValueAt method again.
If the variables are set from the AddressSpace (in an OPCServer application) or by the U.I. all the triggers do not fire.

December 1, 2015
15:38, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Sorry for the delay in responding.

I got your sample program by email and that helped to solve the issue. You are calling SetPropValueAt using ‘Now’. This “breaks” the function since it is also using the timestamps to verify tif the change is handled already – and only reacts to newer values. But Sentrol uses UTC timestamps instead of local timestamps in general, and you must also use ‘UTCNow’ (in PsUtils unit) instead of ‘Now’ when you define the timestamp for SetPropValueAt.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
12 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1