Esempio n. 1
0
    def _get_line_array_construct(self):
        """ Returns a construct for an array of line data.
        """
        from_bus = integer.setResultsName("fbus")
        to_bus = integer.setResultsName("tbus")
        s_rating = real.setResultsName("s_rating")  # MVA
        v_rating = real.setResultsName("v_rating")  # kV
        f_rating = real.setResultsName("f_rating")  # Hz
        length = real.setResultsName("length")  # km (Line only)
        v_ratio = real.setResultsName("v_ratio")  # kV/kV (Transformer only)
        r = real.setResultsName("r")  # p.u. or Ohms/km
        x = real.setResultsName("x")  # p.u. or Henrys/km
        b = real.setResultsName("b")  # p.u. or Farads/km (Line only)
        tap_ratio = real.setResultsName("tap")  # p.u./p.u. (Transformer only)
        phase_shift = real.setResultsName(
            "shift")  # degrees (Transformer only)
        i_limit = Optional(real).setResultsName("i_limit")  # p.u.
        p_limit = Optional(real).setResultsName("p_limit")  # p.u.
        s_limit = Optional(real).setResultsName("s_limit")  # p.u.
        status = Optional(boolean).setResultsName("status")

        line_data = from_bus + to_bus + s_rating + v_rating + \
            f_rating + length + v_ratio + r + x + b + tap_ratio + \
            phase_shift + i_limit + p_limit + s_limit + status + scolon

        line_data.setParseAction(self.push_line)

        line_array = Literal("Line.con") + "=" + "[" + "..." + \
            ZeroOrMore(line_data + Optional("]" + scolon))

        return line_array
Esempio n. 2
0
    def _get_line_array_construct(self):
        """ Returns a construct for an array of line data.
        """
        from_bus = integer.setResultsName("fbus")
        to_bus = integer.setResultsName("tbus")
        s_rating = real.setResultsName("s_rating") # MVA
        v_rating = real.setResultsName("v_rating") # kV
        f_rating = real.setResultsName("f_rating") # Hz
        length = real.setResultsName("length") # km (Line only)
        v_ratio = real.setResultsName("v_ratio") # kV/kV (Transformer only)
        r = real.setResultsName("r") # p.u. or Ohms/km
        x = real.setResultsName("x") # p.u. or Henrys/km
        b = real.setResultsName("b") # p.u. or Farads/km (Line only)
        tap_ratio = real.setResultsName("tap") # p.u./p.u. (Transformer only)
        phase_shift = real.setResultsName("shift") # degrees (Transformer only)
        i_limit = Optional(real).setResultsName("i_limit") # p.u.
        p_limit = Optional(real).setResultsName("p_limit") # p.u.
        s_limit = Optional(real).setResultsName("s_limit") # p.u.
        status = Optional(boolean).setResultsName("status")

        line_data = from_bus + to_bus + s_rating + v_rating + \
            f_rating + length + v_ratio + r + x + b + tap_ratio + \
            phase_shift + i_limit + p_limit + s_limit + status + scolon

        line_data.setParseAction(self.push_line)

        line_array = Literal("Line.con") + "=" + "[" + "..." + \
            ZeroOrMore(line_data + Optional("]" + scolon))

        return line_array
