public static double CalculatingInsulinDose(int targerSugar, int currentSugar, UnitReductionUnits unitReductionUnits, double unitReductionValue, double insulinCarbohydrateRatio, DosageUnits dosageUnits, double mealCarbs) { if (unitReductionValue == 0 || insulinCarbohydrateRatio == 0) return 0; double insulinDosage = (currentSugar - targerSugar) / unitReductionValue + mealCarbs / insulinCarbohydrateRatio; return insulinDosage; }
public static double CalculateMealCarbs(int targerSugar, int currentSugar, UnitReductionUnits unitReductionUnits, double unitReductionValue, double insulinCarbohydrateRatio, DosageUnits dosageUnits, double insulinDosage) { if (unitReductionValue == 0) return 0; double mealCarbs = (insulinDosage - (currentSugar - targerSugar) / unitReductionValue) * insulinCarbohydrateRatio; return mealCarbs; }