Controlling proportional valve with feedback

Hi everyone, I have a project where I'm controlling flow of water. I have flowmeter with impulse output which gives me current flow value and manometer. I have to control proportional valve to get some value of flow (it can change). Proportional valve can be controlled only with +12V, 0V and -12V. If I want to open it a little, I have to set +12V for a while and then change value to 0V. Total open of valve lasts about 10 seconds. Here is my algorithm but it's too simple because flow is non linear. It has to work with different configurations, which means I will need some calibration method.

  1. Calibration
  2. Measure how fast flow changes from pressure 6bar to 12 bar (max pressure is about 15bar) and get value of how much time you need to pass +12V to change flow of 1 litre/minute. Example: started with 6bar and 15l/min. After 3 seconds i get 12bar and 25l/min which means that increasing 10l/min lasts 3 seconds, so increasing 1l/min took 0.33s.

  3. Controlling

  4. Measure current flow

  5. Count difference between current flow and flow set

  6. Calculate time of signal: multiply difference with value from calibration and set +12V if current flow is too low or -12V if current flow is too high

  7. Set 0V when time of signal passed.

  8. Repeat Example: I want to set 20l/min, current flow is 12l/min. Difference is 8l/min so +12V signal should lasts 8*0.33 = 2.66s

It is very simple algorithm and it should consider non linearity of proportional valve - in first two seconds of open flow changes from 10 l/min to 11.5 l/min (it can't be completely closed) but in last two seconds it's change is from 18 to 30 l/min. How can I control it? I can't add any additional hardware. I was thinking about PID controller where I will pass current flow, flow to set and output will be time of +12v signal or -12V in case of negative output but configuration of my valve and many other things may change and adjusting all PID parameters manually is not a solution. Any ideas?

Where are the project specifications saying how far the measured flow rate is allowed to deviate from the required flow rate and how fast the controller must react to changes in set point value or pressure?

The interface description for your valve looks quite unusual - do you have a link to the data sheet?

Non linear signals should be linearized before input to the PID, the same for the output.

Post the datasheets for the valve and flow meter.