// Script to generate plot for documentation of
// function PressureLoss.Valve.dp_severalGeometryOverall_DP AND dp_severalGeometryOverall_MFLOW
// of FluidDissipation Library
//
// Generated by Thorben Vahlenkamp
// 08-09-2009
// last change: 11-12-2009
// XRG Simulation GmbH

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

translateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.Valve.dp_severalGeometryOverall_DPMFLOW");

Advanced.StoreProtectedVariables:=true;

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

switchToSimulationMode();

removePlots();
createPlot(id = 1,
 position = {(-2), (-21), 708, 403},
  x = "input_opening.y",
 y = {
	"zeta_TOT_2[1]",
	"zeta_TOT_2[2]",
	"zeta_TOT_2[3]",
	"zeta_TOT_2[4]",
	"zeta_TOT_2[5]"
},
   heading = "Valve: Geometry dependence for variable opening",
 range = {0, 1, 5e2, 1e-2},
 autoscale = false,
 autoerase = false,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_severalGeometryOverall_DPMFLOW.mat",
 logX = false,
 logY = true,
 legends = {
	"Ball",
	"Diaphragm",
	"Butterfly",
	"Gate",
	"Sluice"
},
 leftTitle = "Pressure loss coefficient (zeta_TOT [-])",
 bottomTitle = "Opening [-]");

createPlot(id = 2,
   position = {(-2), 400, 708, 403},
 x = "input_DP.y",
 y = {
	"input_mdot_1[1]",
	"input_mdot_1[2]",
	"input_mdot_1[3]",
	"input_mdot_1[4]",
	"input_mdot_1[5]"
},
 heading = "Valve (compressible case): Geometry dependence (Water,d_hyd=0.1m,opening = 50%)",
 range = {0, 0.1, 5e5, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_severalGeometryOverall_DPMFLOW.mat",
 legends = {
	"Ball",
	"Diaphragm",
	"Butterfly",
	"Gate",
	"Sluice"
},
 leftTitle = "Mass flow rate [kg/s]",
 bottomTitle = "Pressure loss [Pa]");

createPlot(id = 3,
   position = {708, (-21), 708, 403},
 x = "Re_3[1]",
 y = {
	"zeta_TOT_3[1]",
	"zeta_TOT_3[2]",
	"zeta_TOT_3[3]",
	"zeta_TOT_3[4]",
	"zeta_TOT_3[5]"
},
 heading = "Valve: Geometry dependence at constant opening of 50%",
 range = {1e2, 1e6, 5e2, 1e-2},
 autoscale = false,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_severalGeometryOverall_DPMFLOW.mat",
 logX = true,
 logY = true,
 legends = {
	"Ball",
	"Diaphragm",
	"Butterfly",
	"Gate",
	"Sluice"
},
 leftTitle = "Pressure loss coefficient (zeta_TOT [-])",
 bottomTitle = "Reynolds number [-]");

createPlot(id = 4,
position = {708, 400, 708, 403},
 x = "input_mdot.y",
 y = {
	"DP_plot_3[1]",
	"DP_plot_3[2]",
	"DP_plot_3[3]",
	"DP_plot_3[4]",
	"DP_plot_3[5]"
},
 heading = "Valve (incompressible case): Geometry dependence (Water,d_hyd=0.1m,opening = 50%)",
 range = {0, 0.1, 5e5, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_severalGeometryOverall_DPMFLOW.mat",
 legends = {
	"Ball",
	"Diaphragm",
	"Butterfly",
	"Gate",
	"Sluice"
},
 leftTitle = "Pressure loss [Pa]",
 bottomTitle = "Mass flow rate [kg/s]");

createPlot(id = 5,
   position = {375, 177, 708, 412},
 x = "input_opening.y",
 y = {
	"input_mdot_1[1]",
	"input_mdot_1[2]",
	"input_mdot_1[3]",
	"input_mdot_1[4]",
	"input_mdot_1[5]",
	"input_mdot_2[1]",
	"input_mdot_2[2]",
	"input_mdot_2[3]",
	"input_mdot_2[4]",
	"input_mdot_2[5]",
	"M_FLOW_1[1]",
	"M_FLOW_1[2]",
	"M_FLOW_1[3]",
	"M_FLOW_1[4]",
	"M_FLOW_1[5]",
	"M_FLOW_2[1]",
	"M_FLOW_2[2]",
	"M_FLOW_2[3]",
	"M_FLOW_2[4]",
	"M_FLOW_2[5]"
},
 heading = "Checks (compressible)",
 range = {0, 0.1, 5e5, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_severalGeometryOverall_DPMFLOW.mat",
 leftTitle = "(Input/Output) mass flow rates [kg/s]",
 bottomTitle = "Opening [-]");

createPlot(id = 6,
   position = {375, 177, 708, 412},
 x = "input_mdot.y",
 y = {
	"input_mdot_3[1]",
	"input_mdot_3[2]",
	"input_mdot_3[3]",
	"input_mdot_3[4]",
	"input_mdot_3[5]",
	"M_FLOW_3[1]",
	"M_FLOW_3[2]",
	"M_FLOW_3[3]",
	"M_FLOW_3[4]",
	"M_FLOW_3[5]"
},
 heading = "Checks (incompressible)",
 range = {0, 0.1, 5e5, 0},
 autoscale = true,
 autoerase = true,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_severalGeometryOverall_DPMFLOW.mat",
 leftTitle = "(Input/Output) mass flow rates [kg/s]",
 bottomTitle = "(Input) Mass flow rate [kg/s]");

Modelica.Utilities.System.setWorkDirectory(currentDirectory);
