Esempio n. 1
0
    def mill_grains(self, recipe, request_number):  # Mill_grains process start
        """
        The start of milling grains
        :param request_number: a brew batch request number
        :param recipe: recipe instance
        :return: Return Log
        """
        self.mill_time = recipe.get_mill_time()
        self.grains_weight = recipe.get_grain_weight(recipe.get_grain())

        try:
            # log to begin process
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Starting Mashing Process\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Milling", "Milling Started",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.Milling",
                                               "Milling Started")

            while self.mill_time > 0:
                print("Milling Time Left: ", self.mill_time, "min")
                time.sleep(sleep_time)
                self.mill_time -= 1

                if self.mill_time == 0:
                    print("Grains milled")
                    print("-----------------------------------------")

            # log to end process
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Milling Ended\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(2, "Mashing.Milling", "Milling Ended",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.Milling",
                                               "Milling Ended")
            self.send_grains_to_sparging_tank(recipe, request_number)
        except Exception as e:  # error handling
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Mashing Process Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Milling", "Milling Started",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.Milling",
                                               "Milling Failed")
            print(e)
Esempio n. 2
0
    def separate_wort(self, recipe, request_number):
        # Separates the wort from the mash
        """
        Displays a count down while wort separation is in process
        :param recipe: a recipe instance
        :param request_number: a brew batch request number
        :return: Current date, time and count down to separating wort.
        """

        self.separation_time = recipe.get_wort_separation_time()

        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Separating Wort\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(4, "Mashing.Wort", "Wort Separation Started", datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Wort Separation Started")

            # Counts the separation time in seconds
            while self.separation_time > 0:
                print("Wort Separating Time Left: ", self.separation_time, "min")
                time.sleep(sleep_time)
                self.separation_time -= 1

                # Verifies that the wort separation has been completed.
                if self.separation_time == 0:
                    print("Wort Separation Completed")
                    print("-----------------------------------------")

            # Generates a log and displays the process has been successfully completed.
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Wort Separated\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(5, "Mashing.Wort", "Wort Separation Ended", datetime.datetime.now(), "pass")
            print(log.generate_log())
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Wort Separation Ended")

            print("-----------------------------------------")

            print("Wort Separated from Mash")
            print("-----------------------------------------")
            return True

        except Exception as e:  # error handling
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Wort Separation Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Wort", "Wort Separation Failed", datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Wort Separation Failed")

            print(e)
Esempio n. 3
0
 def sanitization(self, request_number):
     """
     Main method that runs the sanitation process to clean equipment
     Completion is done by pressing enter and sends logging to ServiceNOW throughout the process
     :param request_number: a brew batch request number
     :return: void
     """
     log_no = 0
     try:
         time.sleep(sleep_time)
         log_no += 1
         status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Sanitization\"}"
         sn_log = ServiceNowLog()
         ServiceNowLog.create_new_log(sn_log, status_log)
         log = Log(log_no, "Prep.Sanitization", "Asked for manual input if Sanitization completed.",
                   datetime.datetime.now(),
                   "pass")
         print(log.generate_log())
         ml = MongoLogging.MongoLogging()
         MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.Sanitization", "Asked for manual input if Sanitization completed")
         time.sleep(sleep_time * 2)
         input("\033[1m" + "\n    1. Press Enter when sanitization is done:" + "\033[0m \n")
         # GPIO.wait_for_edge(self.button,GPIO.FALLING)
         time.sleep(sleep_time)
         # noinspection PyRedundantParentheses
         message = ("   Sanitization Completed.\n")
         print("\t\t" + message + "\n")
         log_no += 1
         status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Sanitization\"}"
         sn_log = ServiceNowLog()
         ServiceNowLog.create_new_log(sn_log, status_log)
         log = Log(log_no, "Prep.Sanitization", "Sanitization done - Input received.", datetime.datetime.now(),
                   "pass")
         print(log.generate_log())
         ml = MongoLogging.MongoLogging()
         MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.Sanitization", "Sanitization done -Input received.")
         time.sleep(sleep_time * 2)
     except Exception as e:
         print(e)
         log_no += 1
         status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Sanitization\"}"
         sn_log = ServiceNowLog()
         ServiceNowLog.create_new_log(sn_log, status_log)
         log = Log(int(log_no), "Prep.Sanitization", "Input for Sanitization completed failed.",
                   datetime.datetime.now(),
                   "fail")
         print(log.generate_log())
         ml = MongoLogging.MongoLogging()
         MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.Sanitization", "Input for Sanitization completed failed")
         time.sleep(sleep_time * 2)
     return log_no
