Ejemplo n.º 1
0
class LightString(object):

	def __init__(self, model_name, s_id, r_id):
		self.id = s_id
		self.total_wattage = MODEL_WATTAGE[model_name]
		self.receptacle = Receptacle(15, r_id)
		self.model_id = LIGHT_STRING_MODELS[model_name]

	def get_id(self):
		return self.id

	def get_amp_rating(self):
		return float(MAX_RESIDENTIAL_LIGHT_STRING_WIRE_WATTAGE / RESIDENTIAL_LINE_VOLTAGE)

	def get_light_string_by_id(self, light_string_id):
		if light_string_id == self.id:
			return self
		else:
			return self.receptacle.get_light_string_by_id(light_string_id)

	def get_splitter_by_id(self, splitter_id):
		return self.receptacle.get_splitter_by_id(splitter_id)

	def get_receptacle_by_id(self, receptacle_id):
		if True == DEBUG:
			print('LightString.get_receptacle_by_id: rid:{0}'.format(receptacle_id))

		return self.receptacle.get_receptacle_by_id(receptacle_id)

	def get_amp_load(self):
		amp_load = float(self.total_wattage / RESIDENTIAL_LINE_VOLTAGE)
		amp_load += self.receptacle.get_amp_load()
		return amp_load
Ejemplo n.º 2
0
class LightString(object):
    def __init__(self, model_name, s_id, r_id):
        self.id = s_id
        self.total_wattage = MODEL_WATTAGE[model_name]
        self.receptacle = Receptacle(15, r_id)
        self.model_id = LIGHT_STRING_MODELS[model_name]

    def get_id(self):
        return self.id

    def get_amp_rating(self):
        return float(MAX_RESIDENTIAL_LIGHT_STRING_WIRE_WATTAGE /
                     RESIDENTIAL_LINE_VOLTAGE)

    def get_light_string_by_id(self, light_string_id):
        if light_string_id == self.id:
            return self
        else:
            return self.receptacle.get_light_string_by_id(light_string_id)

    def get_splitter_by_id(self, splitter_id):
        return self.receptacle.get_splitter_by_id(splitter_id)

    def get_receptacle_by_id(self, receptacle_id):
        if True == DEBUG:
            print('LightString.get_receptacle_by_id: rid:{0}'.format(
                receptacle_id))

        return self.receptacle.get_receptacle_by_id(receptacle_id)

    def get_amp_load(self):
        amp_load = float(self.total_wattage / RESIDENTIAL_LINE_VOLTAGE)
        amp_load += self.receptacle.get_amp_load()
        return amp_load
Ejemplo n.º 3
0
class Outlet(object):

	def __init__(self, model_name, o_id, r_ids):
		self.id = o_id
		self.amp_rating = OUTLET_MODELS[model_name]
		self.r1 = Receptacle(self.amp_rating, r_ids[0])
		self.r2 = Receptacle(self.amp_rating, r_ids[1])

	def get_id(self):
		return self.id

	def get_amp_rating(self):
		return self.amp_rating

	def add_outlet(self, outlet):
		self.outlets.append(outlets)

	def get_light_string_by_id(self, light_string_id):
		ls = self.r1.get_light_string_by_id(light_string_id)
		if None == ls:
			ls = self.r2.get_light_string_by_id(light_string_id)
		return ls

	def get_splitter_by_id(self, splitter_id):
		sp = self.r1.get_splitter_by_id(splitter_id)
		if None == sp:
			sp = self.r2.get_splitter_by_id(splitter_id)
		return sp

	def get_receptacle_by_id(self, receptacle_id):
		if True == DEBUG:
			print('Outlet.get_receptacle_by_id: rid:{0}'.format(receptacle_id))
		r = self.r1.get_receptacle_by_id(receptacle_id)
		if None == r:
			r = self.r2.get_receptacle_by_id(receptacle_id)
		return r

	def get_amp_load(self):
		amp_load = 0.0
		amp_load += self.r1.get_amp_load()
		amp_load += self.r2.get_amp_load()
		return amp_load

	def get_max_receptacle_amp_load(self):
		r1_amp_load = 0.0 + self.r1.get_amp_load()
		r2_amp_load = 0.0 + self.r2.get_amp_load()
		return max([r1_amp_load, r2_amp_load])
Ejemplo n.º 4
0
class Outlet(object):
    def __init__(self, model_name, o_id, r_ids):
        self.id = o_id
        self.amp_rating = OUTLET_MODELS[model_name]
        self.r1 = Receptacle(self.amp_rating, r_ids[0])
        self.r2 = Receptacle(self.amp_rating, r_ids[1])

    def get_id(self):
        return self.id

    def get_amp_rating(self):
        return self.amp_rating

    def add_outlet(self, outlet):
        self.outlets.append(outlets)

    def get_light_string_by_id(self, light_string_id):
        ls = self.r1.get_light_string_by_id(light_string_id)
        if None == ls:
            ls = self.r2.get_light_string_by_id(light_string_id)
        return ls

    def get_splitter_by_id(self, splitter_id):
        sp = self.r1.get_splitter_by_id(splitter_id)
        if None == sp:
            sp = self.r2.get_splitter_by_id(splitter_id)
        return sp

    def get_receptacle_by_id(self, receptacle_id):
        if True == DEBUG:
            print('Outlet.get_receptacle_by_id: rid:{0}'.format(receptacle_id))
        r = self.r1.get_receptacle_by_id(receptacle_id)
        if None == r:
            r = self.r2.get_receptacle_by_id(receptacle_id)
        return r

    def get_amp_load(self):
        amp_load = 0.0
        amp_load += self.r1.get_amp_load()
        amp_load += self.r2.get_amp_load()
        return amp_load

    def get_max_receptacle_amp_load(self):
        r1_amp_load = 0.0 + self.r1.get_amp_load()
        r2_amp_load = 0.0 + self.r2.get_amp_load()
        return max([r1_amp_load, r2_amp_load])