No!
Measurement takes me state of relays.
I don't understand. Instead of trying to define what you want to do in terms of code, try describing where the 4 sensors are, what the 4 relays control, and under what circumstances each relay should be turned on.