Modelling a Pressure Regulator in Simscape

9 views (last 30 days)
Hasan
Hasan on 20 Aug 2025
Answered: Shantanu on 4 Sep 2025
Hi, I am trying to model a pressure regulator in simspace, but I could not manage to connect mechanical system to fluid system. I used single acting actuator and connect it to matlab function that has a function form all the "to workspace" blocks how can I fix the system I attached the picture of the systems.
% Compute spring force (negative due to opposing motion)
F_spring = -x * (k1 + k2) + F_preload;
% Compute pressure forces
F_pressure = P_out * A_outlet + P_atm * A_atm - P_sen * A_sen - P_in * A_inlet;
% Compute friction force
F_piston = mu * A_pis * P_sen;
F_poppet = mu * A_pop * P_in;
F_friction = sign(v) * (F_piston + F_poppet);
% Net force (sum of spring, pressure, and friction forces)
F_net = F_spring + F_pressure - F_friction;
% Note: m_tot * x_ddot = F_net should be solved externally (e.g., in Simulink)
end
  1 Comment
Yifeng Tang
Yifeng Tang on 25 Aug 2025
I want to first make sure that you indeed need to model the mechanical motion of the valve spool for your application. If your focus is on modeling the behavior of the valve in a gas network, you should be able to use components from Simscape Fluids to model the regulator. If you could include a diagram of the valve you want to model and some description of its intended behavior, the community may be able to help you better. It's hard to tell what the proper modeling approach is from a picture of a model that's not working yet :p

Sign in to comment.

Answers (1)

Shantanu
Shantanu on 4 Sep 2025
Hello Hasan,
Based on the model image provided Simscape requires physical connections between components, but given model is trying to use standard Simulink signals to control a physical system, I can provide a few suggestions
1. Remove the MATLAB Function and Workspace Blocks and replace their logic with physical components from Simscape.
2. Use a Translational Spring for the spring force and preload.
3. Use Translational Mechanical Converter (IL) blocks to convert each pressure (P_in, P_out, etc.) into a force on the mass.
4. Use a Translational Damper for losses.
5. Use a Mass block from the Simscape library to represent the total mass of the moving poppet assembly.
6. Add a Mechanical Translational Reference block to serve as the ground.
7. The sensor outputs a physical signal. Use a PS-Simulink Converter to change it into a standard Simulink signal.
This will allows the Simscape solver to correctly handle the underlying physics (F_net = F_spring + F_pressure - F_friction), leading to a more accurate and stable simulation.
Hope this helps.

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!