> For the complete documentation index, see [llms.txt](https://water-strategy.gitbook.io/waterstrategy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://water-strategy.gitbook.io/waterstrategy/zhong-guo-ren/jiao-cheng/creating-a-reservoir-system/additional-exercises-using-allocation-penalties-and-control-rules.md).

# 使用分配罚款和控制规则来平衡来源

## 使用分配罚款来平衡来源 <a href="#using-allocation-penalties-to-balance-source-use-in-the-mosetse-system" id="using-allocation-penalties-to-balance-source-use-in-the-mosetse-system"></a>

分配罚款可用于平衡需求来源的使用。在之前的练习中 **水库示例** 静态分配惩罚为-200。

参数可用于使分配补偿根据水库的实时存储量而变化。这可以通过以下方式完成 **插值音量参数。** 一旦水库的分配补偿变为动态的，就可以将其与其他来源的分配罚款一起使用，以平衡水库的使用。

1。克隆 **'添加水库 P 和 E** 场景并命名新的场景 **'平衡来源'** 2。编辑水库节点的 “分配惩罚” 属性（“成本” 属性）并将其类型更改为 **'PYWR\_参数'**

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-412a5e4f2b44a51d7f7285497f05ae7a093b60d8%2Fimage%20(172).png?alt=media" alt=""><figcaption><p>编辑 “成本” 属性（“分配罚款” 属性）</p></figcaption></figure>

3.在 JSON 选项卡中，粘贴以下 JSON 代码。此插值体积参数在水库已满时为其分配惩罚为 0，在水库空置时为-200 分配惩罚。当水库处于满水和空水之间时，分配罚款将在 0 和-200 之间进行插值。

```
{
	“类型”：“插值音量参数”，
	“节点”：“示例水库”，
	“音量”：[
		0，
		25
	]，
	“价值观”：[
		-200，
		0
	]，
	“interp_kwargs”：{
		“种类”：“线性”
	}，
	“评论”：“交易量：Mm3，值：分配惩罚”
}
```

4。在地下水输入节点上，设置 **最大\_流** 到 0.02 并设置 **分配罚款**至 50.0。50 的正分配惩罚使得地下水节点仅在水库的分配罚款小于-**1234567890**\_\_（即水库已满 **1234567890**% 时）才使用地下水节点。这意味着当水库快满时，将不使用地下水。只有在水库充分消耗后，地下水节点才会开始向需求供水。

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-d65180fef51bf04fa12978d41f76c223ab0a0bc6%2Fimage%20(176).png?alt=media" alt=""><figcaption><p>设置分配罚款/成本</p></figcaption></figure>

5。运行模型并查看 **模拟\_流** 地下水输入节点并与之比较 **GW 的需求；** 还有 **模拟\_卷** 水库节点并将两者与水库节点进行比较 **添加水库 P 和 E**。

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-0aabbd5846cd2ef052fea31786b65123e653484f%2Fimage%20(185).png?alt=media" alt=""><figcaption><p>地下水输入比较</p></figcaption></figure>

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-c3bdac3e26e67a67fb59ff8f331b50094fce50c6%2Fimage%20(177).png?alt=media" alt=""><figcaption><p>水库容量比较</p></figcaption></figure>

如你所见 **平衡场景** 这是 **橙色**，使用地下水源的次数少于前一方案。如果地下水节点的许可证有限，则这是保持许可证量的一种方法。这将在另一个教程中显示。

*提示：只要勾选分配罚款 Pywr 的时间序列输出，你就能看到模拟的分配惩罚\_参数。目前，模拟罚款被称为 **模拟\_成本** 在水库上*

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-b4f3fa55a00ff3dc26500b852fb4e86196a86681%2Fimage%20(187).png?alt=media" alt=""><figcaption><p>编辑成本参数</p></figcaption></figure>

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-b06ca894f88840b432d3d06013597b330a9c609f%2Fimage%20(188).png?alt=media" alt=""><figcaption><p>选择时间序列记录器并保存</p></figcaption></figure>

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-6aa9847778bc5047753fe99defae692a786d7fbf%2Fimage%20(189).png?alt=media" alt=""><figcaption><p>查看费用随时间而变化</p></figcaption></figure>

<figure><img src="https://2456626420-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FroBiEJ09sszXPUfSv5uk%2Fuploads%2Fgit-blob-96b7258a6312b3e93489c2e13e94795bc53d5df3%2Fimage%20(186).png?alt=media" alt=""><figcaption><p>费用因时间而异</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://water-strategy.gitbook.io/waterstrategy/zhong-guo-ren/jiao-cheng/creating-a-reservoir-system/additional-exercises-using-allocation-penalties-and-control-rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
