Please consider registering

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, EEST
Luca Pretti
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, EEST
Luca Pretti
Forum Posts: 4
Member Since:
November 25, 2015
sp_UserOfflineSmall Offline

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, EEST
Luca Pretti
Forum Posts: 4
Member Since:
November 25, 2015
sp_UserOfflineSmall Offline

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, EEST
Jouni Aro
Forum Posts: 851
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: 267

Currently Online:
6 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1105

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1009

Posts: 4268

Newest Members:

user1290, gregp, mariohetheringto, normagalindo47, aurelia27u, isobel41d356980, michaeldegli, gqbdolores, kez1399, jaclynmcvay358

Moderators: Jouni Aro: 851, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 545, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 20, Markus Johansson: 19, Matti Siponen: 53, Lusetti: 0

Administrators: admin: 0