Thread Content
Dear experts, I have a set of useless S7-200 units. There’s a flow accumulation controller on site that needs to be modified. The flow meter there provides a 4-20MA signal continuously; once this signal reaches the set value, a DO signal is generated, which in turn controls the pump to stop or the valve to close. In the next cycle, when the start button is pressed, the flow meter automatically resets and starts accumulating values again, and this cycle repeats. How should this PLC program be written? handshake
Based on your description, the program logic involves performing accumulation—comparing the accumulated value with a set value—and outputting the result to DO. To carry out the accumulation, the measured flow rate is first converted into an actual flow rate; simply put, an addition is performed once per second. Place it in a fixed tag, and increase the actual flow rate once per second. For resetting, create a button to enter a value from 0 up to a fixed range; compare this value with the preset value. Connect the cumulative value and the preset value to the two input pins respectively. You can achieve this by using an appropriate comparison module, and then output a BOOL value to the DO terminal – this step is quite simple
Based on your description, the program logic involves performing accumulation—comparing the accumulated value with a set value—and outputting the result to DO. To carry out the accumulation, the measured flow rate is first converted into an actual flow rate; simply put, an addition is performed once per second. Place it in a fixed tag, and increase the actual flow rate once per second. For resetting, create a button to enter a value from 0 up to a fixed range; compare this value with the preset value. Connect the cumulative value and the preset value to the two input pins respectively. You can achieve this by using an appropriate comparison module, and then output a BOOL value to the DO terminal – this step is quite simple
The general programming approach is as follows: Initialize the data (reset the cumulative value), enter a loop (read the AI signal, convert it to actual values, accumulate them, and compare them; if the conditions are met, exit the loop), set DO to 1, reset the cumulative value, wait for a delay, set DO to 0, and then return to the loop.