Esempio n. 4
0
    def add_water(self, recipe, request_number):
        """
        Water added to tank from hot liquor tank (HLT)
        :param recipe: a recipe instance
        :param request_number: a brew batch request number
        :return:
        """
        try:
            #adding heated water to tank

            self.water_temp = recipe.get_water_temp()

            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Adding Hot Water to Tank\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Sparging", "Heated water added to tank",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.Sparging",
                                               "Heated water added to tank")

            print("-----------------------------------------"
                  )  # prints line to separate statements & log 1 is created

            print("Water Temp: ", self.water_temp,
                  "degrees F")  # displays water temp in degrees F
            print("Added Heated Water to Sparging Tank"
                  )  # print validates the process of water being heated
            print(
                "-----------------------------------------"
            )  # prints line to separate the next process in sparging tank

            self.stir_mash(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Adding Hot Water to Tank Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Sparging", "Adding Hot Water to Tank Failed",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(
                ml, request_number, "Mashing.Sparging",
                "Adding Hot Water to Tank Failed")

            print(e)
 def qa(self, brew_master_id, request_number):
     """
     Function for quality testing
     :param brew_master_id: the ID of the brew master
     :return: pass or fail and Log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Checking Quality Assurance\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(12, "Ferment.QualityAssurance", "Quality Assurance",
               datetime.datetime.now(), "fail")
     print(log.generate_log())
     try:
         difference = self.final_gravity - self.original_gravity
         measured_abv = (difference * 131.25)
         abs(measured_abv) == measured_abv
         if measured_abv == self.base_abv:
             log = Log(13, "Ferment.QualityAssurance", "Quality Assurance",
                       datetime.datetime.now(), "pass")
             print(log.generate_log())
     except Exception as e:
         print(e)
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Checked Quality Assurance")
     print("-----------------------------------------")
     self.send_to_kegging(request_number)
Esempio n. 6
0
    def kc_log(self, batch_id, bb_stage, log_message):
        """
        Logging Method for the Keg Count

        :param batch_id: The batch ID of the current batch
        :param bb_stage: The current Brewing Stage
        :param log_message: The main log message
        :return: Sends a log to ServiceNow with timestamp appended to the beginning of the log message

        """
        try:
            currentTimeStamp = '{:%Y-%m-%d %H:%M:%S}'.format(
                datetime.datetime.now())
            status_log = "{\"batch_id\":\"" + str(
                batch_id) + "\", \"brew_batch_stage\":\"" + str(
                    bb_stage
                ) + "\", \"log\":\"" + currentTimeStamp + " " + str(
                    log_message) + "\"}"
            ServiceNowLog.ServiceNowLog.create_new_log(
                ServiceNowLog.ServiceNowLog(), status_log)
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, batch_id, "Kegging",
                                               log_message)
            kc_loglist.append(status_log)
        except Exception as e:
            print("Keg Count Log Error:  " + str(e))
 def measure_final_gravity(self, request_number):
     """
     Function to measure the final gravity (FG) of the mixture
     :param: self
     :return: return Log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\" Measuring Final Gravity\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(9, "Ferment.FinalGravity", "Measuring Final Gravity",
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     base_measurement = 0
     try:
         while base_measurement < self.final_gravity:
             print("Measuring Final Gravity: ", base_measurement,
                   "g/mL")  # grams per milli-Liter
             time.sleep(sleep_time)
             base_measurement += 0.050
             if base_measurement == self.final_gravity:
                 print("Final Gravity has been measured")
                 print("-----------------------------------------")
                 log = Log(10, "Ferment.MeasureFinalGravity",
                           " Final gravity measured ",
                           datetime.datetime.now(), "pass")
                 print(log.generate_log())
     except Exception as ex:
         print(ex)
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Measured Final Gravity")
     print("-----------------------------------------")
     self.drain_ale(request_number)
 def measure_original_gravity(self, request_number):
     """
     Function for taking the original gravity (OG) reading of the mixture
     :param: self
     :return: Return log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Measuring Original Gravity\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(3, "Ferment.Measure Original Gravity",
               "Measuring original gravity ", datetime.datetime.now(),
               "pass")
     print(log.generate_log())
     base_measurement = 0
     try:
         while base_measurement < self.original_gravity:
             print("Measuring: ", base_measurement,
                   "g/mL")  # grams per milli-Liter
             time.sleep(sleep_time)
             base_measurement += 0.050
             if base_measurement == self.original_gravity:
                 print("Original Gravity has been measured")
                 print("-----------------------------------------")
                 log = Log(4, "Ferment.MeasureOriginalGravity",
                           " Original gravity measured ",
                           datetime.datetime.now(), "pass")
                 print(log.generate_log())
     except Exception as ex:
         print(ex)
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Measured Original Gravity")
     print("-----------------------------------------")
     self.add_yeast(request_number)
 def begin_fermentation_process(self, request_number):
     """
     Function to begin fermentation process
     :param: self
     :return: return Log and brewed Ale
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\" Fermentation had begun\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(7, "Ferment.beginFermentationProcess",
               "Beginning Fermentation Process", datetime.datetime.now(),
               "pass")
     print(log.generate_log())
     try:
         while self.ferment_time > 0:
             print("Fermentation time Left: ", self.ferment_time, "sec")
             time.sleep(sleep_time)
             self.ferment_time -= 1
             if self.ferment_time == 0:
                 print("Fermentation has completed")
                 print("-----------------------------------------")
                 log = Log(8, "Ferment.beginFermentationProcess",
                           "Fermentation has completed",
                           datetime.datetime.now(), "pass")
                 print(log.generate_log())
     except Exception as ex:
         print(ex)
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Fermentation has begun")
     print("-----------------------------------------")
     self.measure_final_gravity(request_number)
