public IDimension DimensionForStandardPKParameter(StandardPKParameter standardPKParameter) { switch (standardPKParameter) { case StandardPKParameter.Unknown: return(Constants.Dimension.NO_DIMENSION); case StandardPKParameter.C_max: case StandardPKParameter.C_min: case StandardPKParameter.C_trough: return(DimensionByName(Constants.Dimension.MOLAR_CONCENTRATION)); case StandardPKParameter.C_max_norm: case StandardPKParameter.C_min_norm: case StandardPKParameter.C_trough_norm: return(DimensionByName(Constants.Dimension.MASS_CONCENTRATION)); case StandardPKParameter.t_max: case StandardPKParameter.t_min: case StandardPKParameter.Tthreshold: case StandardPKParameter.MRT: case StandardPKParameter.Thalf: return(DimensionByName(Constants.Dimension.TIME)); case StandardPKParameter.AUC_tEnd: case StandardPKParameter.AUC_inf: case StandardPKParameter.AUC_tEnd_inf: return(DimensionByName(Constants.Dimension.MOLAR_AUC)); case StandardPKParameter.AUC_tEnd_norm: case StandardPKParameter.AUC_inf_norm: case StandardPKParameter.AUC_tEnd_inf_norm: return(DimensionByName(Constants.Dimension.MASS_AUC)); case StandardPKParameter.AUCM_tEnd: return(DimensionByName(Constants.Dimension.MOLAR_AUCM)); case StandardPKParameter.FractionAucEndToInf: return(DimensionByName(Constants.Dimension.FRACTION)); case StandardPKParameter.Vss: case StandardPKParameter.Vd: return(DimensionByName(Constants.Dimension.VOLUME_PER_BODY_WEIGHT)); default: throw new ArgumentOutOfRangeException(nameof(standardPKParameter), standardPKParameter, null); } }
public UserDefinedPKParameter CreateUserDefinedPKParameter( string name, StandardPKParameter standardPKParameter, string displayName, string displayUnit) { var defaultDimension = _dimensionTask.DimensionForStandardPKParameter(standardPKParameter); var userDefinedPKParameters = new UserDefinedPKParameter { Name = name, DisplayName = displayName, Dimension = defaultDimension, DisplayUnit = displayUnit, StandardPKParameter = standardPKParameter }; //No display unit defined, we return the user defined pk parameter if (string.IsNullOrEmpty(displayUnit)) { return(userDefinedPKParameters); } var dimensionForDisplayUnit = _dimensionTask.DimensionForUnit(displayUnit); //Display unit belongs to the dimension. We can use this if (Equals(defaultDimension, dimensionForDisplayUnit)) { return(userDefinedPKParameters); } //We have two dimensions. Do we have a converter between those dimensions? if (_dimensionFactory.HasMergingInformation(defaultDimension, dimensionForDisplayUnit)) { return(userDefinedPKParameters); } //There is no converter defined between those dimensions. //We use the dimension defined for the display unit or create a user defined dimension otherwise userDefinedPKParameters.Dimension = dimensionForDisplayUnit ?? _dimensionFactory.CreateUserDefinedDimension(name, displayUnit); return(userDefinedPKParameters); }
public double ValueFor(StandardPKParameter standardPKParameter, double?normalizationFactor) { Calculate(); var value = getPKParameterValue(); return(normalizationFactor.HasValue ? normalizedValue(value, normalizationFactor) : value); double getPKParameterValue() { switch (standardPKParameter) { case StandardPKParameter.C_max: return(Cmax); case StandardPKParameter.C_max_norm: return(doseNormalizedValue(Cmax)); case StandardPKParameter.t_max: return(Tmax); case StandardPKParameter.C_trough: return(CTrough); case StandardPKParameter.C_trough_norm: return(doseNormalizedValue(CTrough)); case StandardPKParameter.AUC_tEnd: return(AucTend); case StandardPKParameter.AUC_tEnd_norm: return(doseNormalizedValue(AucTend)); case StandardPKParameter.AUCM_tEnd: return(AucmTend); case StandardPKParameter.AUC_inf: return(AucInf); case StandardPKParameter.AUC_inf_norm: return(doseNormalizedValue(AucInf)); case StandardPKParameter.AUC_tEnd_inf: return(AucTendInf); case StandardPKParameter.AUC_tEnd_inf_norm: return(doseNormalizedValue(AucTendInf)); case StandardPKParameter.MRT: return(Mrt); case StandardPKParameter.CL: return(CL); case StandardPKParameter.FractionAucEndToInf: return(FractionAucEndToInf); case StandardPKParameter.Thalf: return(Thalf); case StandardPKParameter.Vss: return(Vss); case StandardPKParameter.Vd: return(Vd); case StandardPKParameter.Tthreshold: return(Tthreshold); case StandardPKParameter.C_min: return(Cmin); case StandardPKParameter.C_min_norm: return(doseNormalizedValue(Cmin)); case StandardPKParameter.t_min: return(Tmin); case StandardPKParameter.Unknown: return(NaN); default: throw new ArgumentOutOfRangeException(nameof(standardPKParameter), standardPKParameter, null); } } }