Jump to content

When timer starts the activity, I need to assign one variable (process or shared variable, i don't know which one will be suitable) value as 1.


anbu bose

Recommended Posts

Dear Friends,

In my scenario, I have one process with timer starter activity. When timer starts the activity, I need to assign one variable (process or shared variable, i don't know which one will be suitable) value as 1.

Again If I starts the process second time, the same variable must be updated as 2. If I run the process another time, the same variable must be update as 3, like its goes on up to 24hours of the starter activity.

After 24hrs if I run the process , it must update variable as 1.

How do we achieve that. Kindly help on this.

ThanksBose

Link to comment
Share on other sites

  • 1 year later...

Hi Bose,

The attached project should address your scenario. You can adjust the timer's frequency to your needs.

Note that in case the engine stops, the "time difference" state will be lost. If this is a problem for you, you can use a file to keep track of the last state of the variable.

Hope this helps.

Link to comment
Share on other sites

Keep bumping the SharedVariable by 1 when timer wakes up, and while consuming the value from sharedVarialbe.... perform a modular division (1 mod 24 =1, 23 mod 24= 23, 24 mod 24 = 0, 47 mod 24=23, 48 mod 24 = 0, and so on).... this will keep resulting value always between 0 and 24 no matter how many years it run. Refer to this link for mod division --> http://www.miniwebtool.com/modulo-calculator/
Link to comment
Share on other sites

Just some consideration on all that:

1) This approach will not work if you have 2 engines running (might not be an issue if it's a timer).

2) As someone mentioned, this approach will not work if your engine dies.

Overall, I'm wondering if you could use the engine stats to for that and reset the counter after 24h of run.

Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...