CR4® - The Engineer's Place for News and Discussion®


Previous in Forum: Fuel Gas Volume Flow Compensation Formula   Next in Forum: Signal Isolator
Close
Close
Close
3 comments
Member

Join Date: Oct 2014
Posts: 5
Good Answers: 1

Advantech WebAccess Timer Script

04/03/2017 2:33 PM

Hi There,

I'm trying to program some simple logic using scripts in Advantech's WebAccess.

The script can be in either Java, VB or Tcl.

I have basic (as in rudamentory) programming skills from back in the day when computer screens where green! -however as the task is pretty basic I think I can manage with a little assistance in the syntax -i have a good grasp of the logic and am happy to build it one brick at a time.

Would really appreciate it if anyone with experience in using webaccess could assist.

I have a logical event and i want to measure the time (in seconds or minutes) since that event occurred.

My script reads as follows:

if {R1_A1} then {SETVAL @timer=[GETVAL %TTMTIME]}

"timer" is my variable i want to use to record the time of the event "R1_A1".

I want my timer to count when R1_A1 goes to false so I can leave my "alarm" activated for 5mins after the event.

i.e. a DELAY_OFF timer.

...but so far the value of my timer only ever reads 0.00.

I was planning to then incorporate something like...

if %TTMTIME-timer >= 5mins... but i think the syntax of the above is incorrect so i can't progress past this stage.

I have tried without the GETVAL & without @.

fyi: my timer is an AccPoint (Accumulation Tag) and I have used %TTMTIME as it's Sorce tag.

I hope someone can help.

Ian.

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Comments rated to be Good Answers:

These comments received enough positive ratings to make them "good answers".
2
Member

Join Date: Oct 2014
Posts: 5
Good Answers: 1
#1

Re: Advantech WebAccess Timer Script

04/03/2017 5:11 PM

Eureka! -Webaccess allows me to specify how often a tag is recalculated, so i just need a calculated tag called count, incremented +1 each calculation with recalculation interval set to 1sec. i have a counter.

All my script needs to do is check if count<300 (5 mins) & keep Alarm status true.

Each time the event occurs the counter is reset to zero.

Darn! -been messing with clocks & system variables all day and the answer was so simple!

Register to Reply Good Answer (Score 2)
Guru

Join Date: Sep 2016
Posts: 767
Good Answers: 8
#2

Re: Advantech WebAccess Timer Script

04/05/2017 10:25 AM

I'm sorry we've been busy, lately.

Register to Reply Score 1 for Off Topic
Guru
Engineering Fields - Mechanical Engineering - New Member Fans of Old Computers - TRS-80 - New Member Popular Science - Weaponology - New Member Safety - Hazmat - New Member Hobbies - Fishing - New Member United States - Member - New Member

Join Date: Apr 2012
Location: Detroit MI, USA
Posts: 2109
Good Answers: 213
#3
In reply to #2

Re: Advantech WebAccess Timer Script

04/05/2017 6:15 PM

My god man, why????????

__________________
How we deal with death is at least as important as how we deal with life. --CAPTAIN KIRK, Star Trek II: The Wrath of Khan
Register to Reply Score 1 for Off Topic
Register to Reply 3 comments
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Comments rated to be Good Answers:

These comments received enough positive ratings to make them "good answers".
Copy to Clipboard

Users who posted comments:

gutmonarch (1); Ian T (1); JPool (1)

Previous in Forum: Fuel Gas Volume Flow Compensation Formula   Next in Forum: Signal Isolator

Advertisement