simulateModel("Buildings.Fluid.HydronicConfigurations.PassiveNetworks.Examples.DualMixing", method="CVode", stopTime=86400, tolerance=1e-06, resultFile="DualMixing");

createPlot(id=1, position={14, 11, 1181, 908}, y={"T2Set.y", "con.T2Sup.T", "con.T2Ret.T", "T1Sup.T", "T1Ret.T"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h",  subPlot=1);
createPlot(id=1, position={14, 11, 1181, 908}, y={"con.val.y_actual"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h",  subPlot=2);

createPlot(id=2, position={1210, 14, 1184, 905}, y={"con.pum.m_flow", "con.mPum_flow_nominal"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h", subPlot=1);
createPlot(id=2,  y={"con.val.m1_flow", "con.val.m2_flow", "con.val.m3_flow", "con.val.m_flow_nominal", "con.res3.m_flow", "con.res3.m_flow_nominal"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h", subPlot=2);

createPlot(id=4, position={169, 245, 1184, 849}, y={"mode.y[1]", "fraLoa.y[1]", "fraLoa.y[2]", "loa.yLoa_actual", "loa1.yLoa_actual"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h",  subPlot=1);

createPlot(id=4, position={169, 245, 1184, 849}, y={"loa.con.val.y_actual", "loa1.con.val.y_actual"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h", subPlot=2);

createPlot(id=5, position={1209, 248, 1184, 847}, y={"con.dpPum_nominal", "con.pum.dpMachine", "con.val.dp1", "con.val.dpValve_nominal"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h", subPlot=1);
createPlot(id=5, y={"con.pum.y_actual"}, autoscale=true, grid=true, autoerase=true, color=true, timeUnit="h", subPlot=2);

// Mass flow function of the load
nPoints = readTrajectorySize("DualMixing.mat");
q_flow_nom = readTrajectory("DualMixing.mat", {"loa.Q_flow_nominal"}, 1);
q1_flow_nom = readTrajectory("DualMixing.mat", {"loa1.Q_flow_nominal"}, 1);
q_flow = readTrajectory("DualMixing.mat", {"loa.Q_flow"}, nPoints);
q1_flow = readTrajectory("DualMixing.mat", {"loa1.Q_flow"}, nPoints);
ratQTot_flow = (q_flow[1] + q1_flow[1]) / (q_flow_nom[1, 1] + q1_flow_nom[1, 1]);
m1_flow = readTrajectory("DualMixing.mat", {"m1_flow.m_flow"}, nPoints);
m2_flow = readTrajectory("DualMixing.mat", {"con.pum.m_flow"}, nPoints);
m1_flow_nom = readTrajectory("DualMixing.mat", {"con.m1_flow_nominal"}, 1);
m2_flow_nom = readTrajectory("DualMixing.mat", {"con.m2_flow_nominal"}, 1);
createPlot(id=8, position={1157, 245, 1184, 744}, autoscale=true, autoerase=true, grid=true, color=true, leftTitle="m_flow/m_flow_nominal [-]", bottomTitle="QTot_flow/QTot_flow_nominal [-]");
plotArray(ratQTot_flow, m1_flow[1] / m1_flow_nom[1,1], id=8, erase=false, legend="Primary circuit", pattern=LinePattern.None, marker=MarkerStyle.Dot);
plotArray(ratQTot_flow, m2_flow[1] / m2_flow_nom[1,1], id=8, erase=false, legend="Consumer circuit", pattern=LinePattern.None, marker=MarkerStyle.Dot, color={238,46,47});
