Hi,
We do the scaling manually.
Determine the minimum and maximum expected values of both states and cost elements and and rescale your equations such that they are within the same range.
You ofcourse need to retune weights afterwards
OSQP has a built in problem scaling, which you might be able to adapt, but I have not looked into how it works. It is described in https://arxiv.org/pdf/1711.08013.pdf section 5