# 练习 1a 两个节点

### **创建新模型** <a href="#create-a-new-model" id="create-a-new-model"></a>

使用以下模板创建一个名为练习 1a 的新网络：

**Pywr 子模板 v1（3 月 2021）-以 mm3/天为单位的流量单位**

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-8cf43c5e998f08e4eacd95e6e9587a5f0d7dc6d3%2Fimage%20(2)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

### **设置时间范围** <a href="#set-up-time-horizon" id="set-up-time-horizon"></a>

此步骤对于所有网络来说都是必需的，因为它定义了仿真的开始、结束和时间步。在本示例中，我们将使用每日时间步长配置 1 年的仿真期限。

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-964bc90be95e518fb6ab9d81702554c74334a527%2Fimage%20(3)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

### **添加节点** <a href="#adding-nodes" id="adding-nodes"></a>

导航到左侧面板，然后单击 **构建** 打开 “节点” 列表。

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-6dd122d7006c573c91d5be7663f1f48be37614a3%2Fimage%20(4)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

拖放到工作区地图：

· 1 个输入节点 ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252Fp6IcyyIr7fCzV9v3HMQv%252Fimage.png%3Falt%3Dmedia%26token%3D36fa8c07-8f63-4ded-88fc-0dbabb032a83\&width=300\&dpr=4\&quality=100\&sign=71b57dd\&sv=2)

· 1 个输出节点 ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FfWwLPBlBvaq7ZsFNaOfN%252Fimage.png%3Falt%3Dmedia%26token%3D70d572d3-8707-4d27-9617-f0144ca95dfa\&width=300\&dpr=4\&quality=100\&sign=37509149\&sv=2)

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FsPr62T4a30QLGrT19B3K%252F4.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=cc64304f\&sv=2)

注意：要了解有关不同节点类型的更多信息，请参阅文档 [这里](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/node-types)。

### **添加边缘** <a href="#adding-edges" id="adding-edges"></a>

点击 **边缘** ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FNuMmfpzaZSKHIOybT53d%252F5.png%3Falt%3Dmedia\&width=300\&dpr=4\&quality=100\&sign=2ddc37f2\&sv=2) 激活 “链接模式”。

要在节点之间创建连接，请先单击输入节点，然后单击输出节点。边是定向的，方向是从第一个节点设置到第二个节点的。

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252Fv96Yvy0O9q90aPHJRPK5%252F6.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=d3f81232\&sv=2)

再次点击 **边缘** ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FX1VBTRuwkFsrvwHLGUK7%252F7.png%3Falt%3Dmedia\&width=300\&dpr=4\&quality=100\&sign=18a2869d\&sv=2) 停用 “链接模式”。

### **添加流量输入节点并运行网络** <a href="#add-flow-input-node-and-run-the-network" id="add-flow-input-node-and-run-the-network"></a>

双击输入节点。这将打开屏幕右侧的节点面板。

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FOIc9Ngpvk6owrOTwFOEV%252F8.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=33e5742a\&sv=2)

节点面板部分：

* **详细信息：** 在这里，您可以更改节点的名称和描述。
* **输入：** 本部分包含需要为每个节点配置的基本属性。这些属性是用户定义的。
* **输出：** 此部分显示仿真后的结果。

选择 **输入** 节点和更改 **最大\_流**到10。

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FQXQ5djh3FqWH3TZ1HnU6%252F9.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=431883d8\&sv=2)

在左侧面板上单击 **运行模型** ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FN9XX7GOmGAGHveR3I33q%252F10.png%3Falt%3Dmedia\&width=300\&dpr=4\&quality=100\&sign=e53c96b\&sv=2)。

将弹出一个新窗口，点击 **提交**

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FI94P07yMknyJG2F8uvTb%252F11.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=48eeaf8d\&sv=2)

等到 **运行面板** 显示绿色指示灯表示成功执行。

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FaM3jKAyF6ZHhoRhvgGXv%252F13.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=43a07251\&sv=2)

