Sodium Citrate

I know that the tri sodium citrate is a buffering agent and it helps in maintaining stable pH. But on what basis its quantity will be calculated. Please explain.

From past experience with gelatin dessert,Its not calculated but by empirical or experimental approach that depends on the required pH of the prepared food product that varies with the acidulant tartness ( single or combined acidulants).