Skip to content

Commit

Permalink
modified to show use of cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnbornj committed Dec 31, 2020
1 parent 3282bd9 commit 692b19d
Showing 1 changed file with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"source": [
"experiment = pybamm.Experiment(\n",
" [\n",
" \"Discharge at C/10 for 10 hours or until 3.3 V\",\n",
" (\"Discharge at C/10 for 10 hours or until 3.3 V\",\n",
" \"Rest for 1 hour\",\n",
" \"Charge at 1 A until 4.1 V\",\n",
" \"Hold at 4.1 V until 50 mA\",\n",
" \"Rest for 1 hour\",\n",
" \"Rest for 1 hour\"),\n",
" ] * 3\n",
")"
]
Expand All @@ -60,7 +60,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In this case, the experiment consists of a cycle of constant current C/10 discahrge, a one hour rest, a constant current (1 A) constant voltage (4.1 V) and another one hour rest, all of it repeated three times (notice the `* 3`).\n",
"A cycle is defined by a tuple of operating instructions. In this case, the experiment consists of a cycle of constant current C/10 discharge, a one hour rest, a constant current (1 A) constant voltage (4.1 V) and another one hour rest, all of it repeated three times (notice the * 3).\n",
"\n",
"Then we can choose our model"
]
Expand Down Expand Up @@ -146,33 +146,30 @@
"\n",
"Optionally, each instruction can contain at the end the expression \"(x minute period)\" in which the period at which to record the simulation outputs during that instruction. To change the period for the whole experiment we can pass it as a keyword argument in the experiment.\n",
"\n",
"Additionally, we can use the operators `+` and `*` to combine and repeat lists:"
"Additionally, we can use the operators `+` and `*` on lists in order to combine and repeat cycles:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['Discharge at 1C for 0.5 hours',\n",
" 'Discharge at C/20 for 0.5 hours',\n",
" 'Discharge at 1C for 0.5 hours',\n",
" 'Discharge at C/20 for 0.5 hours',\n",
" 'Discharge at 1C for 0.5 hours',\n",
" 'Discharge at C/20 for 0.5 hours',\n",
" 'Charge at 0.5 C for 45 minutes']"
"[('Discharge at 1C for 0.5 hours', 'Discharge at C/20 for 0.5 hours'),\n",
" ('Discharge at 1C for 0.5 hours', 'Discharge at C/20 for 0.5 hours'),\n",
" ('Discharge at 1C for 0.5 hours', 'Discharge at C/20 for 0.5 hours'),\n",
" ('Charge at 0.5 C for 45 minutes',)]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
"execution_count": 4
}
],
"source": [
"[\"Discharge at 1C for 0.5 hours\", \"Discharge at C/20 for 0.5 hours\"] * 3 + [\"Charge at 0.5 C for 45 minutes\"]"
"[(\"Discharge at 1C for 0.5 hours\", \"Discharge at C/20 for 0.5 hours\")] * 3 + [(\"Charge at 0.5 C for 45 minutes\",)]"
]
},
{
Expand Down Expand Up @@ -206,9 +203,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.8"
"version": "3.8.2-final"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}

0 comments on commit 692b19d

Please sign in to comment.