要可视化输入提供的流量，请单击 **输入** 节点然后 **点击该图标** ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252Fs7IK1rxjpCzzb0h9dp4y%252F14.png%3Falt%3Dmedia\&width=300\&dpr=4\&quality=100\&sign=a918e465\&sv=2) 对于该属性 **模拟\_流**

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252F8Y2n57P3GVJnDggRmQ84%252Fimage.png%3Falt%3Dmedia%26token%3D77064db5-0377-4e3a-8b2e-52ed0efe4284\&width=768\&dpr=4\&quality=100\&sign=2f909a88\&sv=2)

要可视化提供的输出流量，请单击 **输出** 节点然后 **点击该图标** ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FClGLWgzLIeYy4a9NiI6C%252F16.png%3Falt%3Dmedia\&width=300\&dpr=4\&quality=100\&sign=7e4f3882\&sv=2) 对于该属性 **模拟\_流**

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FCUUMMfY3QrpyFirC8lGU%252Fimage.png%3Falt%3Dmedia%26token%3D55465607-868b-4781-b245-8ec898bc67f7\&width=768\&dpr=4\&quality=100\&sign=847191fb\&sv=2)

以下图是网络生成的结果

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FhFSztDcgcKzzcWKCVMC9%252F18.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=f1c2a347\&sv=2) ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FyBgOnBwEPpi5bm9mKxyj%252F19.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=32488224\&sv=2)

### **解释** <a href="#explanation" id="explanation"></a>

输入节点充当供水源，根据需求提供的最大供水量为 10mm3/天，因为输出节点没有相关的分配惩罚，因此不需要供水。

### **为输出节点添加优先级并运行网络** <a href="#add-priority-to-the-output-node-and-run-the-network" id="add-priority-to-the-output-node-and-run-the-network"></a>

选择 **输出** 节点和更改 **分配罚款** 到-10。负值为节点设置更高的优先级。有关分配罚款的更多信息，请参阅 [分配罚款](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/allocation-penalty) 文档

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FChjakxDkReHt8ka69Emu%252F20.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=c68d6a2f\&sv=2)

在左侧面板上单击 **运行模型** ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252F3D7oEvhFAzyDHZKnsMTv%252F21.png%3Falt%3Dmedia\&width=300\&dpr=4\&quality=100\&sign=fe1cd6b6\&sv=2)。

按照上一步的描述运行模型并对结果进行可视化

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FekKvPk6pNvToC5iL3dh8%252F22.png%3Falt%3Dmedia\&width=768\&dpr=4\&quality=100\&sign=81ff8d87\&sv=2)

### **解释** <a href="#explanation-1" id="explanation-1"></a>

输入节点充当供水源，最大供水量为 10mm3/天。

这个 **分配罚款** 在输出节点中设置为负值 (-10)，优先向该节点分配水，在不限制最大流量的情况下，输出节点可以消耗尽可能多的水。

### **将所需的流量添加到输出节点并运行网络** <a href="#add-required-flow-to-the-output-node-and-run-the-network" id="add-required-flow-to-the-output-node-and-run-the-network"></a>

选择 **输出** 节点和更改 **最大\_流量**到 6mm3/天，它会告诉网络该输出节点所需的消耗量是多少。

在左侧面板上单击 **运行模型** 。如前所述，运行模型并对结果进行可视化

![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FIX2rApG9Yg5Owpyf4PGL%252Fimage.png%3Falt%3Dmedia%26token%3Df3dc4379-94ad-4bf6-b7ba-e0ba21f58da1\&width=768\&dpr=4\&quality=100\&sign=2ce8e3a1\&sv=2) ![](https://water-strategy.gitbook.io/~gitbook/image?url=https%3A%2F%2F530325344-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FOe4DHiaeqejzGopyV9BO%252Fuploads%252FMPcxNcUPQaYpVbBEylSj%252Fimage.png%3Falt%3Dmedia%26token%3D1728f953-2152-4af7-bb6c-a3ec067e726b\&width=768\&dpr=4\&quality=100\&sign=6e85c0f6\&sv=2)

#### **解释** <a href="#explanation-2" id="explanation-2"></a>

输入节点充当供水源，最大供水量为 10mm3/天。

这个 **分配罚款** 优先向输出节点分配水，增加了对最大抽水量为6mm3/日的限制，现在产量只能在受限的6mm²/天内获得所请求需求的最大供应量。
