コード例 #1
0
ファイル: operations.py プロジェクト: mcgoldba/XPSS
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from qgis.core import *

import qgis.utils

from .nomdia.nomdiafactory import NomDiaFactory

from XPSS.logger import Logger

logger = Logger(debug=False)


def dsConn(data):
    pipeID = data.pipeProps["Pipe ID"]

    dsConn = data.pipeProps["Pipe ID"].to_numpy().T & data.A
    dsConn[0] = self.res

    return dsConn


def read_pipedb(data, params, pipedb, pipes_vlay, force=False):

    logger.debugger("nomDia: " + str(data.nomDia))
    logger.debugger("matl: " + str(data.matl))
    logger.debugger("sch: " + str(data.sch))

    if (any(item is None for item in [data.nomDia, data.matl, data.sch])
            or force == True):
コード例 #2
0
from qgis.core import QgsProject, QgsCoordinateReferenceSystem, \
    QgsCoordinateTransformContext, QgsUnitTypes

import qgis.utils

from XPSS.pss.db.pipedatabase import PipeDatabase
from XPSS.pss.db.units import LengthUnits

from XPSS.pss.calc.flowheadrelations.flowheadrelationsfactory import \
    FlowHeadRelationsFactory

from XPSS.pss.calc.operations import read_pipedb

from XPSS.logger import Logger

logger = Logger(debug=True)


def nEDU(A):

    n, _ = A.shape

    ones = np.ones((n, 1), dtype=int)

    logger.debugger("ones:\n" + str(ones))
    logger.debugger("ones shape: " + str(ones.shape))
    logger.debugger("ones type: " + str(type(ones)))

    nUpPipes = np.array((A - np.eye(n)) @ ones, dtype=int)

    logger.debugger("nUpPipes:\n" + str(nUpPipes))
コード例 #3
0
from XPSS.logger import Logger
from XPSS.pss.calc.nomdia import NomDia

logger = Logger()


class NomDiaFactory(NomDia):
    def __init__(self, data, params, pipedb, pipe_fts):
        super().__init__(data, params, pipedb, pipe_fts)

    registry = {}

    @classmethod
    def register(cls, key):
        def wrapper(func, **kwargs):
            cls.registry[key] = func

        return wrapper

    def create(self, key, **kwargs):
        nomdiamethod = self.__class__.registry.get(key)
        if not nomdiamethod:
            logger.error("Invalid driver key provided: " + str(key))
            raise ValueError(key)
        return nomdiamethod(self.data, self.params, self.pipedb, self.pipe_fts)

    def get(self):
        pass
コード例 #4
0
ファイル: centrifugal.py プロジェクト: mcgoldba/XPSS
from qgis.utils import iface
#from PyQt5.QtWidgets import QDockWidget
import sys
import pandas as pd
import time
import os

from XPSS.pss.calc.solvers.solverfactory import SolverFactory
from XPSS.pipedatabase import PipeMaterial, PipeClass

from . import Solver
from .constantflow import ConstantFlowRunner

from XPSS.logger import Logger

logger = Logger()

@SolverFactory.register('Centrifugal')
class Centrifugal(Solver):
    def __init__(self, params, pipedb, data=None):
        super().__init__(params, pipedb, data)

    def run(self):
        """
        Driver function for claculation with centrifugal pumps (variable
        flowrate)
        """

        logger.progress("%%%%%%%%%%%%%%%%%%%% START PSS CALC - CENTRIFUGAL %%%%%%%%%%%%%%%%%%%%")

        # Obtain intial values for iterative solver