private void SetRiverTile(River river) { SetRiverPath(river); HeightType = HeightType.River; HeightValue = 0; Collidable = false; }
public static HeightType HeightType(this HtmlNode htmlNode, HeightType defaultValue) { if (!htmlNode.ContainsAttributes("height")) { return(defaultValue); } var attribute = htmlNode.Attributes["height"]; if (string.IsNullOrEmpty(attribute.Value)) { return(defaultValue); } if (attribute.Value.Equals("auto", StringComparison.CurrentCultureIgnoreCase)) { return(Enums.HeightType.Auto); } if (attribute.Value.IsDigitsOnly()) { return(Enums.HeightType.Fixed); } return(defaultValue); }
private void setRiverTile(River river) { setRiverPath(river); myHeightType = HeightType.River; myHeightValue = 0; myIsLand = false; }
internal static Color GetColor(HeightType type) { switch (type) { case HeightType.Lowest: return(new Color(255, 0, 0, 128)); case HeightType.Lower: return(new Color(255, 25, 25, 150)); case HeightType.Low: return(new Color(255, 50, 220, 20)); case HeightType.High: return(new Color(255, 16, 160, 0)); case HeightType.Higher: return(new Color(255, 128, 128, 128)); case HeightType.Highest: return(new Color(255, 255, 255, 255)); default: return(Color.magenta); } }
private void SetRiverCell(River river) { SetRiverPath(river); HeightType = HeightType.River; HeightValue = 0; Collidable = false; //Debug.Log($"River exists in Cell {X}, {Y}"); }
/// <summary> /// Creates and initializes a new Height instance /// </summary> /// <param name="type">Height type for the created instance.</param> /// <exception href="NotSupportedException">When type is equal to HeightType.Chain.</exception> public Height(HeightType type) { if (type == HeightType.Chain) { throw new NotSupportedException($"For {type} height must be specified"); } Type = type; _value = (Type == HeightType.MemPool) ? MemPool.Value : Unknown.Value; }
/// <summary> /// Creates and initializes a new Height instance /// </summary> /// <param name="type">Height type for the created instance.</param> /// <exception href="NotSupportedException">When type is equal to HeightType.Chain.</exception> public Height(HeightType type) { if (type == HeightType.Chain) { throw new NotSupportedException($"For {type} height must be specified"); } Type = type; Value = Type == HeightType.Mempool ? int.MaxValue - 1 : int.MaxValue; }
public void ValidateBaseElementProperties( IAdaptiveCardElement element, string id, bool isVisible, bool separator, Spacing spacing, HeightType height) { Assert.AreEqual(id, element.Id); Assert.AreEqual(isVisible, element.IsVisible); Assert.AreEqual(separator, element.Separator); Assert.AreEqual(spacing, element.Spacing); Assert.AreEqual(height, element.Height); }
public Height(HeightType type) { if (type == HeightType.Chain) { throw new NotSupportedException($"For {type} height must be specified"); } Type = type; if (Type == HeightType.MemPool) { _value = int.MaxValue - 1; } else { _value = int.MaxValue; // HeightType.Unknown } }
private static int GetRandomHeight(HeightType heightType) { var rnd = new Random(); switch (heightType) { case HeightType.Little: return(rnd.Next(160, 170)); case HeightType.Medium: return(rnd.Next(170, 180)); case HeightType.UpperMedium: return(rnd.Next(180, 190)); case HeightType.Tall: return(rnd.Next(190, 200)); } throw new Exception("Unable to generate height"); }
public void setElevation(float elevation) { myHeightValue = elevation; if (myHeightValue < WorldParameters.DeepWater) { myHeightType = HeightType.DeepWater; myIsLand = false; } else if (myHeightValue < WorldParameters.ShallowWater) { myHeightType = HeightType.ShallowWater; myIsLand = false; } else if (myHeightValue < WorldParameters.Sand) { myHeightType = HeightType.Sand; myIsLand = true; } else if (myHeightValue < WorldParameters.Grass) { myHeightType = HeightType.Grass; myIsLand = true; } else if (myHeightValue < WorldParameters.Forest) { myHeightType = HeightType.Forest; myIsLand = true; } else if (myHeightValue < WorldParameters.Rock) { myHeightType = HeightType.Rock; myIsLand = true; } else { myHeightType = HeightType.Snow; myIsLand = true; } }
private void SetRiverTile(River river) { SetRiverPath(river); HeightType = HeightType.River; HeightValue = 0; Collidable = false; }
public string EP(ProcedureType Procedure_Type, GenderType Gender, double Weight, WeightType Weight_Units, double Height, HeightType Height_Units, double Total_Blood_Volume, BloodVolumeType Total_Blood_Volume_Override, double FCR, double Initial_Hct, double Target_End_Hct, double Avg_RF_Hct, double Replacement_Volume, ReplacementVolumeType Replacement_Volume_Override, double Target_Depletion_Hct, double Blood_Warmer_Volume, int Flag) { string Predicted_Error = "None"; double IP_WB_Volume = 0; double IP_Replaced_Volume = 0; double PD_Replaced_Volume = 0; double Total_Waste_Processed = 0; double RF_Volume = 0; double FCR_Factor = 1.085; double RBC_Citrate_Concentration = 21.4; double Percent_AC_in_RBC = 2; if (Height_Units == HeightType.inc) { Height = Height / 0.3937008 / 100; } else { Height = Height / 100; } if (Weight_Units == WeightType.lbs) { Weight = Weight / 2.2046223; } Initial_Hct = Initial_Hct / 100; Avg_RF_Hct = Avg_RF_Hct / 100; double Blood_Prime_Hct = 0; double Estimation_Hct = 0; // Estimation_Hct Estimation_Hct = Estimation_Hct / 100; Target_Depletion_Hct = Target_Depletion_Hct / 100; Target_End_Hct = Target_End_Hct / 100; FCR = FCR / 100; if (Total_Blood_Volume_Override == BloodVolumeType.Nadler) { // double Estimation_Hct; double Low_TBV_Factor = 80; if (Weight < 25) { Total_Blood_Volume = Weight * Low_TBV_Factor; } else { if (Gender == GenderType.Female) { Total_Blood_Volume = (0.3561 * Math.Pow(Height, 3) + 0.03308 * Weight + 0.1833) * 1000; } else { Total_Blood_Volume = (0.3669 * Math.Pow(Height, 3) + 0.03219 * Weight + 0.6041) * 1000; } } } double Fluid_Balance = 0; double Total_Reinfusion_Volume = 0; double IP_Return_Path_Volume = 60 - 15 + Blood_Warmer_Volume; double PD_Return_Path_Volume = 60 + Blood_Warmer_Volume; double Calculated_CIR_Limit = 1.25 * Weight; double Cit_Con_AC = 21.4; double Entered_Patient_Volume = Total_Blood_Volume; double Entered_Patient_Hct = Initial_Hct; double Entered_Avg_RF_Hct = Avg_RF_Hct; double Entered_Fluid_Balance = Fluid_Balance; double Entered_Max_WB_Rate = 50; double Entered_AC_Ratio = 12; double Entered_CIR = 1.25; string Entered_AC_Type = "ACD"; string Entered_Blood_Prime = "None"; double Entered_End_Hct = Target_End_Hct; string Entered_Divert_Prime = "Yes"; string Entered_Reinfusion = "No"; double Entered_FCR = Math.Exp(Math.Log(FCR) / FCR_Factor) * (Entered_End_Hct / Entered_Patient_Hct) * ((Entered_Patient_Volume + Entered_Fluid_Balance - Total_Reinfusion_Volume) / Entered_Patient_Volume); double Entered_Depletion_Hct = 0; if (Procedure_Type == ProcedureType.Depletion) { Entered_Depletion_Hct = Entered_End_Hct; } else { Entered_Depletion_Hct = Target_Depletion_Hct; } double Entered_Replacement_Volume = 0; if (Replacement_Volume_Override == ReplacementVolumeType.Override) { Entered_Replacement_Volume = Replacement_Volume; } Predicted_Error = "None"; double Predicted_Replacement_Volume = 0; double Predicted_Other_RF_Volume = 0; double RF_AC_Fraction = Percent_AC_in_RBC / 100; double Cit_Con_Rep_Fluid = RF_AC_Fraction * RBC_Citrate_Concentration; double CIR_Limited_Qrf = Calculated_CIR_Limit / Cit_Con_Rep_Fluid; Cit_Con_AC = 21.4; double EqQb = Calculated_CIR_Limit * (Entered_AC_Ratio + 1) / Cit_Con_AC; string Divert_Prime = Entered_Divert_Prime; double Max_WB_Rate = Entered_Max_WB_Rate; double AC_Ratio = Entered_AC_Ratio; double Estimation_Volume = Entered_Patient_Volume; Estimation_Hct = Entered_Patient_Hct; double Estimation_FCR = 1; double RF_Used = 0; Avg_RF_Hct = Entered_Avg_RF_Hct; Target_End_Hct = Entered_End_Hct; double Target_FCR = Entered_FCR; double Target_Volume = Entered_Patient_Volume + Entered_Fluid_Balance - Total_Reinfusion_Volume; if (Target_Volume < 0.9 * Entered_Patient_Volume) { Predicted_Error = "Increase Target Fluid Blance"; } Target_Depletion_Hct = Entered_Depletion_Hct; double Target_Replacement_Volume = Entered_Replacement_Volume; double CIR_Limit = Calculated_CIR_Limit; double Qwb_Dep = 0; double Qwb_Ex = 0; if (Procedure_Type == ProcedureType.Exchange) { double Qrf_IP = 0; double Qwb_IP = Min(CIR_Limited_Qrf * (AC_Ratio + 1) / AC_Ratio, Max_WB_Rate); Qwb_IP = Min(Qwb_IP, 50); double Qac_IP = Qwb_IP / (AC_Ratio + 1); if (Qac_IP < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } if (Estimation_Hct > Avg_RF_Hct) { Qrf_IP = Qwb_IP - Qac_IP; } else { Qrf_IP = (Estimation_Hct / Avg_RF_Hct) * (Qwb_IP - Qac_IP); } double Qp_IP = Qwb_IP - Qac_IP - Qrf_IP; double Remaining_IP_WB_Volume = 105 - IP_WB_Volume; double Est_Mode_Time = Remaining_IP_WB_Volume / Qwb_IP; double Total_Return_Volume = (Qrf_IP + Qp_IP) * Est_Mode_Time; double Mode_RF_Volume = Qrf_IP * Est_Mode_Time; double Mode_Other_RF_Volume = 0; double[] Estimation; if (IP_Replaced_Volume < IP_Return_Path_Volume) { IP_Return_Path_Volume = IP_Return_Path_Volume - IP_Replaced_Volume; if (IP_Return_Path_Volume > Total_Return_Volume) { IP_Return_Path_Volume = Total_Return_Volume; } double Partial_Time = IP_Return_Path_Volume / (Qwb_IP - Qac_IP); Estimation = RBCXTT(Qwb_IP - Qac_IP, Qrf_IP, Qp_IP, 0, Partial_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); Estimation_Volume = Estimation[0]; Estimation_Hct = Estimation[1]; Estimation_FCR = Estimation[2]; } else { IP_Return_Path_Volume = 0; } // TODO: it line can be wrong // oroginal kine is If Return_Path_Volume < Total_Return_Volume Then // but there is not any if (IP_Return_Path_Volume < Total_Return_Volume) { double Partial_Time = (Total_Return_Volume - IP_Return_Path_Volume) / (Qwb_IP - Qac_IP); Estimation = RBCXTT(Qwb_IP - Qac_IP, Qrf_IP, Qp_IP, Avg_RF_Hct, Partial_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); Estimation_Volume = Estimation[0]; Estimation_Hct = Estimation[1]; Estimation_FCR = Estimation[2]; } Predicted_Replacement_Volume = Mode_RF_Volume; Predicted_Other_RF_Volume = Mode_Other_RF_Volume; Qwb_Ex = Max_WB_Rate; double Qac_Ex = Qwb_Ex / (AC_Ratio + 1); if (Qac_Ex < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } if (Replacement_Volume_Override == ReplacementVolumeType.Override) { if (Target_Replacement_Volume - RF_Used - Predicted_Replacement_Volume <= 0) { Predicted_Error = "Increase Replacement Volume"; } var Calculated_FCR = CalculatedFCRVR(Estimation_Hct, Avg_RF_Hct, Target_End_Hct, Target_Volume - Estimation_Volume, Estimation_Volume, Target_Replacement_Volume - RF_Used - Predicted_Replacement_Volume, (Qwb_Ex - Qac_Ex), 1); Target_FCR = Calculated_FCR * Estimation_FCR; if (Target_FCR <= 0) { Predicted_Error = "Decrease Replacement Volume"; } if (Target_FCR >= Estimation_FCR) { Predicted_Error = "Decrease Target End Hct"; } } else { if (Target_FCR <= 0) { Predicted_Error = "Increase Target FCR"; } if (Target_FCR >= Estimation_FCR) { Predicted_Error = "Decrease Target FCR"; } } if ((Target_FCR / Estimation_FCR) >= (0.99 + ((Target_Volume - Estimation_Volume) / Estimation_Volume))) { Predicted_Error = "Increase Target Fluid Balance"; } double Qrf_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 1); double Qp_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 2); Est_Mode_Time = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 3); double Max_Hct = Max(Estimation_Hct, Target_End_Hct); double Plasma_AC_Fraction = 1 / (((1 - Max_Hct) * AC_Ratio) + 1); double Estimated_CIR = (Qrf_Ex * Cit_Con_Rep_Fluid) + (Qp_Ex * Cit_Con_AC * Plasma_AC_Fraction); if (Estimated_CIR > CIR_Limit) { double CIR_Adjustment = CIR_Limit / Estimated_CIR; Qwb_Ex = Qwb_Ex * CIR_Adjustment; Qac_Ex = Qac_Ex * CIR_Adjustment; if (Qac_Ex < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } Qrf_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 1); Qp_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 2); Est_Mode_Time = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 3); } double prbc_Hct = 0.8; double AC_Dilution = AC_Ratio / (AC_Ratio + 1); Max_Hct = Max(Estimation_Hct, Target_End_Hct); double Hct_ACWB = AC_Dilution * Max_Hct; double Qp_max = Qwb_Ex * (1 - (Hct_ACWB / prbc_Hct)); if (Qp_Ex > Qp_max) { Predicted_Error = "Unable to meet Hct"; } if (Qp_Ex < 1.3) { if (Qp_Ex <0 | Qp_Ex> 1E-07) { Predicted_Error = "Decrease Target End Hct"; } else { Qp_Ex = 0; } } if (Qrf_Ex > 150) { Predicted_Error = "Decrease Target Fluid Balance"; } if (Qrf_Ex < 1.3) { Predicted_Error = "Decrease Target FCR"; } Mode_RF_Volume = Qrf_Ex * Est_Mode_Time; Mode_Other_RF_Volume = 0; if (Estimation_Hct > Target_End_Hct) { double Plasma_AC_Fraction_Start = 1 / (((1 - Estimation_Hct) * AC_Ratio) + 1); double Plasma_AC_Fraction_End = 1 / (((1 - Target_End_Hct) * AC_Ratio) + 1); Plasma_AC_Fraction = (Plasma_AC_Fraction_Start + Plasma_AC_Fraction_End) / 2; } else { Plasma_AC_Fraction = 1 / (((1 - Target_End_Hct) * AC_Ratio) + 1); } // double Mode_Time = Est_Mode_Time; Estimation = RBCXTT(Qwb_Ex - Qac_Ex, Qrf_Ex, Qp_Ex, Avg_RF_Hct, Est_Mode_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); double Current_Patient_Volume = Estimation[0]; double Current_Patient_Hct = Estimation[1]; double Current_FCR = Estimation[2]; Estimation_Volume = Current_Patient_Volume; Estimation_Hct = Current_Patient_Hct; Estimation_FCR = Current_FCR; Predicted_Replacement_Volume = Predicted_Replacement_Volume + Mode_RF_Volume; Predicted_Other_RF_Volume = Predicted_Other_RF_Volume + Mode_Other_RF_Volume; } else { double Qwb_IP = Min(Max_WB_Rate, 50); double Qac_IP = Qwb_IP / (AC_Ratio + 1); if (Qac_IP < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } double Qrf_IP_Est = Qwb_IP - Qac_IP; double Remaining_IP_WB_Volume = 105 - IP_WB_Volume; double Est_Mode_Time = Remaining_IP_WB_Volume / Qwb_IP; double Mode_RF_Volume = 0; double Mode_Other_RF_Volume = (Qwb_IP - Qac_IP) * Est_Mode_Time; double[] Estimation = RBCXTT(Qwb_IP - Qac_IP, Qwb_IP - Qac_IP, 0, 0, Est_Mode_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); double Current_Patient_Volume = Estimation[0]; double Current_Patient_Hct = Estimation[1]; double Current_FCR = Estimation[2]; Estimation_Volume = Current_Patient_Volume; Estimation_Hct = Current_Patient_Hct; Estimation_FCR = Current_FCR; Predicted_Replacement_Volume = Mode_RF_Volume; Predicted_Other_RF_Volume = Mode_Other_RF_Volume; double Start_Depletion_Hct = Estimation_Hct; double Volume_to_Remove = -Estimation_Volume *Math.Log(Target_Depletion_Hct / Estimation_Hct); Qwb_Dep = Min(Max_WB_Rate, EqQb); double Qac_Dep = Qwb_Dep / (AC_Ratio + 1); if (Qac_Dep < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } double prbc_Hct = 0.8; double AC_Dilution = AC_Ratio / (AC_Ratio + 1); double Avg_Depletion_Hct = (Estimation_Hct + Target_Depletion_Hct) / 2; double Avg_Hct_ACWB = AC_Dilution * Avg_Depletion_Hct; double Qp_Ideal_Est = Qwb_Dep * (1 - (Avg_Hct_ACWB / prbc_Hct)); double Qrf_Dep_Est = Qwb_Dep - Qac_Dep - Qp_Ideal_Est; if (Procedure_Type == ProcedureType.DepletionExchange) { Volume_to_Remove = Volume_to_Remove - PD_Return_Path_Volume; } if (Volume_to_Remove < 0) { Predicted_Error = "Depletion Target Unachievable"; } Est_Mode_Time = Volume_to_Remove / (Qwb_Dep - Qac_Dep); double Est_Depletion_Time = Est_Mode_Time; Mode_RF_Volume = 0; Mode_Other_RF_Volume = Qrf_Dep_Est * Est_Mode_Time; Estimation = RBCXTT(Qwb_Dep - Qac_Dep, Qwb_Dep - Qac_Dep, 0, 0, Est_Mode_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); Current_Patient_Volume = Estimation[0]; Current_Patient_Hct = Estimation[1]; Current_FCR = Estimation[2]; Estimation_Volume = Current_Patient_Volume; Estimation_Hct = Current_Patient_Hct; Estimation_FCR = Current_FCR; Predicted_Replacement_Volume = Predicted_Replacement_Volume + Mode_RF_Volume; Predicted_Other_RF_Volume = Predicted_Other_RF_Volume + Mode_Other_RF_Volume; double Plasma_AC_Fraction_Start = 1 / (((1 - Start_Depletion_Hct) * AC_Ratio) + 1); double Plasma_AC_Fraction_End = 1 / (((1 - Estimation_Hct) * AC_Ratio) + 1); double Plasma_AC_Fraction = (Plasma_AC_Fraction_Start + Plasma_AC_Fraction_End) / 2; if (Procedure_Type == ProcedureType.DepletionExchange) { double Qwb_PD = Max_WB_Rate; double Qac_PD = Qwb_PD / (AC_Ratio + 1); if (Qac_PD < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } double PD_FCR; if (Replacement_Volume_Override == ReplacementVolumeType.Override) { if (Target_Replacement_Volume - RF_Used - Predicted_Replacement_Volume <= 0) { Predicted_Error = "Increase_Replacement_Volume"; } double Calculated_FCR = CalculatedFCRVR(Estimation_Hct, Avg_RF_Hct, Target_End_Hct, Target_Volume - Estimation_Volume, Estimation_Volume, Target_Replacement_Volume - RF_Used - Predicted_Replacement_Volume, Qwb_PD - Qac_PD, 1); PD_FCR = Calculated_FCR * Estimation_FCR; if (PD_FCR <= 0) { Predicted_Error = "Decrease Replacement Volume"; } if (PD_FCR >= Estimation_FCR) { Predicted_Error = "Decrease Target End Hct"; } } else { PD_FCR = Target_FCR; if (PD_FCR <= 0) { Predicted_Error = "Increase Target FCR"; } if (PD_FCR >= Estimation_FCR) { Predicted_Error = "Decrease Target FCR"; } } if ((PD_FCR / Estimation_FCR) >= (0.99 + ((Target_Volume - Estimation_Volume) / Estimation_Volume))) { Predicted_Error = "Increase_Target_Fluid_Balance"; } double Qrf_PD = CalculatedFCR(Qwb_PD - Qac_PD, Estimation_Volume, Target_Volume - Estimation_Volume, Estimation_Hct, Estimation_FCR, Target_End_Hct, PD_FCR, Avg_RF_Hct, 1); double Qp_PD = CalculatedFCR(Qwb_PD - Qac_PD, Estimation_Volume, Target_Volume - Estimation_Volume, Estimation_Hct, Estimation_FCR, Target_End_Hct, PD_FCR, Avg_RF_Hct, 2); double Max_Hct = Max(Estimation_Hct, Target_End_Hct); Plasma_AC_Fraction = 1 / (((1 - Max_Hct) * AC_Ratio) + 1); double Estimated_CIR = (Qrf_PD * Cit_Con_Rep_Fluid) + (Qp_PD * Cit_Con_AC * Plasma_AC_Fraction); if (Estimated_CIR > CIR_Limit) { double CIR_Adjustment = CIR_Limit / Estimated_CIR; Qwb_PD = Qwb_PD * CIR_Adjustment; Qac_PD = Qac_PD * CIR_Adjustment; if (Qac_PD < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } Qrf_PD = CalculatedFCR(Qwb_PD - Qac_PD, Estimation_Volume, Target_Volume - Estimation_Volume, Estimation_Hct, Estimation_FCR, Target_End_Hct, PD_FCR, Avg_RF_Hct, 1); Qp_PD = CalculatedFCR(Qwb_PD - Qac_PD, Estimation_Volume, Target_Volume - Estimation_Volume, Estimation_Hct, Estimation_FCR, Target_End_Hct, PD_FCR, Avg_RF_Hct, 2); } prbc_Hct = 0.8; AC_Dilution = AC_Ratio / (AC_Ratio + 1); Max_Hct = Max(Estimation_Hct, Target_End_Hct); double Hct_ACWB = AC_Dilution * Max_Hct; double Qp_max = Qwb_PD * (1 - (Hct_ACWB / prbc_Hct)); if (Qp_PD > Qp_max) { Predicted_Error = "Increase Target End Hct"; } if (Qp_PD < 1.3) { if (Qp_PD <0 | Qp_PD> 1E-07) { Predicted_Error = "Decrease Target End Hct"; } else { Qp_PD = 0; } } if (Qrf_PD > 150) { Predicted_Error = "Decrease Target Fluid Balance"; } if (Qrf_PD < 1.3) { Predicted_Error = "Decrease Target FCR"; } double PD_Volume_Remaining = PD_Return_Path_Volume - PD_Replaced_Volume; Est_Mode_Time = PD_Volume_Remaining / (Qrf_PD + Qp_PD); Mode_RF_Volume = Qrf_PD * Est_Mode_Time; Mode_Other_RF_Volume = 0; if (Estimation_Hct > Target_Depletion_Hct) { Plasma_AC_Fraction_Start = 1 / (((1 - Estimation_Hct) * AC_Ratio) + 1); Plasma_AC_Fraction_End = 1 / (((1 - Target_Depletion_Hct) * AC_Ratio) + 1); Plasma_AC_Fraction = (Plasma_AC_Fraction_Start + Plasma_AC_Fraction_End) / 2; } else { Plasma_AC_Fraction = 1 / (((1 - Target_End_Hct) * AC_Ratio) + 1); } Estimation = RBCXTT(Qwb_PD - Qac_PD, Qrf_PD, Qp_PD, 0, Est_Mode_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); Current_Patient_Volume = Estimation[0]; Current_Patient_Hct = Estimation[1]; Current_FCR = Estimation[2]; Estimation_Volume = Current_Patient_Volume; Estimation_Hct = Current_Patient_Hct; Estimation_FCR = Current_FCR; Predicted_Replacement_Volume = Predicted_Replacement_Volume + Mode_RF_Volume; Predicted_Other_RF_Volume = Predicted_Other_RF_Volume + Mode_Other_RF_Volume; Qwb_Ex = Max_WB_Rate; double Qac_Ex = Qwb_Ex / (AC_Ratio + 1); if (Qac_Ex < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } if (Replacement_Volume_Override == ReplacementVolumeType.Override) { if (Target_Replacement_Volume - RF_Used - Predicted_Replacement_Volume <= 0) { Predicted_Error = "Increase Replacement Volume"; } double Calculated_FCR = CalculatedFCRVR(Estimation_Hct, Avg_RF_Hct, Target_End_Hct, Target_Volume - Estimation_Volume, Estimation_Volume, Target_Replacement_Volume - RF_Used - Predicted_Replacement_Volume, (Qwb_Ex - Qac_Ex), 1); Target_FCR = Calculated_FCR * Estimation_FCR; if (Target_FCR < 0) { Predicted_Error = "Decrease Replacement Volume"; } if (Target_FCR >= Estimation_FCR) { Predicted_Error = "Decrease Target End Hct"; } } else { if (Target_FCR <= 0) { Predicted_Error = "Increase_Target_FCR"; } if (Target_FCR >= Estimation_FCR) { Predicted_Error = "Decrease Target FCR"; } } if ((Target_FCR / Estimation_FCR) >= (0.99 + ((Target_Volume - Estimation_Volume) / Estimation_Volume))) { Predicted_Error = "Increase Target Fluid Balance"; } double Qrf_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 1); double Qp_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 2); Est_Mode_Time = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 3); Max_Hct = Max(Estimation_Hct, Target_End_Hct); Plasma_AC_Fraction = 1 / (((1 - Max_Hct) * AC_Ratio) + 1); Estimated_CIR = (Qrf_Ex * Cit_Con_Rep_Fluid) + (Qp_Ex * Cit_Con_AC * Plasma_AC_Fraction); if (Estimated_CIR > CIR_Limit) { double CIR_Adjustment = CIR_Limit / Estimated_CIR; Qwb_Ex = Qwb_Ex * CIR_Adjustment; Qac_Ex = Qac_Ex * CIR_Adjustment; if (Qac_Ex < 1.3) { Predicted_Error = "AC Ratio Unachievable"; } Qrf_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 1); Qp_Ex = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 2); Est_Mode_Time = CalculatedFCR((Qwb_Ex - Qac_Ex), Estimation_Volume, (Target_Volume - Estimation_Volume), Estimation_Hct, Estimation_FCR, Target_End_Hct, Target_FCR, Avg_RF_Hct, 3); } prbc_Hct = 0.8; AC_Dilution = AC_Ratio / (AC_Ratio + 1); Max_Hct = Max(Estimation_Hct, Target_End_Hct); Hct_ACWB = AC_Dilution * Max_Hct; Qp_max = Qwb_Ex * (1 - (Hct_ACWB / prbc_Hct)); if (Qp_Ex > Qp_max) { Predicted_Error = "Unable to meet Hct"; } if (Qp_Ex < 1.3) { if (Qp_Ex <0 | Qp_Ex> 1E-07) { Predicted_Error = "Decrease Target End Hct"; } else { Qp_Ex = 0; } } if (Qrf_Ex > 150) { Predicted_Error = "Decrease Target Fluid Balance"; } if (Qrf_Ex < 1.3) { Predicted_Error = "Decrease Target FCR"; } Mode_RF_Volume = Qrf_Ex * Est_Mode_Time; Mode_Other_RF_Volume = 0; if (Estimation_Hct > Target_End_Hct) { Plasma_AC_Fraction_Start = 1 / (((1 - Estimation_Hct) * AC_Ratio) + 1); Plasma_AC_Fraction_End = 1 / (((1 - Target_End_Hct) * AC_Ratio) + 1); Plasma_AC_Fraction = (Plasma_AC_Fraction_Start + Plasma_AC_Fraction_End) / 2; } else { Plasma_AC_Fraction = 1 / (((1 - Target_End_Hct) * AC_Ratio) + 1); } //double Mode_Time = Est_Mode_Time; Estimation = RBCXTT(Qwb_Ex - Qac_Ex, Qrf_Ex, Qp_Ex, Avg_RF_Hct, Est_Mode_Time, Estimation_Volume, Estimation_Hct, Estimation_FCR); Current_Patient_Volume = Estimation[0]; Current_Patient_Hct = Estimation[1]; Current_FCR = Estimation[2]; Estimation_Volume = Current_Patient_Volume; Estimation_Hct = Current_Patient_Hct; Estimation_FCR = Current_FCR; Predicted_Replacement_Volume = Predicted_Replacement_Volume + Mode_RF_Volume; Predicted_Other_RF_Volume = Predicted_Other_RF_Volume + Mode_Other_RF_Volume; } } double Est_Other_RF = Predicted_Other_RF_Volume; double WB_Flow_Rate; if (Predicted_Error == "None") { if (Procedure_Type == ProcedureType.Depletion) { WB_Flow_Rate = Qwb_Dep; } else { WB_Flow_Rate = Qwb_Ex; } if (Replacement_Volume_Override == ReplacementVolumeType.Override) { FCR = Estimation_FCR; } else { Replacement_Volume = Predicted_Replacement_Volume; } } else { if (Replacement_Volume_Override == ReplacementVolumeType.Override) { FCR = 0; } else { Replacement_Volume = 0; } Est_Other_RF = 0; } if (Flag == 0) { var r = (Math.Pow( (Estimation_FCR * (Entered_Patient_Volume / Estimation_Volume) * (Entered_Patient_Hct / Estimation_Hct)), (FCR_Factor))) * 100; return(r.ToString()); } if (Flag == 1) { return(Replacement_Volume.ToString()); } if (Flag == 2) { Est_Other_RF.ToString(); } if (Flag == 3) { return(Predicted_Error); } return(null); }
public override string ToString() { string str = ""; if (IDUser != -1) { str += "&iduser=\"" + IDUser.ToString() + "\""; } if (!AccessToken.Equals("")) { str += "&accesstoken=\"" + Uri.EscapeDataString(AccessToken) + "\""; } if (FacebookID != -1) { str += "&iduser=\"" + FacebookID.ToString() + "\""; } if (!FirstName.Equals("")) { str += "&firstname=\"" + Uri.EscapeDataString(FirstName) + "\""; } if (!LastName.Equals("")) { str += "&lastname=\"" + Uri.EscapeDataString(LastName) + "\""; } if (Gender != -1) { str += "&gender=\"" + Gender.ToString() + "\""; } if (!Email.Equals("")) { str += "&email=\"" + Uri.EscapeDataString(Email) + "\""; } if (!Password.Equals("")) { str += "&password=\"" + Password + "\""; } if (!Location.Equals("")) { str += "&location=\"" + Location + "\""; } if (Height != -1) { str += "&height=\"" + Height.ToString() + "\""; } if (HeightType != -1) { str += "&heighttype=\"" + HeightType.ToString() + "\""; } if (Skeleton != 0) { str += "&skeleton=\"" + Skeleton.ToString() + "\""; } if (fertility != -1) { str += "&fertility=\"" + Fertility.ToString() + "\""; } if (Birthdate != null) { str += "&birthdate=\"" + Birthdate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (RemindDate != null) { str += "&reminddate=\"" + RemindDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (InsertDate != DateTime.MinValue) { str += "&insertdate=\"" + InsertDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (UpdateDate != DateTime.MinValue) { str += "&updatedate=\"" + UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (AdjustDiet != -1) { str += "&adjustdiet=\"" + AdjustDiet.ToString() + "\""; } return(str.Substring(1)); }
public void CreateMap() { // LOAD MAP cMap = SaveSystem.LoadMap(); // Create Grid PathfindingGridSetup.Instance.CreateGrid(cMap.mapWidth, cMap.mapHeight); float cellSize = PathfindingGridSetup.Instance.pathfindingGrid.GetCellSize(); Debug.Log("cellsize: " + cellSize); // Mini Map miniMapRenderer.materials[0].mainTexture = TextureGenerator.GetBiomeMapTexture(cMap.mapWidth, cMap.mapHeight, cMap.mapTiles, 0.05f, 0.18f, 0.4f); // Convert prefabs into entities var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blobAssetStore); NativeArray <Entity> entities = new NativeArray <Entity>(13, Allocator.Temp); entities[0] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabDesert, settings); entities[1] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabSavanna, settings); entities[2] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabTropicalRainforest, settings); entities[3] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabGrassland, settings); entities[4] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabWoodland, settings); entities[5] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabSeasonalForest, settings); entities[6] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabTemperateRainforest, settings); entities[7] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabBorealForest, settings); entities[8] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabTundra, settings); entities[9] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabIce, settings); entities[10] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabWater, settings); entities[11] = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefabDeepWater, settings); var manager = World.DefaultGameObjectInjectionWorld.EntityManager; for (int y = 0; y < cMap.mapHeight; y++) { for (int x = 0; x < cMap.mapWidth; x++) { var prefab = entities[GetPrefabFromType(cMap.mapTiles[x, y].BiomeType)]; HeightType height = cMap.mapTiles[x, y].HeightType; Entity instance; bool collidable = cMap.mapTiles[x, y].Collidable; if (height == HeightType.DeepWater) { instance = manager.Instantiate(entities[11]); PathfindingGridSetup.Instance.pathfindingGrid.GetGridObject(x, y).SetIsWalkable(false); } else if (height == HeightType.ShallowWater) { instance = manager.Instantiate(entities[10]); PathfindingGridSetup.Instance.pathfindingGrid.GetGridObject(x, y).SetIsWalkable(false); } else //(height != HeightType.DeepWater && height != HeightType.ShallowWater) { instance = manager.Instantiate(prefab); PathfindingGridSetup.Instance.pathfindingGrid.GetGridObject(x, y).SetIsWalkable(collidable); } var position = transform.TransformPoint(new float3(x + 0.5f, y + 0.5f, 1f)); manager.SetComponentData(instance, new Translation { Value = position }); } } }