We are working on a PID control loop, using a level to control valve open or close, and want the system works in following way:
Who are we?
1. PV is greater than SP:
when PV is far away to SP, the Valve will be 100% close, as quick as possible, when the PV is closing to SP, the valve will be slightly open, for example, at least 1% open.
OK so the valve controls the inflow. Why must the valve only be open 1% when the error is close to 0? if the error is close to 0 then you want to maintain level and to do that the inflow must match the outflow. What if the outflow 10% of the valves capacity? Then the valve needs to be open 10%.
A tank is an integrating system. Level is the integration of flow divided by the area.
2. PV is less than SP:
When PV is far away from SP, the valve will be 100% open, as quick as possible, when the PV is closing to SP, the valve will be slightly open, for example, at least 1% open.
Since the level can't change instantly there should be no as quickly as possible. The valve should open up if the outflow is less than the inflow and start to close if the outflow is less than the inflow.
That means there is a dead band around the SP, when the PV fell into dead band, the valve will be slightly open.
Why do you need a dead band?
How to tune the PID loop?
You don't tune a PID loop. You tune a system. First you must understand the system. In this case you must understand that it is an integrating system and to maintain flow the inflow must equal the outflow.
Since you provided little information lets say your tank level is calibrated in % so when the fluid is at the top the fluid level is at 100% and when empty the fluid level is at 0%.
Now lets say the set point is at 50%. Now I would ask how much error can your control tolerate? Lets suppose that you can tolerate a 10% error in the fluid level so that at 60% the valve must be shut or open 0% and when the fluid level is at 40% the valve must be open 100%. I think it is easy to see that the controller or P gain must be 5 because the flow must increase 100% for a error change of -10% to +10% in the level.
If maintaining an error within 10% is OK then we are done. If you want to reduce the steady state error to 0 then we must use the integrator time constant.
I will write more when we get more information.
BTW, if you work for someone then tell your boss he is fired. You better be a student because I would expect your boss to know the answer to this.