TozoM8 Posted October 21, 2019 Report Posted October 21, 2019 Hi again. I am trying to figure out how to calculate off time. If I use SI31 I can display the current time. Every time the machine is running I have a TA timer counting up. I want to deduct 6 hours of the SI31 (production shift starts at 6:00am) but when I deduct 600 it will display as an MI eg. 7:15 will be 115. How can I display that it time as 1:15? Thanks in advance!
MVP 2023 Flex727 Posted October 21, 2019 MVP 2023 Report Posted October 21, 2019 Did you try the HMI element called "Time Function"?
MVP 2023 Joe Tauser Posted October 21, 2019 MVP 2023 Report Posted October 21, 2019 You need to break your 115 into two pieces, 1 and 15, and display them separately separated by a ":". All you need to do is divide your accumulated time by 100 to get hours and then immediately move the remainder (SL 4) into another register for minutes. Use leading zeros on the minute register. If you post your code and tell us which register is the off time (containing 115) I'll hack it in for you. Joe T.
TozoM8 Posted October 22, 2019 Author Report Posted October 22, 2019 Time function was a no go. It shows 0:2E instead of 2:30 Joe's suggestion worked. I had to use leading spaces on the hour display otherwise it looks like this 2 :30
TozoM8 Posted October 29, 2019 Author Report Posted October 29, 2019 So with the data table I can show current date, current time, (RTC To ASCII) then I deduct 600 (6 hours) from SI 31 to an MI then with Num To ASCII I can Plug that MI into the data table. These all work. Now I have to figure out how to plug in the machine run time. I have a TA preset to 24:00:00;00. On the plc screen I have that timer set as type current, display elapsed and after 12 min , it will show 12 min on the plc and 23:48:00;00 on the ladder timer. With the T To ASCII it will show 00:00. What would be correct was to have the machine run time in the data table?
MVP 2023 Ausman Posted October 29, 2019 MVP 2023 Report Posted October 29, 2019 Tozo, perhaps you need to change tack and consider using UTC. Storing UTC under certain parameters being met, and then doing compares when others are met lets you arrive at intervening times very easily. For OFF time, on initial start you simply do a compare to a stored UTC that is updated every second during normal running, and then derive the time from the result. You might be surprised at how useful UTC is against RTC in some instances. cheers, Aus.
TozoM8 Posted October 29, 2019 Author Report Posted October 29, 2019 So as it turns out T-> ASCII works. T-> A-TA (only runs when machine is on) B-(offset in vector=0) C-HH:MM E-(elapsed) ASCII MI to column type string (length 10) Reset TA when SI32 is different from stored. (stored when they start the machine)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now