Skip to content

Commit

Permalink
Merge pull request #44 from jbae11/fc_metrics_analysis
Browse files Browse the repository at this point in the history
Fc metrics analysis
  • Loading branch information
gyutaepark authored Jul 9, 2017
2 parents 5a90c7f + 62cd71b commit c96e56a
Show file tree
Hide file tree
Showing 15 changed files with 7,100 additions and 6,716 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ __pycache__
\#*#
.#*
.coverage
*.swp
*.swp
*.sqlite
Empty file removed 2017-bae-europe/cylcus.sqlite
Empty file.
225 changes: 225 additions & 0 deletions 2017-bae-europe/eu_future/eu_future.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Declare Common Variables\n",
"script_folder = '../../scripts/'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import Necessary Module and Set Path "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import sqlite3 as lite\n",
"import os\n",
"import sys\n",
"sys.path.insert(0, script_folder)\n",
"jupyter_directory = os.getcwd()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import analysis as an"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Run Cyclus Input file"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"! rm eu_future.sqlite\n",
"! cyclus -i eu_future.xml -o eu_future.sqlite"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The output file should be named \n",
" \n",
" eu_future.sqlite"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Wait for the complete message to move on\n",
"\n",
"con = lite.connect('eu_future.sqlite')\n",
"with con:\n",
" cur = con.cursor()\n",
" \n",
" # get simulation time info\n",
" init_year, init_month, duration, timestep = an.get_sim_time_duration(cur)\n",
" \n",
" # prints net capacity and number of reactor timeseries\n",
" an.plot_power(cur)\n",
" \n",
" # natural uranium demand\n",
" dictionary = collections.OrderedDict()\n",
" dictionary['natural_uranium'] = an.nat_u_timeseries(cur)\n",
" an.stacked_bar_chart(dictionary, timestep,\n",
" 'Years', 'Natural Uranium Mass',\n",
" 'Natural Uranium Demand vs Time',\n",
" 'nat_u', init_year)\n",
" \n",
" # get spent fuel timeseries\n",
" snf_dict = an.commodity_in_out_facility(cur, 'Reactor', \n",
" ['uox_waste', 'mox_waste'],\n",
" True, False, False)\n",
" an.stacked_bar_chart(snf_dict, timestep,\n",
" 'Years', 'Mass [MTHM]',\n",
" 'Spent Fuel Mass vs Time',\n",
" 'snf', init_year)\n",
" \n",
" # get fuel usage timeseries in stacked bar chart\n",
" fuel_dict = an.fuel_usage_timeseries(cur, ['uox', 'mox'])\n",
" an.stacked_bar_chart(fuel_dict, timestep,\n",
" 'Years', 'Mass[MTHM]',\n",
" 'Total Fuel Mass vs Time',\n",
" 'total_fuel',\n",
" init_year)\n",
" \n",
" # get tailings timeseries\n",
" tails_dict = an.commodity_in_out_facility(cur, 'enrichment',\n",
" ['tailings'], \n",
" True, False, False)\n",
" an.multi_line_plot(tails_dict, timestep, \n",
" 'Years', 'Mass [MTHM]', \n",
" 'Tailings Mass vs Time',\n",
" 'tailings', init_year)\n",
"\n",
"print('Finished!')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Display Net Capacity vs Time\n",
"from IPython.display import Image\n",
"Image(filename='power_plot.png')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Display Number of Reactors vs Time\n",
"from IPython.display import Image\n",
"Image(filename='number_plot.png')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Display natural U demand vs Time\n",
"from IPython.display import Image\n",
"Image(filename='nat_u.png')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Display spent fuel vs Time\n",
"from IPython.display import Image\n",
"Image(filename='snf.png')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Display total fuel usage vs Time\n",
"from IPython.display import Image\n",
"Image(filename='total_fuel.png')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Display tailings vs Time\n",
"from IPython.display import Image\n",
"Image(filename='tailings.png')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit c96e56a

Please sign in to comment.