You may follow this example on how to make a N-way valve manually.
Except For the restriction block, I would recommend you use an Orifice (2P) block. It's a bit more stable than the local restriction, in my experience.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!