// Script to generate plot for documentation of
// function PressureLoss.Orifice.dp_suddenChange_DP AND dp_suddenChange_MFLOW
// of FluidDissipation Library
//
// Generated by Thorben Vahlenkamp
// 01-10-2008
// last change: 18-05-2009
// XRG Simulation GmbH

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

Evaluate := false;
Advanced.StoreProtectedVariables:=true;

translateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.Orifice.dp_suddenChange_DPMFLOW");
dpoo = 1 ;	//sudden expansion

switchToSimulationMode();


simulateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.Orifice.dp_suddenChange_DPMFLOW",startTime=0, stopTime=1, numberOfIntervals=5000, method="dassl", tolerance=1e-004, resultFile="dp_expansion");

removePlots();
createPlot(id = 1,
 position = {40, 22, 543, 515},
 x = "frac_A1toA2",
 y = {
	"zeta_TOT"
},
 heading = "Orifice: Sudden expansion (A_2= 0.01 m2, m_flow = 1 kg/s)",
 range = {0, 1.0, 1.0, 0},
 autoscale = false,
 autoerase = false,
 autoreplot = false,
 description = false,
 grid = true,
 color = true,
 online = false,
 legends = {
	"here: inverse calculation"},
 filename = "dp_expansion.mat",
 leftTitle = "Local resistance coefficient (zeta_LOC [-])",
 bottomTitle = "Ratio of cross sectional areas (A_1/A_2 [-])");

dpoo = -1 ;	//sudden contraction
simulateModel("ModelicaTest.Fluid.Dissipation.Verifications.PressureLoss.Orifice.dp_suddenChange_DPMFLOW",startTime=0, stopTime=1, numberOfIntervals=5000, method="dassl", tolerance=1e-004, resultFile="dp_contraction");


createPlot(id = 2,
 position = {594, 22, 544, 518},
 x = "frac_A1toA2",
 y = {
	"zeta_TOT"
},
 heading = "Orifice: Sudden contraction (A_2= 0.01 m2, m_flow = 1 kg/s)",
 range = {0, 1.0, 1.0, 0},
 autoscale = false,
 autoerase = false,
 autoreplot = false,
 description = false,
 grid = true,
 color = true,
 online = false,
 legends = {
	"here: inverse calculation"},
 filename = "dp_contraction.mat",
 leftTitle = "Local resistance coefficient (zeta_LOC [-])",
 bottomTitle = "Ratio of cross sectional areas (A_1/A_2 [-])");

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


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

Modelica.Utilities.System.setWorkDirectory(currentDirectory);
