8/13/2015 12:57 PM | |
Posts: 5225 Rating: (1194) |
Maybe it is not needed. Please step one step back with me. PID controllers in a PLC use a sampling method and (discrete) algorithm. At regular intervals a measurement is made. By mathematical formula this sample measurement is compared to what is asked (setpoint) and what has happened before. The resulting output try to control the process with a "prediction" of what is required at that moment to aim to the requested setpoint. The digital version of the PID keeps in mind what is the time intervals between sampling/calculations. That time is the "dt" in the pseudocode above. It is preferred to have "dt" a fixed period. The scan cycle of OB1 cannot give us a good constant time period, where an interrupt can. In the PLC's case you will have..
[2]------------------------------------------------------------- You could imagine the following happening: * OB1 related tasks are busy with something * interrupt to OB1: "remember what you were doing" * interrupt to OB1: "halt your process for a little while" * interrupt does its job * interrupt to OB1: "remember what you were busy with?.. continue with that" * OB1 related tasks continue as if nothing happened. You may have several interrupts for your main cycle and the PLC will still execute all the code. Trouble comes when the PLC spends too much time on interrupts or when interrupts overlap. Please do not fear using the interrupt functioning. It will do what you need. With that I leave you in the expert's hands to cover the technical stuff. (smile) w |
8/13/2015 5:24 PM | |
Posts: 70 Rating: (1) |
Hi William_B, Firstly thank you for the help and the explanation Now I realize why the cycle interrupt, this is, the PID must always be active for it to work properly when necessary to control the temperature. But for example can I use a boolean variable as a condition to active the PID (in the cycle interrupt)? Its just because my system will always be active (24h per day) and I only will use the shower/PID for 8 hours. Can i turn it off during the rest of the time to save the valve and increase its service life? I think I must only use one interrupt (or at least hope) in my program and therefore should not occur overlap. You said that the cycle would halt the OB1 a while, whis will not stop the remaining functions that are running and controlling other processes, will it? Ouputs (relays and others) will continue to operate or will they stop for that period? Thanks again for everything |
Follow us on