예제 #1
0
    def calcWashVolume(self):

        self.__wash_volume = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDB("DISH_WASHER_VOLUME_DATABASE"))     # sample wash volume from a distribution.

        if type(self.__wash_volume) == str:                                         # if the bin selected represents a range (e.g 30-40L):

            self.__wash_volume = SB.sampleDataBin(self.__wash_volume)                     # then randomly sample between this range.
예제 #2
0
    def calcTapFlowRate(self):
        """
        Calculates the flow rate of a tap. Requires an input file with a probability distribution for different flowrates.
        """
        self.__flowrate = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDB("TAP_FLOWRATE_DATABASE"))

        if type(self.__flowrate) == str:                    # if selected flow rate isn't a number i.e. is in 0.2-0.4 L/min format, than sample from this bin:
            self.__flowrate = SB.sampleDataBin(self.__flowrate)     # returns a flow rate between 0.2-0.4 e.g. 0.35
예제 #3
0
    def calcShowerFlowRate(self):
        """
        Calculates the flow rate of a shower. Requires an input file with a probability distribution for different flowrates
        """
        self.__flowrate = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDB("SHOWER_FLOWRATE_DATABASE"))                # get flow rate from input distribution

        if type(self.__flowrate) == str:                    # if selected flow rate isn't a number i.e. is in 0.2-0.4 L/min format, than sample from this bin:

            self.__flowrate = SB.sampleDataBin(self.__flowrate)
예제 #4
0
    def calcFlushVolume(self):

        self.__flush_volume = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDB("TOILET_FLUSH_VOLUME_DATABASE"))

        if type(self.__flush_volume) == str:

            self.__flush_volume = SB.sampleDataBin(self.__flush_volume)

        return self.__flush_volume
예제 #5
0
    def calcTapUseDuration(self):
        """
        input: requires a input distribution of relative frequencies for different tap use durations (minutes)
        :return: the length of time of one tap even for a actor.
        """
        self.__tap_use_duration = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDB("TAP_USE_DURATION_DATABASE"))

        if type(self.__tap_use_duration) == str:

            self.__tap_use_duration = SB.sampleDataBin(self.__tap_use_duration)
예제 #6
0
    def calcFlushVolume(self):

        self.__flush_volume = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDB(
                "TOILET_FLUSH_VOLUME_DATABASE"))

        if type(self.__flush_volume) == str:

            self.__flush_volume = SB.sampleDataBin(self.__flush_volume)

        return self.__flush_volume
예제 #7
0
    def calcTapUseDuration(self):
        """
        input: requires a input distribution of relative frequencies for different tap use durations (minutes)
        :return: the length of time of one tap even for a actor.
        """
        self.__tap_use_duration = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDB("TAP_USE_DURATION_DATABASE"))

        if type(self.__tap_use_duration) == str:

            self.__tap_use_duration = SB.sampleDataBin(self.__tap_use_duration)
예제 #8
0
    def calcBathUseFrequency(self):
        """
        input: requires a input distribution of relative frequencies (sum = 1) for different bath use frequencies (i.e. the number of baths a actor has a day)
        return: a float number representing the number of baths a actor has per day.

        """
        self.__bath_frequency = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDBTest(self.__actor_type, "BATH_FREQUENCY_DATABASE"))     # Get the bath frequency for one actor

        if type(self.__bath_frequency) == str:                                               # if the frequency is not a single number, but a range i.e 0.2-0.4 then sample from this bin:

            self.__bath_frequency = SB.sampleDataBin(self.__bath_frequency)                               # call helper function to sample from bin
예제 #9
0
    def calcShowerFlowRate(self):
        """
        Calculates the flow rate of a shower. Requires an input file with a probability distribution for different flowrates
        """
        self.__flowrate = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDB("SHOWER_FLOWRATE_DATABASE")
        )  # get flow rate from input distribution

        if type(
                self.__flowrate
        ) == str:  # if selected flow rate isn't a number i.e. is in 0.2-0.4 L/min format, than sample from this bin:

            self.__flowrate = SB.sampleDataBin(self.__flowrate)
예제 #10
0
    def calcTapFlowRate(self):
        """
        Calculates the flow rate of a tap. Requires an input file with a probability distribution for different flowrates.
        """
        self.__flowrate = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDB("TAP_FLOWRATE_DATABASE"))

        if type(
                self.__flowrate
        ) == str:  # if selected flow rate isn't a number i.e. is in 0.2-0.4 L/min format, than sample from this bin:
            self.__flowrate = SB.sampleDataBin(
                self.__flowrate
            )  # returns a flow rate between 0.2-0.4 e.g. 0.35