Esempio n. 3
0
    def _get_slack_array_construct(self):
        """ Returns a construct for an array of slack bus data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating") # MVA
        v_rating = real.setResultsName("v_rating") # kV
        v_magnitude = real.setResultsName("v_magnitude") # p.u.
        ref_angle = real.setResultsName("ref_angle") # p.u.
        q_max = Optional(real).setResultsName("q_max") # p.u.
        q_min = Optional(real).setResultsName("q_min") # p.u.
        v_max = Optional(real).setResultsName("v_max") # p.u.
        v_min = Optional(real).setResultsName("v_min") # p.u.
        p_guess = Optional(real).setResultsName("p_guess") # p.u.
        # Loss participation coefficient
        lp_coeff = Optional(real).setResultsName("lp_coeff")
        ref_bus = Optional(boolean).setResultsName("ref_bus")
        status = Optional(boolean).setResultsName("status")

        slack_data = bus_no + s_rating + v_rating + v_magnitude + \
            ref_angle + q_max + q_min + v_max + v_min + p_guess + \
            lp_coeff + ref_bus + status + scolon

        slack_data.setParseAction(self.push_slack)

        slack_array = Literal("SW.con") + "=" + "[" + "..." + \
            ZeroOrMore(slack_data + Optional("]" + scolon))

        return slack_array
Esempio n. 4
0
    def _get_demand_array_construct(self):
        """ Returns a construct for an array of power demand data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        p_direction = real.setResultsName("p_direction")  # p.u.
        q_direction = real.setResultsName("q_direction")  # p.u.
        p_bid_max = real.setResultsName("p_bid_max")  # p.u.
        p_bid_min = real.setResultsName("p_bid_min")  # p.u.
        p_optimal_bid = Optional(real).setResultsName("p_optimal_bid")
        p_fixed = real.setResultsName("p_fixed")  # $/hr
        p_proportional = real.setResultsName("p_proportional")  # $/MWh
        p_quadratic = real.setResultsName("p_quadratic")  # $/MW^2h
        q_fixed = real.setResultsName("q_fixed")  # $/hr
        q_proportional = real.setResultsName("q_proportional")  # $/MVArh
        q_quadratic = real.setResultsName("q_quadratic")  # $/MVAr^2h
        commitment = boolean.setResultsName("commitment")
        cost_tie_break = real.setResultsName("cost_tie_break")  # $/MWh
        cost_cong_up = real.setResultsName("cost_cong_up")  # $/h
        cost_cong_down = real.setResultsName("cost_cong_down")  # $/h
        status = Optional(boolean).setResultsName("status")

        demand_data = bus_no + s_rating + p_direction + q_direction + \
            p_bid_max + p_bid_min + p_optimal_bid + p_fixed + \
            p_proportional + p_quadratic + q_fixed + q_proportional + \
            q_quadratic + commitment + cost_tie_break + cost_cong_up + \
            cost_cong_down + status + scolon

        demand_data.setParseAction(self.push_demand)

        demand_array = Literal("Demand.con") + "=" + "[" + "..." + \
            ZeroOrMore(demand_data + Optional("]" + scolon))

        return demand_array
Esempio n. 5
0
    def _get_demand_array_construct(self):
        """ Returns a construct for an array of power demand data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating") # MVA
        p_direction = real.setResultsName("p_direction") # p.u.
        q_direction = real.setResultsName("q_direction") # p.u.
        p_bid_max = real.setResultsName("p_bid_max") # p.u.
        p_bid_min = real.setResultsName("p_bid_min") # p.u.
        p_optimal_bid = Optional(real).setResultsName("p_optimal_bid")
        p_fixed = real.setResultsName("p_fixed") # $/hr
        p_proportional = real.setResultsName("p_proportional") # $/MWh
        p_quadratic = real.setResultsName("p_quadratic") # $/MW^2h
        q_fixed = real.setResultsName("q_fixed") # $/hr
        q_proportional = real.setResultsName("q_proportional") # $/MVArh
        q_quadratic = real.setResultsName("q_quadratic") # $/MVAr^2h
        commitment = boolean.setResultsName("commitment")
        cost_tie_break = real.setResultsName("cost_tie_break") # $/MWh
        cost_cong_up = real.setResultsName("cost_cong_up") # $/h
        cost_cong_down = real.setResultsName("cost_cong_down") # $/h
        status = Optional(boolean).setResultsName("status")

        demand_data = bus_no + s_rating + p_direction + q_direction + \
            p_bid_max + p_bid_min + p_optimal_bid + p_fixed + \
            p_proportional + p_quadratic + q_fixed + q_proportional + \
            q_quadratic + commitment + cost_tie_break + cost_cong_up + \
            cost_cong_down + status + scolon

        demand_data.setParseAction(self.push_demand)

        demand_array = Literal("Demand.con") + "=" + "[" + "..." + \
            ZeroOrMore(demand_data + Optional("]" + scolon))

        return demand_array
Esempio n. 6
0
    def _get_pv_array_construct(self):
        """ Returns a construct for an array of PV generator data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        v_rating = real.setResultsName("v_rating")  # kV
        p = real.setResultsName("p")  # p.u.
        v = real.setResultsName("v")  # p.u.
        q_max = Optional(real).setResultsName("q_max")  # p.u.
        q_min = Optional(real).setResultsName("q_min")  # p.u.
        v_max = Optional(real).setResultsName("v_max")  # p.u.
        v_min = Optional(real).setResultsName("v_min")  # p.u.
        # Loss participation coefficient
        lp_coeff = Optional(real).setResultsName("lp_coeff")
        status = Optional(boolean).setResultsName("status")

        pv_data = bus_no + s_rating + v_rating + p + v + q_max + \
            q_min + v_max + v_min + lp_coeff + status + scolon

        pv_data.setParseAction(self.push_pv)

        pv_array = Literal("PV.con") + "=" + "[" + "..." + \
            ZeroOrMore(pv_data + Optional("]" + scolon))

        return pv_array
