6/18/2021 9:28 AM | |
Joined: 9/9/2014 Last visit: 7/11/2024 Posts: 246 Rating: (40) |
Hello all! There is a problem that I cannot understand, so I ask for help in solving it (if anyone has encountered a similar one) Initial data: CPU 1515-2 PN FW V2.8 6ES7 515-2AM02-0AB0 IM 155-6 PN ST FW V4.1 6ES7 155-6AU01-0BN0 DQ 16x24VDC/0.5A ST 6ES7 132-6BH01-0BA0 TIA PORTAL V16 In Program i have OB122 and OB86 Programm CODE: IF #bIN THEN #stCurrentOperTime.udOperatingMs := #stCurrentOperTime.udOperatingMs + #uiCycleTime; IF #stCurrentOperTime.udOperatingMs >= 3600000000 THEN #stCurrentOperTime.udOperatingHours := #stCurrentOperTime.udOperatingHours + 1; #stCurrentOperTime.udOperatingMs := #stCurrentOperTime.udOperatingMs - 3600000000; END_IF; END_IF; IF #bIN AND #stCurrentOperTime.bPastIN = FALSE THEN #stCurrentOperTime.dtlOnTime := #dtlCurrentDate; #stCurrentOperTime.bPastIN := TRUE; END_IF; IF #bIN = FALSE AND #stCurrentOperTime.bPastIN THEN #stCurrentOperTime.dtlOffTime := #dtlCurrentDate; #stCurrentOperTime.bPastIN := FALSE; END_IF; What is the problem: When the program is running, the block above is processed and counts the operating time of the equipment per hour. However, glitches appear during the execution of the program: When the equipment is turned on and off, I can see when and how long it was turned off or on Variable - stCurrentOperTime.dtlOffTime or stCurrentOperTime.dtlOnTime This variable contains data from a format variable - DTL dtlCurrentDate And it so happens that I see that the equipment is turned on - the number of milliseconds is being counted, but the data about when it was turned on or off was not recorded. That is, no data about the current date and time was passed to the variables. The reasons I think about why this might be happening: 1. the stCurrentOperTime variable is in the data block, and this is the structure that is marked as "retain" - Could these glitches be due to the fact that the structure is retained ??? 2. While the program is running, the PLC diagnostics reports that every 500-700 ms, there is an overload on the digital output module - short-circuit/overload That is, it appears and resets after 500-700 ms. Can these diagnostic messages cause interrupts in the program ??? For example call OB 86 ************** I will be grateful for answers and comments AttachmentCalcEquipOperTime.txt (145 Downloads) |
Best Regards |
|
6/28/2021 2:49 PM | |
Joined: 9/9/2014 Last visit: 7/11/2024 Posts: 246 Rating: (40) |
Yes, we understood each other. Thanks again for the clarification! |
Best Regards |
|
Follow us on