Skip to content

Commit

Permalink
Fix PID example
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Apr 10, 2024
1 parent ac26199 commit ae229d1
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions docs/python/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Setup flow boundary:\n"
"Setup level boundary:\n"
]
},
{
Expand All @@ -865,7 +865,7 @@
"source": [
"model.level_boundary.add(\n",
" Node(4, Point(3.0, 0.0)),\n",
" [level_boundary.Static(level=[1])],\n",
" [level_boundary.Static(level=[5.0])],\n",
")"
]
},
Expand All @@ -882,24 +882,27 @@
"metadata": {},
"outputs": [],
"source": [
"pid_control_data = [\n",
" pid_control.Time(\n",
" time=[\n",
" \"2020-01-01\",\n",
" \"2020-05-01\",\n",
" \"2020-07-01\",\n",
" \"2020-12-01\",\n",
" ],\n",
" listen_node_id=[2, 2, 2, 2],\n",
" listen_node_type=[\"Basin\", \"Basin\", \"Basin\", \"Basin\"],\n",
" target=[5.0, 5.0, 7.5, 7.5],\n",
" proportional=[-1e-3, 1e-3, 1e-3, 1e-3],\n",
" integral=[-1e-7, 1e-7, -1e-7, 1e-7],\n",
" derivative=[0.0, 0.0, 0.0, 0.0],\n",
" )\n",
"]\n",
"model.pid_control.add(Node(5, Point(1.5, 1.0)), pid_control_data)\n",
"model.pid_control.add(Node(7, Point(1.5, -1.0)), pid_control_data)"
"for node, proportional, integral in [\n",
" (Node(5, Point(1.5, 1.0)), -1e-3, -1e-7),\n",
" (Node(7, Point(1.5, -1.0)), 1e-3, 1e-7),\n",
"]:\n",
" pid_control_data = [\n",
" pid_control.Time(\n",
" time=[\n",
" \"2020-01-01\",\n",
" \"2020-05-01\",\n",
" \"2020-07-01\",\n",
" \"2020-12-01\",\n",
" ],\n",
" listen_node_id=2,\n",
" listen_node_type=\"Basin\",\n",
" target=[5.0, 5.0, 7.5, 7.5],\n",
" proportional=proportional,\n",
" integral=integral,\n",
" derivative=0.0,\n",
" )\n",
" ]\n",
" model.pid_control.add(node, pid_control_data)"
]
},
{
Expand Down

0 comments on commit ae229d1

Please sign in to comment.