Skip to content

Commit

Permalink
Rerun demo of ConnMan
Browse files Browse the repository at this point in the history
  • Loading branch information
jinningwang committed Nov 23, 2024
1 parent 396cc35 commit e522a8f
Showing 1 changed file with 63 additions and 93 deletions.
156 changes: 63 additions & 93 deletions examples/demonstration/ConnMan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
"text": [
"Saved generated pycode to \"/Users/jinningwang/.andes/pycode\"\n",
"> Reloaded generated Python code of module \"pycode\".\n",
"Generated numerical code for 1 models in 0.1041 seconds.\n",
"Generated numerical code for 1 models in 0.1019 seconds.\n",
"Parsing input file \"/Users/jinningwang/work/andes/andes/cases/ieee14/ieee14_conn.xlsx\"...\n",
"Input file parsed in 0.1834 seconds.\n",
"Input file parsed in 0.2000 seconds.\n",
"Entering connectivity update.\n",
"Following bus(es) are turned off: [15]\n",
"-> System connectivity update results:\n",
Expand All @@ -87,7 +87,7 @@
" 1 islanded bus detected.\n",
" System is interconnected.\n",
" Each island has a slack bus correctly defined and enabled.\n",
"System internal structure set up in 0.0192 seconds.\n"
"System internal structure set up in 0.0207 seconds.\n"
]
}
],
Expand All @@ -114,12 +114,12 @@
" Numba: Off\n",
" Sparse solver: KLU\n",
" Solution method: NR method\n",
"Power flow initialized in 0.0031 seconds.\n",
"Power flow initialized in 0.0109 seconds.\n",
"0: |F(x)| = 0.5605182134\n",
"1: |F(x)| = 0.006202200332\n",
"2: |F(x)| = 5.819382825e-06\n",
"3: |F(x)| = 6.964193111e-12\n",
"Converged in 4 iterations in 0.0029 seconds.\n"
"Converged in 4 iterations in 0.0106 seconds.\n"
]
}
],
Expand Down Expand Up @@ -156,6 +156,13 @@
"ss.Line.get(src='a1', attr='e', idx=['Line_21'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`PV.a.e` is the active power injection at the connected bus."
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand All @@ -164,7 +171,7 @@
{
"data": {
"text/plain": [
"array([0.01])"
"array([-0.])"
]
},
"execution_count": 6,
Expand All @@ -173,8 +180,7 @@
}
],
"source": [
"# TODO: debug: the active output is not zero, which is not expected\n",
"ss.StaticGen.get(src='p', attr='v', idx=[6])"
"ss.PV.get(src='a', attr='e', idx=[6])"
]
},
{
Expand Down Expand Up @@ -213,14 +219,14 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Initialization for dynamics completed in 0.0178 seconds.\n",
"Initialization for dynamics completed in 0.0181 seconds.\n",
"Initialization was successful.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8fb32cdaa5774e71851a0ab490bdbd7c",
"model_id": "d2b6e221b5034f9a914bd9fd1bbc5c70",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -235,7 +241,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Simulation to t=20.00 sec completed in 0.2637 seconds.\n"
"Simulation to t=20.00 sec completed in 0.2641 seconds.\n"
]
},
{
Expand Down Expand Up @@ -286,7 +292,7 @@
"source": [
"## Scenario 2\n",
"\n",
"After running power flow, bus connection status are changed."
"Between successful PFlow solve and TDS initialization, turn off bus(es)."
]
},
{
Expand Down Expand Up @@ -324,9 +330,9 @@
"text": [
"Saved generated pycode to \"/Users/jinningwang/.andes/pycode\"\n",
"> Reloaded generated Python code of module \"pycode\".\n",
"Generated numerical code for 1 models in 0.2173 seconds.\n",
"Generated numerical code for 1 models in 0.0971 seconds.\n",
"Parsing input file \"/Users/jinningwang/work/andes/andes/cases/ieee14/ieee14_conn.xlsx\"...\n",
"Input file parsed in 0.0528 seconds.\n"
"Input file parsed in 0.0676 seconds.\n"
]
}
],
Expand All @@ -339,7 +345,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Turn on the bus manually."
"First, let's turn on the bus manually.\n",
"\n",
"> Note: it will ***not*** touch the connectivity manager to update bus online status before system setup."
]
},
{
Expand All @@ -360,7 +368,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"System internal structure set up in 0.0170 seconds.\n"
"System internal structure set up in 0.0202 seconds.\n"
]
},
{
Expand Down Expand Up @@ -396,12 +404,12 @@
" Numba: Off\n",
" Sparse solver: KLU\n",
" Solution method: NR method\n",
"Power flow initialized in 0.0028 seconds.\n",
"Power flow initialized in 0.0179 seconds.\n",
"0: |F(x)| = 0.7800160444\n",
"1: |F(x)| = 0.03157368515\n",
"2: |F(x)| = 4.343734372e-05\n",
"3: |F(x)| = 8.270892304e-11\n",
"Converged in 4 iterations in 0.0027 seconds.\n"
"Converged in 4 iterations in 0.0045 seconds.\n"
]
},
{
Expand All @@ -423,7 +431,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we change the bus parameters manually"
"Next, let's make a change on the parameter `Bus.name`."
]
},
{
Expand All @@ -439,7 +447,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This will not set the connectivity action flag."
"Such a change will not set the connectivity action flag."
]
},
{
Expand All @@ -466,7 +474,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In contrast, if changes are made to src `u` and its attribute `v`, the connectivity action flag is set."
"In contrast, if changes are made to `Bus.u.v`, the connectivity action flag is set."
]
},
{
Expand All @@ -479,12 +487,31 @@
"output_type": "stream",
"text": [
"Bus turned off: [15]\n",
"Bus connectivity is updated, resolve PFlow before running EIG or TDS!\n"
"Bus connectivity is touched, resolve PFlow before running EIG or TDS!\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ss.Bus.set(src='u', attr='v', idx=15, value=0)"
"ss.Bus.set(src='u', attr='v', idx=15, value=0)\n",
"ss.conn.is_needed"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Remember to run the `PFlow` again if updates are made to the bus online status,\n",
"since this will reset the `PFlow` convergence flag."
]
},
{
Expand All @@ -495,7 +522,7 @@
{
"data": {
"text/plain": [
"True"
"False"
]
},
"execution_count": 17,
Expand All @@ -504,14 +531,7 @@
}
],
"source": [
"ss.conn.is_needed"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Remember to run the `PFlow` again if updates are made to the bus online status."
"ss.PFlow.converged"
]
},
{
Expand Down Expand Up @@ -543,12 +563,12 @@
" 1 islanded bus detected.\n",
" System is interconnected.\n",
" Each island has a slack bus correctly defined and enabled.\n",
"Power flow initialized in 0.0032 seconds.\n",
"Power flow initialized in 0.0051 seconds.\n",
"0: |F(x)| = 0.5605182134\n",
"1: |F(x)| = 0.006202200332\n",
"2: |F(x)| = 5.819382825e-06\n",
"3: |F(x)| = 6.964193111e-12\n",
"Converged in 4 iterations in 0.0026 seconds.\n"
"Converged in 4 iterations in 0.0096 seconds.\n"
]
},
{
Expand All @@ -575,15 +595,15 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Initialization for dynamics completed in 0.0363 seconds.\n",
"Initialization for dynamics completed in 0.0208 seconds.\n",
"Initialization was successful.\n",
"\n",
"-> Eigenvalue Analysis:\n",
"4 states are associated with zero time constants. \n",
" Positive 0\n",
" Zeros 1\n",
" Negative 62\n",
"Eigenvalue analysis finished in 0.0016 seconds.\n"
"Eigenvalue analysis finished in 0.0017 seconds.\n"
]
},
{
Expand Down Expand Up @@ -620,7 +640,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aa6f49d483b047e9a1a648aa8413a6c3",
"model_id": "196c92bd10734959b35aa9a27743f2d0",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -635,7 +655,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Simulation to t=20.00 sec completed in 0.2496 seconds.\n"
"Simulation to t=20.00 sec completed in 0.2661 seconds.\n"
]
},
{
Expand All @@ -661,63 +681,13 @@
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Bus turned on: [15]\n",
"Note that turning on bus(es) does not trigger connectivity update.\n"
]
}
],
"source": [
"ss.Bus.set(src='u', attr='v', idx=15, value=1)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"cell_type": "markdown",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6e21b8c941fe484ea49e166f4fddaae3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/100 [00:00<?, ?%/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Simulation to t=30.00 sec completed in 0.1444 seconds.\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ss.TDS.config.tf = 30\n",
"ss.TDS.run()"
"There are two cases that are not supported yet:\n",
"\n",
"1. It is not supported to turn on a bus after successfully setting up a system.\n",
"1. It is not supported to turn on or off a bus after TDS initialization."
]
}
],
Expand Down

0 comments on commit e522a8f

Please sign in to comment.