Building a math model of a 4-way valve