Unity Pro Daily Counter?

tjdwlgns612

Member
Join Date
Jun 2016
Location
Georgia
Posts
5
Hey all,

I am trying to make a code in Unity for a "daily counter".

So I have a variable that steadily increases over time.
I simply want daily values out of this - as in, how much has it gone up by in a whole day?

So if on Monday 0:00 it was 1200, and tuesday 0:00 it was 2000, the daily value for that day would be 800.

I've tried using the MOVE and RESET and SUB but keep getting myself stuck in a loop.

Any ideas?
 


12.00 clock ------------------------------------
--|P|---------------------|daily_count:= Count-Count_old |
| ------------------------------------
|
| -------------------------------------
--------------|Count_old:=Count |
-------------------------------------


For counter overruns, you need to check if counter (at 12.00 clock) have smaller value than old value 1 day ago. If so you need to calculate daily count differently. (daily_count:= xx - Count_old + Count)

if you want save different counts of every day, you need also week day and copy daily count to different memory area.



 
Thank for the reply!

I was actually looking for a use with function blocks. I figured it out though!

This might seem like a hard way to do it, but if anyone wants to know how...


1) CTU block that counts up every time at midnight (until 2).
2) MOVE block that moves the value at midnight.
3) R_TRIG block that resets the CTU block every other day.
dG4pCRC


I essentially put two of these, one counter starting a day after the other. And then I just subtracted the moved values from one another (whichever one was bigger) and got the daily value!
 

Similar Topics

Hello, I am using Unity pro V15. I have Quantum CPU 671 and Ethernet NOE 77101 configured. I have configured IO scanning on NOE. I have attached...
Replies
5
Views
137
HELLO MY FRİENDS ı have problem. ı tought you can solved thıs problem for me. First of all When I checked all the cable connections of the...
Replies
0
Views
381
Hi All, I haven't installed Unity Pro in years and needed to install it recently. I initially tried installing Version 11.1 and the whole...
Replies
3
Views
631
Hello i want to implement a Read_var / Write_var functions to communicate with a modbus tcp device at the moment i use the unity simulator at the...
Replies
4
Views
1,849
Hi, I've exported a PL7 application to the .FEF file succesfully. Imported the .FEF file in my Unity Pro project, but two of the five sections in...
Replies
0
Views
752
Back
Top Bottom