Esempio n. 10
0
 def get_QA_Check(self, request_number):
     text = input(
         "Please Inspect the Brew Quality. Does it Meet Our Standards (Yes/No)?: "
     )
     # save text as variable
     quality_checked = text
     while quality_checked != "Yes" or quality_checked != "No":
         if quality_checked == "Yes":
             print("Logging to ServiceNow...")
             sleep(sleep_time)
             status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Boiling\", \"log\":\"Finished Boiling; Passed QA\"}"
             sn_log = ServiceNowLog()
             ServiceNowLog.create_new_log(sn_log, status_log)
             sleep(sleep_time)
             print("Logging to MongoDB...")
             sleep(sleep_time)
             ml = MongoLogging.MongoLogging()
             MongoLogging.MongoLogging.MongoLog(
                 ml, request_number, "Boiling",
                 "Finished Boiling; Passed QA")
             sleep(sleep_time)
             print(
                 "Successfully logged that Boil has completed and passes Quality Assurance."
             )
             sleep(sleep_time)
             return True
             # Call Team Ferment
         elif quality_checked == "No":
             print("Logging to ServiceNow...")
             sleep(sleep_time)
             status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Boiling\", \"log\":\"Finished Boiling; Failed QA\"}"
             sn_log = ServiceNowLog()
             ServiceNowLog.create_new_log(sn_log, status_log)
             sleep(sleep_time)
             sleep(sleep_time)
             print("Logging to MongoDB...")
             sleep(sleep_time)
             ml = MongoLogging.MongoLogging()
             MongoLogging.MongoLogging.MongoLog(
                 ml, request_number, "Boiling",
                 "Finished Boiling; Failed QA")
             print("Quality Did not Pass, Please inspect and trash.")
             sleep(sleep_time)
             return False
         else:
             text = input("Please Enter Yes or No: ")
             quality_checked = text
    def heat_water(self, recipe,
                   request_number):  # Water heating process starts
        """
        The start of water heating
        :param request_number: a brew request number
        :param recipe: a recipe instance
        :return: return log
        """

        self.water_amount = recipe.get_water_volume()
        self.water_temp = recipe.get_water_temp()

        try:
            # log to begin process
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Water heating\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.HotLiquorTank", "Water heating started.",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")

            print("Water Temperature Heated To: ", self.water_temp,
                  " degrees F")
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.HotLiquorTank",
                                               "Water heating started")

            self.check_water_temp(recipe, request_number)

        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Water Heating Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Milling", "Water Heating Failed",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.HotLiquorTank",
                                               "Water Heating Failed")
            print(e)
    def send_hot_water_to_sparging_tank(self, recipe, request_number):
        """
        Sends water to sparging tank
        :param recipe: a recipe instance
        :param request_number: a bre batch request number
        :return: print statement
        """
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Hot Water to Sparging Tank\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(3, "Mashing.HotLiquorTank",
                      "Sending Hot Water to Sparging Tank",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")

            print("Hot water is sent to Sparging Tank.")
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(
                ml, request_number, "Mashing.HotLiquorTank",
                "Hot water is sent to Sparging Tank")

            st = SpargingTank()
            st.add_water(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Hot Water to Sparging Tank Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.HotLiquorTank",
                      "Sending Hot Water to Sparging Tank Failed",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(
                ml, request_number, "Mashing.HotLiquorTank",
                "Sending Hot Water to Sparging Tank Failed")

            print(e)
 def sanitization(self, request_number):
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Sanitizing Vessel\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(14, "Ferment.sanitize_vessels", datetime.datetime.now(),
               "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Sanitizing Vessels")
     print("-----------------------------------------")
Esempio n. 14
0
    def sparg_the_tank(self, recipe, request_number):
        #empty the tank while spraying water over the remaing grains
        """
        Function to remove finished wort from Sparging tank.
        :param recipe: a Recipe Instance
        :param request_number: a brew batch request number
        :return: Return log 4
        """
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sparging the Tank\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(4, "Mashing.Sparging", "Sparging the Tank",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.Sparging",
                                               "Sparging the Tank")

            print("-----------------------------------------"
                  )  # prints line to separate statements & log 4 is created

            print("Tank emptying, washing grains."
                  )  # Finishing before sending it to the boiling phase
            print("-----------------------------------------")
            w = Wort()
            w.check_hot_water_temp(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sparging the Tank Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Sparging", "Sparging the Tank Failed",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.Sparging",
                                               "Sparging the Tank Failed")

            print(e)
    def check_water_volume(self, recipe, request_number):
        """
        Getter for water volume
        :param recipe: a recipe instance
        :param request_number: a brew batch request number
        :return: water volume.
        """
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(3, "Mashing.HotLiquorTank", "Checking Water Volume",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")

            print("Water Volume: ", self.water_amount, "gallons")
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.HotLiquorTank",
                                               "Checking Water Volume")

            self.send_hot_water_to_sparging_tank(recipe, request_number)

        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1,
                      "Mashing.HotLiquorTank", "Checking Water Volume Failed",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.HotLiquorTank",
                                               "Checking Water Volume Failed")
            print(e)
Esempio n. 16
0
    def send_grains_to_sparging_tank(self, recipe, request_number):
        """
        Adds grains to the Sparging Tank
        :param recipe: a Recipe instance
        :param request_number: a bre batch request number
        :return: print statement
        """
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Grains to Sparging Tank\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(3, "Mashing.Milling", "Send Grains to Sparging Tank",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")

            print("Grains added to Sparging Tank")
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(
                ml, request_number, "Mashing.Milling",
                "Sending Grains to Sparging Tank")

            hlt = HotLiquorTank()
            hlt.heat_water(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Grains to Sparging Tank Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Milling", "Sending Grains to Sparging Tank",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(
                ml, request_number, "Mashing.Milling",
                "Sending Grains to Sparging Tank Failed")

            print(e)
    def check_water_temp(self, recipe, request_number):
        """
        Checks the current temperature of the water.
        :param recipe: Recipe instance
        :param request_number: a brew batch request number
        :return: current water temperature
        """
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temp\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(2, "Mashing.HotLiquorTank", "Checking Water Temperature",
                      datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")

            print("Water Temperature: ", self.water_temp, "degrees F")
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.HotLiquorTank",
                                               "Checking Water Temperature")

            self.check_water_volume(recipe, request_number)

        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temperature Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.HotLiquorTank", "Checking Water Temperature",
                      datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number,
                                               "Mashing.HotLiquorTank",
                                               "Water Temperature Failed")
            print(e)
Esempio n. 18
0
    def check_wort_volume(self, recipe, request_number):    # Wort Volume? Should we use it as BatchSize
        # Displays wort volume
        """
        Displays the correct wort volume / generates a log
        :param recipe: a recipe instance
        :param request_number: a brew batch request number
        :return: Current date, time and correct wort volume / and a log
        """

        self.wort_volume = recipe.get_wort_volume()

        # Records correct wort volume to Log
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Check Wort Volume\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(3, "Mashing.Wort", "Check Wort Volume", datetime.datetime.now(), "pass")
            print(log.generate_log())

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Check Wort Volume")

            print("-----------------------------------------")

            print("Wort Volume: ", self.wort_volume, "gallons")
            print("-----------------------------------------")

            self.separate_wort(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Check Wort Volume Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Wort", "Check Wort Volume Failed", datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")

            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Check Wort Volume Failed")

            print(e)
Esempio n. 19
0
    def check_hot_water_temp(self, recipe, request_number):
        # Checks for water temperature
        """
        Displays correct water temp in the wort phase / generates a log
        :param recipe: a recipe instance
        :param request_number: a brew batch request number
        :return: Displays current date, time and correct water temperature
        """

        self.hot_water_temp = recipe.get_water_temp()

        # Records correct hot water temp to Log
        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temp\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Wort", "Checking Water Temp", datetime.datetime.now(), "pass")
            print(log.generate_log())
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Temp")

            print("-----------------------------------------")

            print("Hot Water Temperature: ", self.hot_water_temp, "degrees F")
            print("-----------------------------------------")

            self.check_water_volume(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temp Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Wort", "Checking Water Temp Failed", datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Temp Failed")

            print(e)
Esempio n. 20
0
    def check_water_volume(self, recipe, request_number):
        # Checks for water volume
        """
        Displays the correct water volume / generates a log
        :param recipe: a recipe instance
        :param request_number: a brew batch request number
        :return: Current date, time and correct water volume
        """

        self.water_volume = recipe.get_water_volume()

        try:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(2, "Mashing.Wort", "Checking Water Volume", datetime.datetime.now(), "pass")
            print(log.generate_log())
            print("-----------------------------------------")

            print("Water Volume: ", self.water_volume, "gallons")
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Volume")

            self.check_wort_volume(recipe, request_number)
        except Exception as e:
            status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume Failed\"}"
            sn_log = ServiceNowLog()
            ServiceNowLog.create_new_log(sn_log, status_log)
            log = Log(1, "Mashing.Wort", "Checking Water Volume Failed", datetime.datetime.now(), "fail")
            print(log.generate_log())
            print("-----------------------------------------")
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Volume Failed")

            print(e)
 def drain_ale(self, request_number):
     """
     Function to drain Ale
     :param: self
     :return: Return log and filtered Ale
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Draining Ale\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(11, "Ferment.drainAle", "Draining Ale. Sending to QA",
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Draining Ale")
     print("-----------------------------------------")
     self.qa(self.brew_master_id, request_number)
 def close_lid(self, request_number):
     """
     Function for closing lid
     :param: self
     :return: Return log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Closing lid of vessel\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(6, "Ferment.closeLid", "Closing lid",
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Closing Fermentation Vessel Lid")
     print("-----------------------------------------")
     self.begin_fermentation_process(request_number)
 def send_to_kegging(self, request_number):
     """
     Function to send filtered Ale to Team Kegging
     :param: self
     :return: Return Log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Sending Ale to the Kegging Process\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(13, "Ferment.send_to_kegging", "Ale sent to kegging",
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(
         ml, request_number, "Fermentation",
         "Sending Ale to the Kegging Process")
     print("-----------------------------------------")
    def get_wort(self, request_number):
        """
        Function for receiving the wort
        :param request_number: the ID of the current batch
        :return: Return log
        """

        status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Starting Fermentation Process\"}"
        ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
        log = Log(1, "Receiving wort", "Received wort from Team Boil",
                  datetime.datetime.now(), "pass")
        print(log.generate_log())
        ml = MongoLogging.MongoLogging()
        MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                           "Starting Fermentation Process")
        print("-----------------------------------------")
        self.add_to_fermentation_vessel(request_number)
 def set_ferment_temperature(self, request_number):
     """
     Function for setting the temperature of the mixture to ferment
     :param: self
     :return: Return fermentation temperature
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\" Setting fermentation temperature\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(7, "Ferment.setFermentTemperature",
               "Temperature is set at %.2f" % self.ferment_temp,
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation",
                                        "Setting Fermentation Temperature")
     print("-----------------------------------------")
     self.begin_fermentation_process(request_number)
 def add_to_fermentation_vessel(self, request_number):
     """
     Function for adding the wort to fermentation vessel
     :param: vessel_id : the ID of the vessel
     :return: Return log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Wort added to Vessel\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(2, "Addition to Fermentation Vessel",
               "Adding wort to fermentation vessel ",
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(
         ml, request_number, "Fermentation",
         "Wort added to Fermentation Vessel")
     print("-----------------------------------------")
     self.measure_original_gravity(request_number)
 def add_yeast(self, request_number):
     """
     Function for adding activated yeast to the fermentation vessel with wort
     :param: self
     :return: Return Log
     """
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Adding yeast to vessel\"}"
     ServiceNowLog.ServiceNowLog.create_new_log(self, status_log)
     log = Log(5, "Ferment.addYeast",
               "Activated yeast has been added to the fermentation vessel",
               datetime.datetime.now(), "pass")
     print(log.generate_log())
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(
         ml, request_number, "Fermentation",
         "Adding Yeast to Fermentation Vessel")
     print("-----------------------------------------")
     self.close_lid(request_number)
     return ("Yeast added")
Esempio n. 28
0
 def print_start_info(self, request_number, boil_temp, boil_time,
                      stage_date_time):
     """
     Prints start stage information to the screen
     :param request_number:
     :param stage_date_time: Start time of the stage
     :param boil_time: Time boil lasts
     :param boil_temp: Temperature
     :param is_boiling: Is it boiling
     """
     print("Starting Boil Stage")
     sleep(sleep_time)
     print("Logging to ServiceNow...")
     sleep(sleep_time)
     status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Boiling\", \"log\":\"Starting Boil Process\"}"
     sn_log = ServiceNowLog()
     ServiceNowLog.create_new_log(sn_log, status_log)
     sleep(sleep_time)
     print("Logging to MongoDB...")
     sleep(sleep_time)
     ml = MongoLogging.MongoLogging()
     MongoLogging.MongoLogging.MongoLog(ml, request_number, "Boiling",
                                        "Starting Boil Process")
     print("Successfully logged that Boil Stage has started")
     print("-----------------------------------------")
     sleep(sleep_time)
     print("Start Time:", stage_date_time)
     sleep(sleep_time)
     print("Boil Time:", boil_time, "Minutes")
     sleep(sleep_time)
     print("Boil Temp:", boil_temp, "Degrees Celsius")
     print("-----------------------------------------")
     sleep(sleep_time)
     print("Turning on Burner...")
     sleep(sleep_time * 3)
     print("Burner is up to temp! Temperature =", boil_temp, "degrees")
     sleep(sleep_time)
     print('Now boiling for', boil_time, "Minutes...")
Esempio n. 29
0
 def keg_log(self, bb_stage, log_message):
     """
     Dynamic loging method
     :param bb_stage: The brew batch stage (Kegging)
     :param log_message: Log message
     :return: creates a log message in JSON string format
     """
     try:
         batch_id = self.batch_id
         currentTimeStamp = '{:%Y-%m-%d %H:%M:%S}'.format(
             datetime.datetime.now())
         status_log = "{\"batch_id\":\"" + str(
             batch_id) + "\", \"brew_batch_stage\":\"" + str(
                 bb_stage
             ) + "\", \"log\":\"" + currentTimeStamp + " " + str(
                 log_message) + "\"}"
         ServiceNowLog.ServiceNowLog.create_new_log(
             ServiceNowLog.ServiceNowLog(), status_log)
         ml = MongoLogging.MongoLogging()
         MongoLogging.MongoLogging.MongoLog(ml, batch_id, "Kegging",
                                            log_message)
     except Exception as e:
         print("Kegging Main Logging Error: " + str(e))
Esempio n. 30
0
    def tt_log(self, batch_id, bb_stage, log_message):
        """

        :param batch_id: batch_id or request_id of the current beer batch
        :param bb_stage: current stage in the brewing Process
        :param log_message: the message or log that will be sent to service now or appened to the log list
        :return: sends a log with timestamp to ServiceNow and appends to the log list
        """
        try:
            currentTimeStamp = '{:%Y-%m-%d %H:%M:%S}'.format(
                datetime.datetime.now())
            status_log = "{\"batch_id\":\"" + str(
                batch_id) + "\", \"brew_batch_stage\":\"" + str(
                    bb_stage
                ) + "\", \"log\":\"" + currentTimeStamp + " " + str(
                    log_message) + "\"}"
            ServiceNowLog.ServiceNowLog.create_new_log(
                ServiceNowLog.ServiceNowLog(), status_log)
            ml = MongoLogging.MongoLogging()
            MongoLogging.MongoLogging.MongoLog(ml, batch_id, "Kegging",
                                               log_message)
            tt_loglist.append(status_log)
        except Exception as e:
            print("Taste Test Logging error:" + str(e))