> 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/control-curves-and-demand-savings/modelling-catchment-reservoir-systems.md).

# 增加油藏控制曲线和需求节约（减少）

## 导言

当水库水位低于特定阈值时，控制曲线可用于减少需求。这意味着临时需求管理措施的实施。在这项工作中，随着水库低于一定的储量阈值，需求将逐步减少。本练习将演示[ 控制曲线索引参数](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/control-curve-index-parameter)， [索引数组参数](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/indexed-array-parameter) 以及 [聚合参数](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/aggregated-parameter) 以及参数嵌套。

## 克隆场景并定义控制曲线

1。克隆 **'平衡来源'** 场景并命名新的场景 **'需求减少'** 2。首先，我们将定义一个 **控制曲线** 它使用存储量阈值逐步减少需求，对需求限制进行建模。第一条曲线是 [每月概况](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/monthly-profile) （未来几个月为60％，其他月份为45％）允许季节性变化，而随后的两条曲线是 [常量 ](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/constant)（40% 和 10% 的水库存储容量）。

<figure><img src="/files/zvQ431K9NxZ1RrkeUQeA" alt=""><figcaption><p>水库控制曲线</p></figcaption></figure>

控制曲线将在中定义 **参数** 选项卡。在 “参数” 选项卡中添加 **Pywr\_参数**。

<figure><img src="/files/5c970Gm1jfCWGTc3Q36B" alt="" width="375"><figcaption><p>添加 Pywr_Parameter</p></figcaption></figure>

为参数命名 **'存储控制曲线'** 然后按 *输入***。**

<figure><img src="/files/KvZHzh1nxKvD3XZ4tpOc" alt="" width="335"><figcaption><p><strong>存储控制曲线</strong></p></figcaption></figure>

粘贴以下 JSON 代码片段。请注意在 “storage\_node” 属性中是如何引用的 “示例储存库”。

```
{
	“类型”：“控制曲线索引参数”，
	“storage_node”: “示例水库”，
	“控制曲线”: [
		{
			“类型”：“月度配置文件参数”，
			“价值观”：[
				0.45，
				0.45，
				0.45，
				0.45，
				0.45，
				0.45，
				0.45，
				0.45，
				0.45，
				0.45，
				0.6，
				0.6
			]
		}，
		{
			“类型”：“常量”，
			“值”：0.4
		}，
		{
			“类型”：“常量”，
			“值”：0.1
		}
	]，
	“__录音机__“: {
		“时间序列”：真的
	}
}
```

<figure><img src="/files/BRF6yYg0Tg8AA4zJLfgx" alt=""><figcaption><p>粘贴代码并保存</p></figcaption></figure>

<figure><img src="/files/J2rUFDgaN3BeZCEQbvG5" alt=""><figcaption><p>选择录制时间序列并保存</p></figcaption></figure>

每一步都是 [控制曲线索引参数](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/control-curve-index-parameter) 将返回一个索引值，如下所示：

<figure><img src="/files/OVk6KhAqAk9UTC3ZjdgQ" alt=""><figcaption><p>水库控制曲线</p></figcaption></figure>

这些指数可以与需求因子相关联，需求因子将使用 [索引数组参数](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/indexed-array-parameter)。当超过每个控制曲线阈值时，需求因子将用于减少需求。

## 关联需求因素

1。我们将关联以下内容 **需求因素** 到不同的控制曲线故障级别：

<figure><img src="/files/eEPJcHOzou8coyupBC3o" alt=""><figcaption><p>水库控制曲线</p></figcaption></figure>

这将把需求减少到900\_\_％、80％和50％的基准需求，对应于10％、20％和50％的需求减少。

2。创建一个新的 **Pywr\_参数**

<figure><img src="/files/skRkfYcEqURSRvXgBFrc" alt=""><figcaption><p>创建一个新的 Pywr_Parameter</p></figcaption></figure>

3.为参数命名 **'控制曲线需求因子'** 然后按 *输入***。**

<figure><img src="/files/CBcE1FftlnJQzJjd0E2d" alt="" width="275"><figcaption><p>为参数命名</p></figcaption></figure>

4。粘贴以下 JSON 代码片段。请注意在 “索引参数” 属性中是如何引用存储器控制曲线的。

```
{
	“类型”：“indexedarrayparameter”，
	“索引_参数”：“存储控制曲线”，
	“参数”：[
		1,
		0.9，
		0.8，
		0.5
	]，
}
```

<figure><img src="/files/OwZ9gturExs0cYElblMc" alt=""><figcaption><p>粘贴代码并保存</p></figcaption></figure>

`params`属性接受标量或 Pywr 参数，数组的索引对应于中引用的参数中的索引 **索引\_参数** 在本例中为控制曲线。

5。选择输出此参数。

<figure><img src="/files/pNTWjDCzG1ZD0UGEx3WQ" alt=""><figcaption><p>选择录制时间序列并保存</p></figcaption></figure>

## 定义基准需求

接下来，我们将定义基准需求。这是水库在实施任何削减措施之前的要求。在前面的教程中，示例需求被定义为示例需求输出节点的 Max\ \_flow 属性上的标量 (0.1)：

<figure><img src="/files/c5kPKYldSQmRlC4SVQz5" alt=""><figcaption><p>需求示例</p></figcaption></figure>

