model.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:WNTR 作者: USEPA 项目源码 文件源码
def add_junction(self, name, base_demand=0.0, demand_pattern=None, elevation=0.0, coordinates=None):
        """
        Adds a junction to the water network model.

        Parameters
        -------------------
        name : string
            Name of the junction.
        base_demand : float
            Base demand at the junction.
        demand_pattern : string or Pattern
            Name of the demand pattern or the actual Pattern object
        elevation : float
            Elevation of the junction.
        coordinates : tuple of floats
            X-Y coordinates of the node location.

        """
        base_demand = float(base_demand)
        elevation = float(elevation)
        if not isinstance(demand_pattern, Pattern):
            demand_pattern = self.get_pattern(demand_pattern)
        junction = Junction(name, base_demand, demand_pattern, elevation)
        self._nodes[name] = junction
        self._junctions[name] = junction
        self._graph.add_node(name)
        if coordinates is not None:
            self.set_node_coordinates(name, coordinates)
        nx.set_node_attributes(self._graph, name='type', values={name:'junction'})
        self._num_junctions += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号