NHA2007400 09/2014 HOWTO | Product SoMachine Converting Data Type TIME into an Hour, Minute, and Second Count Retain for future use. Introduction SoMachine software uses the data type TIME in several function blocks for time display. For example, two hours, ten minutes, and three seconds displays as T#2h10m3s. SoMachine TIME_TO functions can convert TIME data types into integer or double-integer values. However, this only converts the time into a total value in milliseconds. Converting TIME into Hours, Minutes, and Seconds The following procedure shows the implementation of a function block that takes the TIME value and splits this into three separate variables that read the hour, minute, and second count. NOTE: The function block is written in Structured Text. 1 2 3 4 5 6 7 1. Take the time variable and then convert it to a millisecond count by using the TIME_TO_DWORD function: 2. Calculate the raw second count by dividing the millisecond count by 1000: © 2014 Schneider Electric All Rights Reserved SoMachine HOWTO | Product NHA2007400 09/2014 3. Calculate the raw minute count by dividing the second count by 60: 4. Calculate the second rollover value. Use the MOD function to calculate the remainder. Take the raw second count and MOD this with 60. This gives the second count value: 5. Calculate the hour count by dividing the raw minute count by 60: 6. Calculate the minute rollover value. Take the raw minute count and MOD this with 60 to obtain the minute count value: 7. Display the hour count: Function Block Implementation Schneider Electric USA, Inc. 18001 Knightdale Blvd. Knightdale, NC 27545 1-888-778-2733 www.schneider-electric.us 2 Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material. © 2014 Schneider Electric All Rights Reserved Schneider Electric and Square D are trademarks owned by Schneider Electric Industries SAS or its affiliated companies. All other trademarks are the property of their respective owners.
© Copyright 2024 Paperzz