Пример #1
0
    def define_variables(self):

        Edge.define_variables(self)

        # Variable types
        diameter_t = daeVariableType("diameter_t", (m ** (1)), 1e-6, 1e1, 0.015, 1e-6)
        darcy_t = daeVariableType("darcy_t", dimless, 0.0001, 5, 0.018, 1e-03)
        water_temperature_t = daeVariableType("water_temperature_t", (K ** (1)), 273.0, 373.0, 310.0, 1e-5)
        mass_flowrate_t = daeVariableType("mass_flowrate_t", (kg ** (1)) * (s ** (-1)), 1e-6, 1e2, 1e-1, 1e-6)
        velocity_t = daeVariableType("velocity_t", (m ** (1)) * (s ** (-1)), 1e-6, 1e2, 1e0, 1e-06)
        heat_per_length_t = daeVariableType("heat_per_length_t", (J ** (1)) * (m ** (-1)) * (s ** (-1)), -1e+10, 1e+10,
                                            0.1, 1e-05)
        pressure_t = daeVariableType("pressure_t", (Pa ** (1)), 1e2, 1e7, 1e5, 1e-5)
        delta_pressure_t = daeVariableType("delta_pressure_t", (Pa ** (1)), -1e7, 1e7, 0, 1e-5)

        # Secondary variables
        self.H = daeVariable("H", power_t, self, "Fluid Entalphy", self.Domains)
        self.fD = daeVariable("fD", darcy_t, self, "Darcy friction factor", self.Domains)
        self.D = daeVariable("D", diameter_t, self, "Internal flow diameter", self.Domains)
        self.v = daeVariable("v", velocity_t, self, "Internal flow velocity", self.Domains)

        # State variables
        self.P = daeVariable("P", pressure_t, self, "Fluid Pressure", self.Domains)
        self.T = daeVariable("T", water_temperature_t, self, "Fluid Temperature", self.Domains)

        # Concentrate state variable
        self.k = daeVariable("k", mass_flowrate_t, self, "Mass flowrate", self.Domains)

        # Bounds
        self.klb = daeVariable("klb", mass_flowrate_t, self, "Lower Bound Mass flowrate")
        self.kub = daeVariable("kub", mass_flowrate_t, self, "Upper Bound Mass flowrate")
        self.Hub = daeVariable("Hub", power_t, self, "Upper Bound Fluid Enthalpy")
        self.Hlb = daeVariable("Hlb", power_t, self, "Lower Bound Fluid Enthalpy")
        self.dPlb = daeVariable("dPlb", delta_pressure_t, self, "Lower Bound Concentrated Pressure Loss", self.YDomains)
        self.dPub = daeVariable("dPub", delta_pressure_t, self, "Upper Bound Concentrated Pressure Loss", self.YDomains)
Пример #2
0
    def define_parameters(self):

        Edge.define_parameters(self)

        self.tetha = daeParameter("tetha", rad, self, "Angle")
        self.Di = daeParameter("Di", m, self, "Inside pipe diameter")
        self.L = daeParameter("L", m, self, "Length")
        self.epw = daeParameter("epw", m, self, "Wall Roughness")
        self.Kub = daeParameter("Kub", unit(), self, "Upper bound concentrated accident coefficient")
        self.Klb = daeParameter("Klb", unit(), self, "Lower bound concentrated accident coefficient")
        self.Npipes = daeParameter("Npipes", unit(), self, "Number of pipes", self.YDomains)
Пример #3
0
    def __init__(self,
                 Name,
                 Parent=None,
                 Description="",
                 data={},
                 node_tree={}):

        Edge.__init__(self,
                      Name,
                      Parent=Parent,
                      Description=Description,
                      data=data,
                      node_tree=node_tree)
Пример #4
0
    def DeclareEquations(self):

        Edge.DeclareEquations(self)

        # friction factors
        self.eq_fD() # x * y

        # Nodal Specifications (P1, P2, T1)
        self.eq_pressure_boundaries() # 2 * y
        self.eq_temperature_boundaries() # y

        # Internal Diameter
        self.eq_internal_diameter() # x * y

        # v and Re
        self.eq_velocity() # x * y

        # P
        self.eq_mass_balance() # (x-1) * y
        self.eq_mommentum_balance() # (x-1) * y

        # T, H, and Qout
        self.eq_entalphy() # x * y
        self.eq_heat_balance() # (x-1) * y

        # Bounds
        self.eq_upperbound_flowrate() # 1
        self.eq_lowerbound_flowrate() # 1

        self.eq_upperbound_enthalpy() # 1
        self.eq_lowerbound_enthalpy() # 1

        self.eq_upperbound_pressureloss()
        self.eq_lowerbound_pressureloss()
Пример #5
0
    def define_constants(self):

        Edge.define_constants(self)

        self.pi = Constant(pi)
        self.g = Constant(gravity * m / s**2)
        self.PR = Constant(1e5 * Pa)  # bar

        y_domain = []
        if hasattr(self, 'y') and type(self.y) == pyCore.daeDomain:
            y_domain.append(self.y)
        self.YDomains = y_domain

        x_domain = []
        if hasattr(self, 'x') and type(self.x) == pyCore.daeDomain:
            x_domain.append(self.x)
        self.XDomains = x_domain
Пример #6
0
    def _parse_edges(self):
        edges = []
        edge_sheet = self.workbook.sheet_by_name(EDGE_SHEET)
        rows = edge_sheet.get_rows()
        for i, each_row in enumerate(rows):
            if i == 0:
                continue
            reference_node_name = each_row[0].value
            treatment_node_name = each_row[1].value

            weight = each_row[2].value
            label = each_row[3].value
            edge = Edge(
                reference_node_name=reference_node_name,
                treatment_node_name=treatment_node_name,
                weight=weight,
                label=label,
                color=None
            )
            self.edges.append(edge)
Пример #7
0
def convert():
    form = Edge()
    try:
        if request.args.get('action') and request.args.get(
                'action') == 'canny':
            form.CovertCanny()
        elif request.args.get('action') and request.args.get(
                'action') == 'sobel':
            form.CovertSobel()
        elif request.args.get('action') and request.args.get(
                'action') == 'laplacian':
            form.CovertLaplacian()
        elif request.args.get('action') and request.args.get(
                'action') == 'countour':
            form.CovertCountour()
    except:
        return redirect(url_for('edge_route.edge'))

    return render_template("/edge.html", form=form)
Пример #8
0
    def define_domains(self):

        Edge.define_domains(self)

        self.x = daeDomain("x", self, unit(), "X axis domain")
Пример #9
0
    def __init__(self, Name, Parent=None, Description=""):

        Edge.__init__(self, Name, Parent=Parent, Description=Description)
Пример #10
0
def edge():
    form = Edge()
    form.UploadPhoto(form)
    return render_template("/edge.html", form=form)