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: 1026
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: 1919

Currently Online:
25 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 727

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1