- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » How to change x axis in OMEditor plot?
How to change x axis in OMEditor plot?
How to change x axis in OMEditor plot?
Hi,
Is the OMEditor capable of doing the following things? And how?
1. For the plot, change the axis from time to other variables, so that I can plot like pressure vs length of a pipe
2. can I change the value of a variable or parameter during the simulation period? For example, a pump runs at 1000 rpm for 5 min and then 600 rpm for another 5 min then 1000 rpm again for another 5 min through the whole simulation period; Or the pump stops for 5 second in every 15 sec.
Thanks
Re: How to change x axis in OMEditor plot?
Hi,
1. Yes, in the toolbar click on the plot parameteric tool button, it will open the new plot window then you can select two variables for plotting.
2. This can be done via interactive simulation but unfortunately interactive simulation is broken right now and I can't tell you when it will be available again. However, you can install some old OpenModelica like 1.7 or 1.8 and can run interactive simulation.
Adeel.
- adeas
- 454 Posts
Re: How to change x axis in OMEditor plot?
You can also do the second part by extending your model and
using when equations to change the variables as you want.
Note that you'll have to change the parameters to variables
as parameters are constant during simulation.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: How to change x axis in OMEditor plot?
Thanks for the response. For the first part, yes I can plot figures between 2 variables, but I don't think the answer is shows is right.
In my model I plotted pressure loss in a pipe vs pipe length it gives a line corresponding to a constant number, however the x axis as the pipe length is not right; when I plotted pipe length vs time, it should give a line corresponding to my pipe length, but instead it gives strange curve with huge peaks, and every time I plotted pipe length vs time it gives different shape of curves.
Here is the code of the model:
model test_tank
extends Modelica.Icons.Example;
//incompressible case PD = f(m_flow)
Modelica.SIunits.MassFlowRate m_flow = pipe.flowModel.m_flows[1] "Input mass flow rate";
Modelica.SIunits.Pressure DP1 "Output turbulent flow pressure drop";
Modelica.SIunits.Pressure DP2 "Output laminar flow pressure drop";
Real DPT(fixed = false);
inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, use_eps_Re = true) annotation(Placement(visible = true, transformation(origin = {55.4281,65.428}, extent = {{-10,-10},{10,10}}, rotation = 0)));
Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_turbulent_IN_con dp_turbulent_in_con1(L = pipe.length, d_hyd = pipe.diameter, K = pipe.roughness) annotation(Placement(visible = true, transformation(origin = {-80.3742,-22.6106}, extent = {{-10,-10},{10,10}}, rotation = 0)));
Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_laminar_IN_var dp_laminar_in_var1(eta = Modelica.Media.Water.ConstantPropertyLiquidWater.eta_const, rho = Modelica.Media.Water.ConstantPropertyLiquidWater.d_const) annotation(Placement(visible = true, transformation(origin = {-13.6273,-68.5371}, extent = {{-10,-10},{10,10}}, rotation = 0)));
Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_laminar_IN_con dp_laminar_in_con1(d_hyd = pipe.diameter, L = pipe.length) annotation(Placement(visible = true, transformation(origin = {-46.2926,-62.7255}, extent = {{-10,-10},{10,10}}, rotation = 0)));
Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_turbulent_IN_var dp_turbulent_in_var1(eta = Modelica.Media.Water.ConstantPropertyLiquidWater.eta_const, rho = Modelica.Media.Water.ConstantPropertyLiquidWater.d_const) annotation(Placement(visible = true, transformation(origin = {-80.8138,-52.2303}, extent = {{-10,-10},{10,10}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank2(crossArea = 1, redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, nPorts = 1, height = 11, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1, height = 0.5)}, level_start = 0.0000000001) annotation(Placement(visible = true, transformation(origin = {65.9816,17.5947}, extent = {{-20,-20},{20,20}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank1(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, nPorts = 1, crossArea = 1, level_start = 10, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, height = 11) annotation(Placement(visible = true, transformation(origin = {-70.2533,20.1745}, extent = {{-20,-20},{20,20}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, length = 20, diameter = 0.1, height_ab = 0) annotation(Placement(visible = true, transformation(origin = {22.6875,-21.4505}, extent = {{-10,-10},{10,10}}, rotation = 360)));
Modelica.Fluid.Machines.PrescribedPump pump(checkValve = true, N_nominal = 1000, redeclare function flowCharacteristic = Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow(V_flow_nominal = {0,0.25,0.5}, head_nominal = {100,60,0}), use_N_in = false, nParallel = 1, energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, V(displayUnit = "l") = 0.05, massDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater) annotation(Placement(visible = true, transformation(origin = {-27.4994,-20.8731}, extent = {{-10,-10},{10,10}}, rotation = 0)));
equation
connect(tank1.ports[1],pump.port_a);
connect(pump.port_b,pipe.port_a);
connect(pipe.port_b,tank2.ports[1]);
//incompressible case
DP1 = Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_turbulent_DP(dp_turbulent_in_con1, dp_turbulent_in_var1, m_flow);
DP2 = Modelica.Fluid.Dissipation.PressureLoss.StraightPipe.dp_laminar_DP(dp_laminar_in_con1, dp_laminar_in_var1, m_flow);
DPT = DP1 + DP2;
end test_tank;
thanks
Re: How to change x axis in OMEditor plot?
If you think the results shown are wrong then file a bug report here https://trac.openmodelica.org/OpenModelica/
However, I plotted pipe length over time and it always shows a constant value of 20.
Adeel.
- adeas
- 454 Posts
Re: How to change x axis in OMEditor plot?
I tried to upload the screenprint of the 2 figures I got at the "attachment", but somehow the website does not allow me to do so.
In my OMEditor, if I plot "Time" as x axis and "Pipe Length" as y axis, it gives 2 huge peaks (1e+277) and other part remains 0, and every time I plot, the figure is different. If I plot "Pipe Length" as x axis and "Time" as y axis, it gives a constant of 20 which looks correct and reasonable. But plotting time vs pipe length actually does not make any sense.
Re: How to change x axis in OMEditor plot?
You mean the trac site doesn't allow you to upload the images? You can send the screenshots to me and i will add the ticket to the tracker. You can later edit it.
Btw which OpenModelica revisions are you using?
Adeel.
- adeas
- 454 Posts
Re: How to change x axis in OMEditor plot?
you can send the screenshots to adeel.asghar at liu.se
Adeel.
- adeas
- 454 Posts
Re: How to change x axis in OMEditor plot?
Anonymous users are not allowed to attach files while creating the ticket. But you can create the ticket and then go on the ticket to attach the file.
Adeel.
- adeas
- 454 Posts
Re: How to change x axis in OMEditor plot?
I meant I was trying to post the figures at here - the forum. So I hit the "Attachment" botton and uploaded the pic, but then nothing happened.
The version I am using is the nightly build version numbered 16072
The ticket has been added as well as 2 pics of figures.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » How to change x axis in OMEditor plot?