我们将把它替换为 **参数参考。**

1。首先，我们将使用以下方法定义基准需求 **常量参数。**

添加一个新的 **Pywr\_参数。**

<figure><img src="/files/AGATW8R25KedspWjoQR7" alt=""><figcaption><p>添加新的 PyWR_Parameter</p></figcaption></figure>

然后给它起个名字 **基准需求** 然后按 *输入*。

<figure><img src="/files/17Xrj891PtnXOCOiV0yv" alt="" width="274"><figcaption><p>命名新的 PyWR_Parameter</p></figcaption></figure>

2。基准需求将保持每天0.1 mm3。将 JSON 代码片段复制并粘贴到 JSON 选项卡中。

```
{
	“类型”：“常量”，
	“值”：0.1
}
```

<figure><img src="/files/dPjm2iE0BfDp2Wnfef4I" alt=""><figcaption><p>粘贴代码并保存</p></figcaption></figure>

在每个时间步中，建模需求将是基准需求乘以需求系数：

“时间步长需求 = 基准需求 x 需求因子”

## 计算 **时间步长需求**

这可以通过使用来实现 [聚合参数](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/aggregated-parameter)。

1。添加一个新的 **Pywr\_参数。**

<figure><img src="/files/ATSRJixrgUXipk0Gwc1Z" alt=""><figcaption><p>添加新的 PyWR_Parameter</p></figcaption></figure>

为新参数命名 **'时间步长需求'**

<figure><img src="/files/wxIxsNe7zpAqcWn6uKtr" alt="" width="274"><figcaption><p>为新参数命名</p></figcaption></figure>

2。将 JSON 代码片段复制并粘贴到 JSON 选项卡中。

```
{
	“类型”：“聚合参数”，
	“agg_func”：“产品”，
	“参数”：[
		“基准需求”，
		“控制曲线需求因子”
	]
}
```

<figure><img src="/files/K5AgtSJxzBiW3HKBGNj8" alt=""><figcaption><p>粘贴代码并保存</p></figcaption></figure>

选择使该参数值在每个时间步中都输出。

<figure><img src="/files/23A3gWmve4COh9dIlyJg" alt=""><figcaption><p>选择记录时间序列</p></figcaption></figure>

3.这个 **'时间步长需求'** 考虑到水库中的状态（即实时存储），定义每个时间步的需求。

这个 **参数** 需要在上面引用 **最大\_需求节点的 flow** 属性。

4。单击 “需求” 节点，然后写入或粘贴 '**时间步长需求'** 在 max\ \_flow 属性中替换标量值 (0.1)。

<figure><img src="/files/74VYEuJJHpggT4zL8pnP" alt=""><figcaption><p>输入 max_flow 属性名称</p></figcaption></figure>

请注意，如果参数名称未保存，请将条目类型更改为 **“描述符”**。

<figure><img src="/files/8lvP3Rq2N9pkxx38UnjK" alt=""><figcaption><p>点击编辑 max_flow</p></figcaption></figure>

<figure><img src="/files/HCEJiCoOwhAdwCAIu2Za" alt=""><figcaption><p>选择描述符</p></figcaption></figure>

<figure><img src="/files/WgMxG13TUWgD0iCcdPY4" alt=""><figcaption><p>输入名字</p></figcaption></figure>

别忘了保存更改。

## 运行模型并查看结果

1。 **跑** 模型。

<figure><img src="/files/k5ff3ZFeNxbRGouFJMo2" alt="" width="327"><figcaption><p>点击运行模型</p></figcaption></figure>

2。查看 **模拟** \ \_水库上的音量

<figure><img src="/files/SCVgsI2NcwiC4SxBZm5I" alt=""><figcaption><p>水库上的模拟 _volume</p></figcaption></figure>

你可以 **缩放** 例如，这是 2042-2044 发生的干旱。

<figure><img src="/files/LdW0JaKGN5kFkg2HcDbF" alt=""><figcaption><p>2042-2044 中水库的模拟 _volume</p></figcaption></figure>

在需求减少的情景中，水库的储量没有降到如此低的水平（9.4与8.1234567890\_\_1\_\_1234567890\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_m3）。

3.单击 “需求” 节点的模拟\ \_flow。需求的减少可以看出。

<figure><img src="/files/juqr8G1Sfjkgj5sm0CZC" alt=""><figcaption><p>需求节点的 simulated_flow</p></figcaption></figure>

4。您可以通过单击 “查看控制固化参数输出” **网络数据** 观点。

<figure><img src="/files/t4Xp1xCR2BZlR3cOqyLB" alt=""><figcaption><p>点击查看控制固化参数输出</p></figcaption></figure>

点击 **模拟\_存储控制曲线**显示存储控制曲线在每个时间步返回的索引。这在 0-2 之间变化。

<figure><img src="/files/uSBDMJrT3oUbs7VaVFPr" alt=""><figcaption><p>控制固化参数输出</p></figcaption></figure>

## 运动 <a href="#exercise" id="exercise"></a>

1。增加基准需求参数。在水库完全排空之前，基准需求能有多高？


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://water-strategy.gitbook.io/waterstrategy/zhong-guo-ren/jiao-cheng/creating-a-reservoir-system/control-curves-and-demand-savings/modelling-catchment-reservoir-systems.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
