Пример #1
0
bool SysCADSystemHelper::SystemSolidsToSysCAD(MVector &SysCAD,RioTintoTS::PFlowStream1 &System)

//
// Copy System solids size data to SysCAD Size Data
//

{
	MIPSD & PSD=*SysCAD.GetIF<MIPSD>();
	if (!IsNothing(PSD))
	{  
		const int NumComps = PSD.getPSDVectorCount();
		const int NumSizes = PSD.getSizeCount();

		// Get a reference to the System solids Matrices.
		// copy these feed size distributions to the SysCAD solids size data
		RioTintoTS::MatrixView &SystemSolids = System->AccessSolidsMatrix();


		// For each component
		for (int c=0; c<NumComps; c++)
		{
			// Get the size data for component c
			// The size data is smallest to largest in units of kg/s

			// Index into SysCAD Component Masses
			const int SpId = PSD.getSpecieIndex(c);

			// Insert the resultant size data into the SysCAD Output Size Data
			RioTintoTS::VectorView iCompSize = SystemSolids.column(c);

			double m = 0.0;
			for (int s=0; s<NumSizes; s++)
			{
				// Accumulate each size fraction to the total mass for the component
				m += iCompSize[s];
			}
			SysCAD.putM(SpId, m*1000/3600);
			double f = 0.0;

			for (int s=0; s<NumSizes; s++)
			{
				const double d = m>0.0 ? iCompSize[s]/m : 0.0;
				f += d;
				PSD.putFrac(c,NumSizes-s-1, d);
			}

		}
		return true;
	}

	return false;
}
Пример #2
0
bool SysCADSystemHelper::SystemLiquidToSysCAD(MVector &SysCAD,RioTintoTS::PFlowStream1 &System)

//
// Copy SysCAD liquid mass flow to System mass flow
//

{
	const int WaterIndex = gs_MVDefn.Lookup("H2O(l)");

	if ( WaterIndex >= 0 )
	{
		double pdLiquid = System->GetLiquidMass();
		// t/h to kg/s
		SysCAD.putM(WaterIndex, pdLiquid/3.6);

		return true;
	}

	return false;
}