The transducer acts as a pressure regulator/reducer,...
The penny drops
.
One thing to remember is that a pressure regulator can only add to the pressure; lowering the setpoint (current signal to the I/P transducer) will not correct any overshoot in the system (assuming the system is closed i.e. pump is stalled).
Also, I changed my mind in the way I wanted to actually pump the system. ... we can calculate how much current to send to the transducer to get the wanted pressure output in the pump. We can do this by taking the HMI pressure setpoint and dividing it by 16, which should give us the theoretical pressure that the transducer needs to output to achieve that pressure.
The actual ratio at stall will be lower. There is also the psig-to-psia conversion (you want to test at a pump discharge setpoint in psig, but the ratio is pump-discharge-psia/air-psig. So if you want 145.3psig at the pump discharge, and calculate 10psig (=160psia/16 = (145.3 + 14.7)psia / 16) - 5.333mA as the I/P transducer setpoint, the pump will actually stall below that target discharge pressure. So you may need to run it up to that pressure, wait for it to settle, then increase the transducer signal gradually.
[Now] I know what to do, [but] executing it is a different task.
This is a linear process and you are a second-year engineering student: everything can be reduced to multiplying by unity i.e. multiplying by 1.
The Click PLC has bit, SC7, that cycles at 1Hz, probably with a 50% duty cycle, so 500ms on, 500ms off. You can use the edge* of that bit to trigger any instruction(s)** to both execute on one scan in each second, and to not execute on any other scans of each second.
* look for the
Edge Contact instruction
** e.g. increase I/P analog output by the equivalent of 1psi of pump discharge
Since giving current to the transducer almost instantly increases the pressure at the other end. I would need to find a way how to slowly increase the pressure in the transducer ...
Initially sending a fixed signal equivalent to [Pump discharge target, psia]/16 to the I/P transducer will always stall below the target, as noted above; I don't think there is any reason to go slow initially.
Once that initial stall occurs***, then you want to increment the I/P signal the equivalent of a fraction a psi per second e.g. 0.0625psi/s. The actual value is irrelevant because the program will be monitoring the pump discharge pressure via the pressure sensor's analog input, and choosing when to stop based on that.
If we scale the analog output to be 0-1920psi, then we can actually work in units of discharge pressure for the analog output to the I/P.
*** detecting the stall is another matter but not overly complex, even a 30-50s timer may be good enough; the detection of that initial stall also initiates a new sequence step.