MATLAB: How can i simulate this example in simhydraulic ( Mass act on the rod of hydraulic cylinder )

SimscapeSimscape Fluids

Best Answer

Hi Ahmed,
here is some information, that might help you.
1) Your first model is the correct approach in general. However, I would replace the hydraulic reference with a Constant volume block and maybe insert a small resistance (constant hydraulic orifice). Without the resistance, the system is getting very stiff and the variable step solver might have issues when trying to reduce the step size.
2) Your second approach wont work, as Simscape does not take gravity into account.