Esempio n. 7
0
    def _get_slack_array_construct(self):
        """ Returns a construct for an array of slack bus data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        v_rating = real.setResultsName("v_rating")  # kV
        v_magnitude = real.setResultsName("v_magnitude")  # p.u.
        ref_angle = real.setResultsName("ref_angle")  # p.u.
        q_max = Optional(real).setResultsName("q_max")  # p.u.
        q_min = Optional(real).setResultsName("q_min")  # p.u.
        v_max = Optional(real).setResultsName("v_max")  # p.u.
        v_min = Optional(real).setResultsName("v_min")  # p.u.
        p_guess = Optional(real).setResultsName("p_guess")  # p.u.
        # Loss participation coefficient
        lp_coeff = Optional(real).setResultsName("lp_coeff")
        ref_bus = Optional(boolean).setResultsName("ref_bus")
        status = Optional(boolean).setResultsName("status")

        slack_data = bus_no + s_rating + v_rating + v_magnitude + \
            ref_angle + q_max + q_min + v_max + v_min + p_guess + \
            lp_coeff + ref_bus + status + scolon

        slack_data.setParseAction(self.push_slack)

        slack_array = Literal("SW.con") + "=" + "[" + "..." + \
            ZeroOrMore(slack_data + Optional("]" + scolon))

        return slack_array
Esempio n. 8
0
    def _get_pv_array_construct(self):
        """ Returns a construct for an array of PV generator data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating") # MVA
        v_rating = real.setResultsName("v_rating") # kV
        p = real.setResultsName("p") # p.u.
        v = real.setResultsName("v") # p.u.
        q_max = Optional(real).setResultsName("q_max") # p.u.
        q_min = Optional(real).setResultsName("q_min") # p.u.
        v_max = Optional(real).setResultsName("v_max") # p.u.
        v_min = Optional(real).setResultsName("v_min") # p.u.
        # Loss participation coefficient
        lp_coeff = Optional(real).setResultsName("lp_coeff")
        status = Optional(boolean).setResultsName("status")

        pv_data = bus_no + s_rating + v_rating + p + v + q_max + \
            q_min + v_max + v_min + lp_coeff + status + scolon

        pv_data.setParseAction(self.push_pv)

        pv_array = Literal("PV.con") + "=" + "[" + "..." + \
            ZeroOrMore(pv_data + Optional("]" + scolon))

        return pv_array
Esempio n. 9
0
    def _get_load_ramping_construct(self):
        """ Returns a construct for an array of load ramping data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        up_rate = real.setResultsName("up_rate")  # p.u./h
        down_rate = real.setResultsName("down_rate")  # p.u./h
        min_up_time = real.setResultsName("min_up_time")  # min
        min_down_time = real.setResultsName("min_down_time")  # min
        n_period_up = integer.setResultsName("n_period_up")
        n_period_down = integer.setResultsName("n_period_down")
        status = boolean.setResultsName("status")

        l_ramp_data = bus_no + s_rating + up_rate + down_rate + \
            min_up_time + min_down_time + n_period_up + \
            n_period_down + status + scolon

        l_ramp_array = Literal("Rmpl.con") + "=" + "[" + \
            ZeroOrMore(l_ramp_data + Optional("]" + scolon))

        return l_ramp_array
Esempio n. 10
0
    def _get_load_ramping_construct(self):
        """ Returns a construct for an array of load ramping data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating") # MVA
        up_rate = real.setResultsName("up_rate") # p.u./h
        down_rate = real.setResultsName("down_rate") # p.u./h
        min_up_time = real.setResultsName("min_up_time") # min
        min_down_time = real.setResultsName("min_down_time") # min
        n_period_up = integer.setResultsName("n_period_up")
        n_period_down = integer.setResultsName("n_period_down")
        status = boolean.setResultsName("status")

        l_ramp_data = bus_no + s_rating + up_rate + down_rate + \
            min_up_time + min_down_time + n_period_up + \
            n_period_down + status + scolon

        l_ramp_array = Literal("Rmpl.con") + "=" + "[" + \
            ZeroOrMore(l_ramp_data + Optional("]" + scolon))

        return l_ramp_array
