/// <summary> /// Calculate g C / kg substrate fresh matter /// </summary> /// <param name="mySubstrate">a substrate</param> /// <returns>g C / kg fresh matter</returns> private static physValue calcC(substrate mySubstrate) { physValue[] values = new physValue[6]; try { mySubstrate.get_params_of(out values, "RF", "RP", "RL", "NfE", "ADL", "TS"); } catch (exception e) { Console.WriteLine(e.Message); return(new physValue("error")); } physValue RF = values[0]; physValue RP = values[1]; physValue RL = values[2]; physValue NfE = values[3]; physValue ADL = values[4]; physValue TS = values[5]; return(calcC(RF, RP, RL, NfE, ADL, TS)); }
/// <summary> /// Returns the variable specified by symbol out of the given substrate as object /// </summary> /// <param name="mySubstrate">a substrate</param> /// <param name="variable">object</param> /// <param name="symbol">"RF"</param> /// <exception cref="exception">Unknown parameter</exception> public static void get_params_of(substrate mySubstrate, out object variable, string symbol) { object[] variables; string[] symbols = { symbol }; mySubstrate.get_params_of(out variables, symbols); variable = variables[0]; }
/// <summary> /// Calculate g S / kg substrate fresh matter /// </summary> /// <param name="mySubstrate">a substrate</param> /// <returns>g S / kg substrate FM</returns> private static physValue calcS(substrate mySubstrate) { physValue[] values = new physValue[6]; mySubstrate.get_params_of(out values, "RF", "RP", "RL", "NfE", "ADL", "TS"); physValue RF = values[0]; physValue RP = values[1]; physValue RL = values[2]; physValue NfE = values[3]; physValue ADL = values[4]; physValue TS = values[5]; return(calcS(RF, RP, RL, NfE, ADL, TS)); }
/// <summary> /// Calculates the f-Factor: fPr_Xc, defining the fraction of proteins in /// composites Xc /// </summary> /// <param name="mySubstrate">a substrate</param> /// <returns>fPr_Xc</returns> /// <exception cref="exception">value out of bounds</exception> public static double calcfPr_Xc(substrate mySubstrate) { physValue[] values = new physValue[2]; try { mySubstrate.get_params_of(out values, "RP", "VS"); } catch (exception e) { Console.WriteLine(e.Message); return(-1); } physValue RP = values[0]; physValue VS = values[1]; return(calcfPr_Xc(RP, VS)); }
/// <summary> /// Calculates the f-Factor: fXI_Xc, defining the fraction of particulate inerts in /// composites Xc /// </summary> /// <param name="mySubstrate">a substrate</param> /// <returns>fXI_Xc</returns> public static double calcfXI_Xc(substrate mySubstrate) { physValue[] values = new physValue[4]; try { mySubstrate.get_params_of(out values, "ADL", "NDF", "VS", "D_VS"); } catch (exception e) { Console.WriteLine(e.Message); return(-1); } physValue ADL = values[0]; physValue NDF = values[1]; physValue VS = values[2]; physValue D_VS = values[3]; return(calcfXI_Xc(ADL, NDF, VS, D_VS)); }
/// <summary> /// Calculates the theoretical biochemical methane potential of the substrate /// measured in l per g fresh matter /// </summary> /// <param name="mySubstrate">a substrate</param> /// <returns>BMP</returns> /// <exception cref="exception">Unit of parameters not as specified in method below /// </exception> private static physValue calcBMP(substrate mySubstrate) { physValue[] values = new physValue[7]; try { mySubstrate.get_params_of(out values, "RF", "RP", "RL", "ADL", "VS", "TS", "NDF"); } catch (exception e) { Console.WriteLine(e.Message); return(new physValue("error BMP")); } physValue RF = values[0]; physValue RP = values[1]; physValue RL = values[2]; physValue ADL = values[3]; physValue VS = values[4]; physValue TS = values[5]; physValue NDF = values[6]; double d; try { d = calc_d(mySubstrate); } catch (exception e) { Console.WriteLine(e.Message); return(new physValue("error2")); } return(calcBMP(RF, RP, RL, ADL, VS, TS, d, NDF)); }