예제 #11
0
    def calcShowerFrequency(self):
        """
        This method generates a number which represents how often a actor has a shower during the day. i.e. if frequency = 1, they have a shower everyday. If frequency = 1.2 (>1), they have a shower every day + there is
        a possibility that they will have a 2nd shower. If frequency = 0.6 (<1) they dont have a shower everyday, maybe every 2nd day

        Inputs: requires input data that represents the probability for different shower frequencies. Where the sum of the probabilities = 1

        NOTE: Shower Frequency remains constant for a actor. It is not re-sampled every day. This is to replicate behaviour patterns that people would have in terms of their shower frequency.
        """

        self.__shower_frequency = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDBTest(self.__actor_type, "SHOWER_FREQUENCY_DATABASE"))     # Get the shower frequency for one actor

        if type(self.__shower_frequency) == str:                                               # if the frequency is not a single number, but a range i.e 0.2-0.4 then sample from this bin:

            self.__shower_frequency = SB.sampleDataBin(self.__shower_frequency)                               # call helper function to sample from bin
예제 #12
0
    def calcToiletFlushFreq(self):
        """
        Method used to calculate how many times a actor flushes the toilet in a day (frequency). It does this by sampling a relative frequency distribution (input),
        which returns a float value e.g. 3.4. This would mean that a actor goes to the toilet 3 times a day, and have a probability of 0.4 of going a 4th time.

        The output (flush frequency), is used by the def calcToiletFlushes which makes an array of 1's for each time a toilet flushes a toilet.
        """

        "Calculate the number of flushes per day:"

        self.__toilet_flush_freq = CD.getSampledCumValue(DB.SamplingDatabase.Instance().getDBTest(self.__actor_type,"TOILET_FLUSH_FREQ_DATABASE"))

        if type(self.__toilet_flush_freq) == str:                               # if the frequency bin represents a range e.g 2-3 flushes, then sample from this:

            self.__toilet_flush_freq = SB.sampleDataBin(self.__toilet_flush_freq)      # call helper function to sample from bin.
    def calcWashVolume(self):
        """
        This method determines the volume of water used by washing one load of clothes.
        INPUTS: the volume distribution file for the relevant WM type (front/top loader) --> determined in def washMachineType

        OUTPUTS: A float number of volume used for one wash. Assigned to the object self.__wash_volume
        """
        self.__wash_volume = CD.getSampledCumValue(
            self.__machine_type)  # sample wash volume from a distribution.

        if type(
                self.__wash_volume
        ) == str:  # if the bin selected represents a range (e.g 30-40L):

            self.__wash_volume = SB.sampleDataBin(
                self.__wash_volume)  # then randomly sample between this range.
예제 #14
0
    def calcBathUseFrequency(self):
        """
        input: requires a input distribution of relative frequencies (sum = 1) for different bath use frequencies (i.e. the number of baths a actor has a day)
        return: a float number representing the number of baths a actor has per day.

        """
        self.__bath_frequency = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDBTest(
                self.__actor_type, "BATH_FREQUENCY_DATABASE"
            ))  # Get the bath frequency for one actor

        if type(
                self.__bath_frequency
        ) == str:  # if the frequency is not a single number, but a range i.e 0.2-0.4 then sample from this bin:

            self.__bath_frequency = SB.sampleDataBin(
                self.__bath_frequency
            )  # call helper function to sample from bin
예제 #15
0
    def calcToiletFlushFreq(self):
        """
        Method used to calculate how many times a actor flushes the toilet in a day (frequency). It does this by sampling a relative frequency distribution (input),
        which returns a float value e.g. 3.4. This would mean that a actor goes to the toilet 3 times a day, and have a probability of 0.4 of going a 4th time.

        The output (flush frequency), is used by the def calcToiletFlushes which makes an array of 1's for each time a toilet flushes a toilet.
        """

        "Calculate the number of flushes per day:"

        self.__toilet_flush_freq = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDBTest(
                self.__actor_type, "TOILET_FLUSH_FREQ_DATABASE"))

        if type(
                self.__toilet_flush_freq
        ) == str:  # if the frequency bin represents a range e.g 2-3 flushes, then sample from this:

            self.__toilet_flush_freq = SB.sampleDataBin(
                self.__toilet_flush_freq
            )  # call helper function to sample from bin.
예제 #16
0
    def calcShowerFrequency(self):
        """
        This method generates a number which represents how often a actor has a shower during the day. i.e. if frequency = 1, they have a shower everyday. If frequency = 1.2 (>1), they have a shower every day + there is
        a possibility that they will have a 2nd shower. If frequency = 0.6 (<1) they dont have a shower everyday, maybe every 2nd day

        Inputs: requires input data that represents the probability for different shower frequencies. Where the sum of the probabilities = 1

        NOTE: Shower Frequency remains constant for a actor. It is not re-sampled every day. This is to replicate behaviour patterns that people would have in terms of their shower frequency.
        """

        self.__shower_frequency = CD.getSampledCumValue(
            DB.SamplingDatabase.Instance().getDBTest(
                self.__actor_type, "SHOWER_FREQUENCY_DATABASE")
        )  # Get the shower frequency for one actor

        if type(
                self.__shower_frequency
        ) == str:  # if the frequency is not a single number, but a range i.e 0.2-0.4 then sample from this bin:

            self.__shower_frequency = SB.sampleDataBin(
                self.__shower_frequency
            )  # call helper function to sample from bin