示例#1
0
    def newDay(self):
        """
        Generates objects for each water event generated by a unit in a day. Objects contain relevant information on: the unit type where it was generated, the volume of the event
        and the time the event took place.
        """

        "Wash machine Events:"
        for i in range(len(self.__clothes_washes)):                         # For each wash:
            wash_time = DP.sampleCumDF(DB.SamplingDatabase.Instance().getDBTest(self.__unit_type,"DIURNAL_PATTERN"))          # Get the time that the wash cycle starts

            wash_event = WM.WashMachine(wash_time,self.__unit_type)              # Make an event object for each wash. This event contains info on the time and volume of the wash event

            self.__washEvents.append(wash_event)                                 # add each event to an array.

        "Dish washer Events:"

        for i in range(len(self.__dish_washes)):
            wash_time = DP.sampleCumDF(DB.SamplingDatabase.Instance().getDBTest(self.__unit_type,"DIURNAL_PATTERN"))

            wash_event = DW.DishWasher(wash_time,self.__unit_type)

            self.__dishWashEvents.append(wash_event)

        "Tap Events:"
        tot_volume = 0

        while tot_volume < self.__tap_volume:
            tap_use_time = DP.sampleCumDF(DB.SamplingDatabase.Instance().getDBTest(self.__unit_type,"DIURNAL_PATTERN"))

            tap_event = TP.Taps(tap_use_time,self.__tap_use_duration,self.__unit_type)

            self.__tapEvents.append(tap_event)

            tot_volume += tap_event.getVolume()
示例#2
0
    def newDay(self):
        """
        For each water use event that a actor has in a day, this method creates the  object of that Event for the actor.
        Where the Event represents:
            - The time of the day that the event begins

            - The flowrate/volume of the event

        This data is stored in a different array for each appliance . The events can then be called by other methods and their data extracted.
        """

        "Shower Events:"
        for i in range(len(
                self.__showers)):  # For each shower that a actor has:
            shower_time = DP.sampleCumDF(DB.SamplingDatabase.Instance(
            ).getDBTest(
                self.__actor_type,
                "DIURNAL_PATTERN"))  # Get the time that a actor has a shower

            shower_event = SE.ShowerEvent(
                shower_time, self.__shower_duration, self.__actor_type
            )  # Makes the physical object of the event. Where the event contains: Time, Duration and Flowrate. The actor gives time and duration to the ShowerEvent.
            # The class ShowerEvent makes the shower flowrate. All 3 of these objects are then attached to the physical event (made real)
            self.__showerEvents.append(
                shower_event)  # Appends each event to showerEvents

        "Toilet Events:"
        for i in range(len(self.__toilet_flushes)):  # For each flush:

            flush_time = DP.sampleCumDF(
                DB.SamplingDatabase.Instance().getDBTest(
                    self.__actor_type, "DIURNAL_PATTERN"
                ))  # Get the time that a actor flushes the toilet

            flush_event = TE.Toilet(
                flush_time, self.__actor_type
            )  # Make an event object for each toilet flush. This event contains info on the time of the flush and the flush volume

            self.__toiletEvents.append(
                flush_event)  # add each event to an array

        "Bath Events:"

        for i in range(len(self.__bath_uses)):  # For each bath:
            bath_use_time = DP.sampleCumDF(
                DB.SamplingDatabase.Instance().getDBTest(
                    self.__actor_type,
                    "DIURNAL_PATTERN"))  # Get the time the actor has the bath

            bath_event = BT.Bath(
                bath_use_time, self.__actor_type
            )  # Make an event object for each bath -- > contain the info on the time and volume

            self.__bathEvents.append(
                bath_event
            )  # append each event to the array. Used to store each object.
示例#3
0
    def newDay(self):
        """
        Generates objects for each water event generated by a unit in a day. Objects contain relevant information on: the unit type where it was generated, the volume of the event
        and the time the event took place.
        """

        "Wash machine Events:"
        for i in range(len(self.__clothes_washes)):  # For each wash:
            wash_time = DP.sampleCumDF(DB.SamplingDatabase.Instance(
            ).getDBTest(
                self.__unit_type,
                "DIURNAL_PATTERN"))  # Get the time that the wash cycle starts

            wash_event = WM.WashMachine(
                wash_time, self.__unit_type
            )  # Make an event object for each wash. This event contains info on the time and volume of the wash event

            self.__washEvents.append(wash_event)  # add each event to an array.

        "Dish washer Events:"

        for i in range(len(self.__dish_washes)):
            wash_time = DP.sampleCumDF(
                DB.SamplingDatabase.Instance().getDBTest(
                    self.__unit_type, "DIURNAL_PATTERN"))

            wash_event = DW.DishWasher(wash_time, self.__unit_type)

            self.__dishWashEvents.append(wash_event)

        "Tap Events:"
        tot_volume = 0

        while tot_volume < self.__tap_volume:
            tap_use_time = DP.sampleCumDF(
                DB.SamplingDatabase.Instance().getDBTest(
                    self.__unit_type, "DIURNAL_PATTERN"))

            tap_event = TP.Taps(tap_use_time, self.__tap_use_duration,
                                self.__unit_type)

            self.__tapEvents.append(tap_event)

            tot_volume += tap_event.getVolume()
示例#4
0
    def newDay(self):
        """
        For each water use event that a actor has in a day, this method creates the  object of that Event for the actor.
        Where the Event represents:
            - The time of the day that the event begins

            - The flowrate/volume of the event

        This data is stored in a different array for each appliance . The events can then be called by other methods and their data extracted.
        """

        "Shower Events:"
        for i in range(len(self.__showers)):                                 # For each shower that a actor has:
            shower_time = DP.sampleCumDF(DB.SamplingDatabase.Instance().getDBTest(self.__actor_type,"DIURNAL_PATTERN"))          # Get the time that a actor has a shower

            shower_event = SE.ShowerEvent(shower_time,self.__shower_duration,self.__actor_type)                    # Makes the physical object of the event. Where the event contains: Time, Duration and Flowrate. The actor gives time and duration to the ShowerEvent.
                                                                               # The class ShowerEvent makes the shower flowrate. All 3 of these objects are then attached to the physical event (made real)
            self.__showerEvents.append(shower_event)                               # Appends each event to showerEvents

        "Toilet Events:"
        for i in range(len(self.__toilet_flushes)):                         # For each flush:

            flush_time = DP.sampleCumDF(DB.SamplingDatabase.Instance().getDBTest(self.__actor_type,"DIURNAL_PATTERN"))         # Get the time that a actor flushes the toilet

            flush_event = TE.Toilet(flush_time,self.__actor_type)                             # Make an event object for each toilet flush. This event contains info on the time of the flush and the flush volume

            self.__toiletEvents.append(flush_event)                               # add each event to an array

        "Bath Events:"

        for i in range(len(self.__bath_uses)):                # For each bath:
            bath_use_time = DP.sampleCumDF(DB.SamplingDatabase.Instance().getDBTest(self.__actor_type,"DIURNAL_PATTERN"))    # Get the time the actor has the bath

            bath_event = BT.Bath(bath_use_time,self.__actor_type)                     # Make an event object for each bath -- > contain the info on the time and volume

            self.__bathEvents.append(bath_event)                    # append each event to the array. Used to store each object.