11/26/2020 11:20 AM | |
Joined: 6/24/2013 Last visit: 5/24/2024 Posts: 1606 Rating: (415)
|
Hi You can use fuinctuons in Extended Instruction, time of day Assume you use DTL for date and time there is T_ADD instruction which adds 2 time variables: date and time to a long time (64bit time in ns) you can add a fixed constant of long time (format for constant is LT#TTTdUUhVVmWWsXXXmsYYYusZZZns where see screenshot3 |
This contribution was helpful to3 thankful Users |
11/26/2020 11:37 AM | |
Joined: 10/15/2016 Last visit: 3/27/2024 Posts: 89 Rating: (2) |
Hi, thank you for the quick response. I forgot to mention that it is on a 1200 series so no LTime available. |
11/26/2020 12:18 PM | |
Joined: 6/24/2013 Last visit: 5/24/2024 Posts: 1606 Rating: (415)
|
Hi In this case you can use version with add Time. Time constant syntax is similar: T#UUUdVVhWWmXXsXXXms and is limited to 21 days ish As a workaround for 60 days just repeat T_ADD 3 times so if you have setpoint as integer in days / minutes / etc. 1. copy setppoint.days to a separate variable, call it Days 2. do loop (possible with LAD - use compare & jump) explanation to while: then assuming setpoint is in days/minutes/seconds/milliseconds calculate last addition [variable is Time which intetrnally is dint in ms] Added_Time:=L#86400000*Days + L#60000*Hours + L#1000*Seconds + ms then do last T_ADD Example implementation in attached screenshot. |
Last edited by: Piotr.M at: 11/26/2020 12:30:07Last edited by: Piotr.M at: 11/26/2020 13:07:13 |
|
This contribution was helpful to1 thankful Users |
11/26/2020 12:36 PM | |
Joined: 10/15/2016 Last visit: 3/27/2024 Posts: 89 Rating: (2) |
Thank you so much I will get onto this now. |
8/24/2023 2:59 PM | |
Joined: 5/20/2019 Last visit: 5/2/2024 Posts: 13 Rating: (9) |
Read system Time using RD_SYS_T convert system time to date using DTL_TO_DATE convert system date to dint using DATE_TO_DINT add your required days. convert total to date using DINT_TO_DATE. Here is the code: #tempError := RD_SYS_T(#currentDateTime); #tempCurrentDate := DTL_TO_DATE(#currentDateTime); #tempCurrentDateInDint := DATE_TO_DINT(#tempCurrentDate); #stateFinalDate := DINT_TO_DATE(#tempCurrentDateInDint + #day); |
Follow us on