Simhydraulics: Pressure distribution over the entire circuit

Hello,
How do I plot the distribution of pressure, or any parameter, over a section of the circuitry at an instant in time? For example, I would like to know the pressure distribution on the exhaust circuitry of a double acting cylinder 10 milliseconds after the piston has reached the end of its stroke. Many thanks,
Paraic

 Accepted Answer

If you know the exact time range you want, you can tell Simulink to log data only in that range. For example, suppose you already know the piston hits its limits at 9.99 seconds, so you want to log data from times 10 to 11 seconds. To do this, you can
  1. Go to Model Configuration Parameters (Ctrl+E) > Data Import/Export Pane
  2. Set the "Output options" to "Produce specified output only" ( doc link )
  3. Set the "Output times" to your time vector to, e.g., 10:0.001:11
If you want this to be "smarter", you can
  1. Place a motion sensor on the cylinder and measure its position. Put this through a 10 ms Transport Delay block since you want to start logging 10 ms AFTER the event.
  2. When the output of that block is greater than the max piston displacement, have Simulink output "true" and then feed that into an Enabled Subsystem.
  3. Inside the Enabled Subsystem block, pass in the measured pressure value into, e.g., a To Workspace block.
Since the To Workspace block will be inside a subsystem that runs only when its control signal is true, you will essentially log data only after the piston hits its maximum displacement.
Now, if you want additional logic that STOPS logging after some time, you'd have to implement that as well...
- Sebastian

7 Comments

Thank you.
The question I am trying to ask is if I can generate one plot of the entire exhaust circuit pressure distribution at a given time. The piston example is good: the piston reaches max stroke at 20.7 seconds. Downstream of the double acting cylinder I have Segmented Pipelines, Elbows, Sudden Area Change, before reaching a 4 way-3 position directional control valve. If, say, each Segmented Pipeline is 5m in length with 10 segments in each is it possible to capture the pressure in each segment, elbow and sudden area change at time 20.71 seconds in a single plot?
Many thanks,
Paraic
Oh, I see! I've personally done this for Segmented Pipeline blocks where I extract the data from each segment and animate the pressure distribution over time -- so yes, it's possible.
The first thing you want to do is enable Simscape logging, if you haven't already.
Logging data for all the blocks in the model will give you access to all the pressure values; however, you have to parse through the data using the block name and hierarchy.
For example, if your data is logged in a variable named simlog:
pipe = simlog.Segmented_Pipeline;
t = pipe.ch_1.pressure.series.time;
p1 = pipe.ch_1.pressure.series.values;
If you will be varying the number of segments, you could try something as follows:
for i = 1:numSegments
p(:,i) = eval(['pipe.ch_' num2str(i) '.pressure.series.values']);
end
... And similarly for all other blocks in your model you care about.
As far getting the right time goes, you could do any of the following:
  • Use the output options I mentioned in my original post, and force data to be logged at your known time of 20.71. This requires you to know the time beforehand, but it's an easy solution if you do.
  • Take whatever data values come out and interpolate them in MATLAB
  • Set up logic on the cylinder's measured position, as I also mentioned in the first post. This will force Simulink to take additional time steps around the event you are looking for, thus increasing the likelihood that you'll get data right around the time without you having to know it beforehand. Here's a screenshot:
- Sebastian
Thank you very much. Much appreciated.
The system I am trying to model physically operates on the seabed, at water depths ranging from say 700m to 1500m. At the moment I have the response I would expect at surface in terms of pressure waves, propagation etc when the piston reaches the end of its stroke. Do you know how I could simulate a back pressure on the exhaust line which could mimic hydrostatic pressure at depth? The physical system is designed without check-valves from "T" port on the directional valve, and fluid discharges to sea. I have tried to model a check valve between T port and Hydraulic Reference, but the simulation does not converge possibly due to dry spots in the system architecture (downstream of the check valve) after the fluid pressure drops below the cracking pressure of the spring in the check valve.
Many thanks, Paraic
Does it work if you add a Constant Hydraulic Pressure Source in reverse before the reference block, whose pressure value is rho*g*h, where h is the depth?
Also, if you go the Check Valve route, you could get around the dry node by making sure you place a Constant Volume Hydraulic Chamber block at the problematic nodes. This additional fluid compressibility will make your model more realistic AND more numerically stable.
- Sebastian
Yes, the Constant Hydraulic Pressure Source works. Thank you very much. I had problems with convergence using the ode15s solver until I switched to ode23t. Any thoughts on this? Does this point towards a flaw in my model, or parameters?
Also, could you briefly (in layman's terms) explain the role of the "Flow Discharge Co-efficient" in the directional valve? I'm no wiser having read the description in the documentation.
Many thanks,
Paraic
I would say that's a pretty strong indicator of a design flaw. I'd watch out for other dry nodes to see if that's the problem. Basically, look for any junctions in the model that do not have a fluid volume next to them. Fluid volume comes from volume chambers and cylinders.
The flow discharge coefficient is basically an empirical "fudge-factor" explaining the difference between the actual orifice and an ideal one. I like the Wikipedia explanation of it:
https://en.wikipedia.org/wiki/Discharge_coefficient
If you transpose the equation to solve for the pressure drop, you basically see that the smaller the discharge coefficient, the bigger the pressure drop across the orifice -- or, in other words, the less ideal the orifice is.
A discharge coefficient of 1 would be an ideal orifice, and 0 would be a solid wall inside your pipe :)
In fact, it wasn't an issue with convergence. I was logging all block simulation statistics and had not enough RAM so results were never displayed nor was I able to access logged data. By logging only the blocks of interest I was able to run with solver ode15s without issue. I believe that was the problem anyway.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!