Esempio n. 11
0
    def _get_generator_ramping_construct(self):
        """ Returns a construct for an array of generator ramping data.
        """
        supply_no = integer.setResultsName("supply_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        up_rate = real.setResultsName("up_rate")  # p.u./h
        down_rate = real.setResultsName("down_rate")  # p.u./h
        min_period_up = real.setResultsName("min_period_up")  # h
        min_period_down = real.setResultsName("min_period_down")  # h
        initial_period_up = integer.setResultsName("initial_period_up")
        initial_period_down = integer.setResultsName("initial_period_down")
        c_startup = real.setResultsName("c_startup")  # $
        status = boolean.setResultsName("status")

        g_ramp_data = supply_no + s_rating + up_rate + down_rate + \
            min_period_up + min_period_down + initial_period_up + \
            initial_period_down + c_startup + status + scolon

        g_ramp_array = Literal("Rmpg.con") + "=" + "[" + \
            ZeroOrMore(g_ramp_data + Optional("]" + scolon))

        return g_ramp_array
Esempio n. 12
0
    def _get_generator_ramping_construct(self):
        """ Returns a construct for an array of generator ramping data.
        """
        supply_no = integer.setResultsName("supply_no")
        s_rating = real.setResultsName("s_rating") # MVA
        up_rate = real.setResultsName("up_rate") # p.u./h
        down_rate = real.setResultsName("down_rate") # p.u./h
        min_period_up = real.setResultsName("min_period_up") # h
        min_period_down = real.setResultsName("min_period_down") # h
        initial_period_up = integer.setResultsName("initial_period_up")
        initial_period_down = integer.setResultsName("initial_period_down")
        c_startup = real.setResultsName("c_startup") # $
        status = boolean.setResultsName("status")

        g_ramp_data = supply_no + s_rating + up_rate + down_rate + \
            min_period_up + min_period_down + initial_period_up + \
            initial_period_down + c_startup + status + scolon

        g_ramp_array = Literal("Rmpg.con") + "=" + "[" + \
            ZeroOrMore(g_ramp_data + Optional("]" + scolon))

        return g_ramp_array
Esempio n. 13
0
    def _get_bus_array_construct(self):
        """ Returns a construct for an array of bus data.
        """
        bus_no = integer.setResultsName("bus_no")
        v_base = real.setResultsName("v_base") # kV
        v_magnitude = Optional(real).setResultsName("v_magnitude")
        v_angle = Optional(real).setResultsName("v_angle") # radians
        area = Optional(integer).setResultsName("area") # not used yet
        region = Optional(integer).setResultsName("region") # not used yet

        bus_data = bus_no + v_base + v_magnitude + v_angle + \
            area + region + scolon

        bus_data.setParseAction(self.push_bus)

        bus_array = Literal("Bus.con") + "=" + "[" + "..." + \
            ZeroOrMore(bus_data + Optional("]" + scolon))

        # Sort buses according to their name (bus_no)
        bus_array.setParseAction(self.sort_buses)

        return bus_array
Esempio n. 14
0
    def _get_bus_array_construct(self):
        """ Returns a construct for an array of bus data.
        """
        bus_no = integer.setResultsName("bus_no")
        v_base = real.setResultsName("v_base")  # kV
        v_magnitude = Optional(real).setResultsName("v_magnitude")
        v_angle = Optional(real).setResultsName("v_angle")  # radians
        area = Optional(integer).setResultsName("area")  # not used yet
        region = Optional(integer).setResultsName("region")  # not used yet

        bus_data = bus_no + v_base + v_magnitude + v_angle + \
            area + region + scolon

        bus_data.setParseAction(self.push_bus)

        bus_array = Literal("Bus.con") + "=" + "[" + "..." + \
            ZeroOrMore(bus_data + Optional("]" + scolon))

        # Sort buses according to their name (bus_no)
        bus_array.setParseAction(self.sort_buses)

        return bus_array
Esempio n. 15
0
    def _get_pq_array_construct(self):
        """ Returns a construct for an array of PQ load data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        v_rating = real.setResultsName("v_rating")  # kV
        p = real.setResultsName("p")  # p.u.
        q = real.setResultsName("q")  # p.u.
        v_max = Optional(real).setResultsName("v_max")  # p.u.
        v_min = Optional(real).setResultsName("v_min")  # p.u.
        # Allow conversion to impedance
        z_conv = Optional(boolean).setResultsName("z_conv")
        status = Optional(boolean).setResultsName("status")

        pq_data = bus_no + s_rating + v_rating + p + q + v_max + \
            v_min + z_conv + status + scolon

        pq_data.setParseAction(self.push_pq)

        pq_array = Literal("PQ.con") + "=" + "[" + "..." + \
            ZeroOrMore(pq_data + Optional("]" + scolon))

        return pq_array
Esempio n. 16
0
    def _get_pq_array_construct(self):
        """ Returns a construct for an array of PQ load data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating") # MVA
        v_rating = real.setResultsName("v_rating") # kV
        p = real.setResultsName("p") # p.u.
        q = real.setResultsName("q") # p.u.
        v_max = Optional(real).setResultsName("v_max") # p.u.
        v_min = Optional(real).setResultsName("v_min") # p.u.
        # Allow conversion to impedance
        z_conv = Optional(boolean).setResultsName("z_conv")
        status = Optional(boolean).setResultsName("status")

        pq_data = bus_no + s_rating + v_rating + p + q + v_max + \
            v_min + z_conv + status + scolon

        pq_data.setParseAction(self.push_pq)

        pq_array = Literal("PQ.con") + "=" + "[" + "..." + \
            ZeroOrMore(pq_data + Optional("]" + scolon))

        return pq_array
Esempio n. 17
0
    def _get_supply_array_construct(self):
        """ Returns a construct for an array of power supply data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating")  # MVA
        p_direction = real.setResultsName("p_direction")  # CPF
        p_bid_max = real.setResultsName("p_bid_max")  # p.u.
        p_bid_min = real.setResultsName("p_bid_min")  # p.u.
        p_bid_actual = real.setResultsName("p_bid_actual")  # p.u.
        p_fixed = real.setResultsName("p_fixed")  # $/hr
        p_proportional = real.setResultsName("p_proportional")  # $/MWh
        p_quadratic = real.setResultsName("p_quadratic")  # $/MW^2h
        q_fixed = real.setResultsName("q_fixed")  # $/hr
        q_proportional = real.setResultsName("q_proportional")  # $/MVArh
        q_quadratic = real.setResultsName("q_quadratic")  # $/MVAr^2h
        commitment = boolean.setResultsName("commitment")
        cost_tie_break = real.setResultsName("cost_tie_break")  # $/MWh
        lp_factor = real.setResultsName(
            "lp_factor")  # Loss participation factor
        q_max = real.setResultsName("q_max")  # p.u.
        q_min = real.setResultsName("q_min")  # p.u.
        cost_cong_up = real.setResultsName("cost_cong_up")  # $/h
        cost_cong_down = real.setResultsName("cost_cong_down")  # $/h
        status = Optional(boolean).setResultsName("status")

        supply_data = bus_no + s_rating + p_direction + p_bid_max + \
            p_bid_min + p_bid_actual + p_fixed + p_proportional + \
            p_quadratic + q_fixed + q_proportional + q_quadratic + \
            commitment + cost_tie_break + lp_factor + q_max + q_min + \
            cost_cong_up + cost_cong_down + status + scolon

        supply_data.setParseAction(self.push_supply)

        supply_array = Literal("Supply.con") + "=" + "[" + "..." + \
            ZeroOrMore(supply_data + Optional("]" + scolon))

        return supply_array
Esempio n. 18
0
    def _get_supply_array_construct(self):
        """ Returns a construct for an array of power supply data.
        """
        bus_no = integer.setResultsName("bus_no")
        s_rating = real.setResultsName("s_rating") # MVA
        p_direction = real.setResultsName("p_direction") # CPF
        p_bid_max = real.setResultsName("p_bid_max") # p.u.
        p_bid_min = real.setResultsName("p_bid_min") # p.u.
        p_bid_actual = real.setResultsName("p_bid_actual") # p.u.
        p_fixed = real.setResultsName("p_fixed") # $/hr
        p_proportional = real.setResultsName("p_proportional") # $/MWh
        p_quadratic = real.setResultsName("p_quadratic") # $/MW^2h
        q_fixed = real.setResultsName("q_fixed") # $/hr
        q_proportional = real.setResultsName("q_proportional") # $/MVArh
        q_quadratic = real.setResultsName("q_quadratic") # $/MVAr^2h
        commitment = boolean.setResultsName("commitment")
        cost_tie_break = real.setResultsName("cost_tie_break") # $/MWh
        lp_factor = real.setResultsName("lp_factor")# Loss participation factor
        q_max = real.setResultsName("q_max") # p.u.
        q_min = real.setResultsName("q_min") # p.u.
        cost_cong_up = real.setResultsName("cost_cong_up") # $/h
        cost_cong_down = real.setResultsName("cost_cong_down") # $/h
        status = Optional(boolean).setResultsName("status")

        supply_data = bus_no + s_rating + p_direction + p_bid_max + \
            p_bid_min + p_bid_actual + p_fixed + p_proportional + \
            p_quadratic + q_fixed + q_proportional + q_quadratic + \
            commitment + cost_tie_break + lp_factor + q_max + q_min + \
            cost_cong_up + cost_cong_down + status + scolon

        supply_data.setParseAction(self.push_supply)

        supply_array = Literal("Supply.con") + "=" + "[" + "..." + \
            ZeroOrMore(supply_data + Optional("]" + scolon))

        return supply_array