// Script to generate plot for documentation of
// function PressureLoss.StraightPipe.dp_overall_DP
// function PressureLoss.StraightPipe.dp_overall_MFLOW
// of FluidDissipation Library
//
// Generated by Thorben Vahlenkamp
// 03-04-2008
// last change: 25-05-2009
// XRG Simulation GmbH

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

translateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.StraightPipe.dp_overall_DPMFLOW");

Advanced.StoreProtectedVariables:=true;

simulateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.StraightPipe.dp_overall_DPMFLOW",startTime=0, stopTime=1, numberOfIntervals=5000, method="dassl", tolerance=1e-005, resultFile="dp_overall_DPMFLOW");

switchToSimulationMode();

removePlots();
createPlot(id = 1,
 position = {(-2), (-21), 708, 403},
x="Re[1]",
 y = {
	"lambda_FRI[1]",
	"lambda_FRI[2]",
	"lambda_FRI[3]",
	"lambda_FRI[4]"

},
  heading = "Straight pipe (inverse): Pressure loss for overall flow regime (d_hyd= 0.1m, L=1m)",
 range = {1e4, 1e6, 1e-1, 1e-2},
 autoscale = false,
 autoerase = false,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_overall_DPMFLOW.mat",
 logX = true,
 logY = true,
 legends = {
	"relative roughness k =0",
	"k = 2e-4",
	"k = 2e-3",
	"k = 2e-2"
},
 leftTitle = "Darcy friction factor (lambda_FRI [-])",
 bottomTitle = "Reynolds number [-]");

createPlot(id = 2,
 position = {(-2), 400, 708, 403},
 x = "input_dp[1]",
 y = {
	"input_mdot[1]",
	"input_mdot[2]",
	"input_mdot[3]",
	"input_mdot[4]"
},
 heading = "Straight pipe (inverse): Pressure loss for overall flow regime (Water, d_hyd= 0.1m, L=1m)",
 range = {0, 35,100, 0},
 autoscale = true,
 autoerase = false,
 autoreplot = true,
 description = false,
 grid = true,
 color = true,
 online = false,
 filename = "dp_overall_DPMFLOW.mat",
 legends = {
	"relative roughness k =0",
	"k = 2e-4",
	"k = 2e-3",
	"k = 2e-2"
},
 leftTitle = "Mass flow rate [kg/s]",
 bottomTitle = "Pressure loss [Pa]");

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

Modelica.Utilities.System.setWorkDirectory(currentDirectory);
