// Script to generate plot for documentation of
// function PressureLoss.Bend.dp_curvedOverall_DP AND dp_curvedOverall_MFLOW
// of FluidDissipation Library
//
// Generated by Thorben Vahlenkamp
// 29-09-2008
// last change: 27-05-2009
// XRG Simulation GmbH

currentDirectory = Modelica.Utilities.System.getWorkDirectory();
cd(Modelica.Utilities.System.getEnvironmentVariable("temp"));

translateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.Bend.dp_curvedOverall_DPMFLOW");

Advanced.StoreProtectedVariables:=true;

simulateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.Bend.dp_curvedOverall_DPMFLOW",startTime=0, stopTime=1, numberOfIntervals=50000, method="dassl", tolerance=1e-008, resultFile="dp_curvedOverall_DPMFLOW");

switchToSimulationMode();

removePlots();
createPlot(id = 1,
 position = {(-2), (-21), 708, 403},
 x="input_dp_1[1]",
 y = {	"zeta_TOT_1[1]",
	"zeta_TOT_1[2]"
},
  heading = "Curved bend (inverse): Relative curvature radius dependence (L/d_hyd= 10,angle of turning delta= 90)",
 range = {1e0, 32, 2e1, 8e-2},
 autoscale = true,
 autoerase = false,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_curvedOverall_DPMFLOW.mat",
 logX = true,
 logY = true,
 legends = {
	"Relative curvature radius R_0/d_hyd = 2.26",
	"R_0/d_hyd = 11.71"
},
 leftTitle = "Pressure loss coefficient (zeta_TOT [-])",
 bottomTitle = "Pressure loss [Pa]");

createPlot(id = 2,
 position = {(-2), 400, 708, 403},
 x="input_dp_1[1]",
 y = {	"M_FLOW_1[1]",
	"M_FLOW_1[2]"
},
 heading = "Curved bend (inverse): Relative curvature radius dependence (L/d_hyd= 10,angle of turning delta= 90)",
 range = {1e0, 32, 2e1, 8e-2},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_curvedOverall_DPMFLOW.mat",
 legends = {
	"Relative curvature radius R_0/d_hyd = 2.26",
	"R_0/d_hyd = 11.71"
},
 leftTitle = "Mass flow rate [kg/s]",
bottomTitle = "Pressure loss [Pa]");

createPlot(id = 3,
 position = {708, (-21), 708, 403},
 x="input_dp_2[1]",
 y = {	"zeta_TOT_2[1]",
	"zeta_TOT_2[2]",
	"zeta_TOT_2[3]"
},
 heading = "Curved bend (inverse): Angle of curvature dependence (Water,L/d_hyd= 10,relative curvature radius R_0/d_hyd= 2.26)",
 range = {1e0, 1e2, 1.2e4, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_curvedOverall_DPMFLOW.mat",
 logX = true,
 logY = true,
 legends = {
	"Angle of curvature delta= 30",
	"delta= 45",
	"delta = 90"
},
leftTitle = "Pressure loss coefficient (zeta_TOT [-])",
bottomTitle = "Pressure loss [Pa]");

 createPlot(id = 4,
 position = {708, 400, 708, 403},
 x="input_dp_2[1]",
 y = {	"M_FLOW_2[1]",
	"M_FLOW_2[2]",
	"M_FLOW_2[3]"
},
 heading = "Curved bend (inverse): Angle of curvature dependence (Water,L/d_hyd= 10,relative curvature radius R_0/d_hyd= 2.26)",
range = {1e0, 1e2, 1.2e4, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
  filename = "dp_curvedOverall_DPMFLOW.mat",
 legends = {
	"Angle of curvature delta= 30",
	"delta= 45",
	"delta = 90"
},
 leftTitle = "Mass flow rate [kg/s]",
bottomTitle = "Pressure loss [Pa]");

createPlot(id = 5,
   position = {375, 177, 708, 412},
  x = "input_mdot_1[1]",
 y = {
	"input_mdot_1[1]",
	"input_mdot_1[2]",
	"input_mdot_1[3]",
	"M_FLOW_1[1]",
	"M_FLOW_1[2]",
	"M_FLOW_1[3]"
},
 heading = "Check",
 range = {0, 0.1, 5e5, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_curvedOverall_DPMFLOW.mat",
 leftTitle = "(Output) Mass flow rate [kg/s]",
 bottomTitle = "(Input) Mass flow rate [kg/s]");

createPlot(id = 6,
   position = {375, 177, 708, 412},
 x = "input_mdot_2[1]",
 y = {
	"input_mdot_2[1]",
	"input_mdot_2[2]",
	"input_mdot_2[3]",
	"M_FLOW_2[1]",
	"M_FLOW_2[2]",
	"M_FLOW_2[3]"
},
 heading = "Check",
 range = {0, 0.1, 5e5, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 legends = {
	"Angle of curvature delta= 30",
	"delta= 45",
	"delta = 90",
	"Angle of curvature delta= 30",
	"delta= 45",
	"delta = 90"
},
 filename = "dp_curvedOverall_DPMFLOW.mat",
 leftTitle = "(Output) Mass flow rate [kg/s]",
 bottomTitle = "(Input) Mass flow rate [kg/s]");

Modelica.Utilities.System.setWorkDirectory(currentDirectory);
