Posted 28 Jul 2019 (edited) Hi, very new to PLC programming and desperately looking for some help to finish my project! I need to program a pump to run based on the level in a holding tank. The start/stop set points change throughout the day based on the time. For example, function for the start set point is 1.15372×10^-6 x^6 - 0.000114068 x^5 + 0.00448866 x^4 - 0.0883477 x^3 + 0.877893 x^2 - 3.57417 x + 7.5, where x is in hours. How can I access the PLC time (current hour and minute) so I can use them to calculate the set points? Does Unity Pro XL have pre-defined variables for these? Edited 28 Jul 2019 by Gville vague title Share this post Link to post Share on other sites
Posted 28 Jul 2019 See help about %SW51 %SW51 = 16#HHMM 1 person likes this Share this post Link to post Share on other sites
Posted 28 Jul 2019 Yes, I did find that last night though now I'm running into another issue. I would like to separate the hours and minutes so that I can have a single Real value for the hour of day. I found the LEFT_INT and RIGHT_INT blocks to separate the the data from the string, but when I change from Integer to String I get some additional data in front of my number (+0) which is making it hard to get to the hour value. How can I either remove or ignore the +0 prefix? Share this post Link to post Share on other sites
Posted 28 Jul 2019 MinutesHours := BCD_TO_INT(%SW51); Hours := INT_TO_REAL(MinutesHours/100); Minutes := INT_TO_REAL(MinutesHours MOD 100); 2 people like this Share this post Link to post Share on other sites
Posted 18 Nov 2021 I have a totalizer. I want to rest this value every day at midnight - Daily totalizer, and rest same value every month - Monthly totalizer Share this post Link to post Share on other sites
Posted 18 Nov 2021 Yes, I found it But I have an issue SW not working with me Share this post Link to post Share on other sites
Posted 19 Nov 2021 Have you checked in your cpu if your real time clock has an actual value in it? Share this post Link to post Share on other sites