Skip to content

Commit 0fc19b3

Browse files
Updated syntax for latest CSV/DataFrames changes
1 parent 182cb3f commit 0fc19b3

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

notebooks/SolarHybridization/SolarHybridization.ipynb

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"This example comes from M.D. Stuber. A Differentiable Model for Optimizing Hybridization of Industrial Process Heat Systems with Concentrating Solar Thermal Power. *Processes*, 6(7), 76 (2018) DOI: [10.3390/pr6070076](https://doi.org/10.3390/pr6070076)\n",
14+
"This example comes from M.D. Stuber. A Differentiable Model for Optimizing Hybridization of Industrial Process Heat Systems with Concentrating Solar Thermal Power. _Processes_, 6(7), 76 (2018) DOI: [10.3390/pr6070076](https://doi.org/10.3390/pr6070076)\n",
1515
"\n",
1616
"In this example, we seek to determine the optimal thermal energy storage capacity and parabolic trough solar array aperture area that maximizes the lifecycle savings associated with augmenting a conventional natural gas industrial process heat system. Here, we use user-defined functions, the JuMP modeling language, the EAGO spatial branch-and-bound algorithm with custom upper- and lower-bounding procedures, and the IPOPT algorithm for solving the bounding subproblems.\n",
1717
"\n",
@@ -42,7 +42,7 @@
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
45-
"using CSV;"
45+
"using CSV, DataFrames;"
4646
]
4747
},
4848
{
@@ -59,19 +59,17 @@
5959
},
6060
{
6161
"cell_type": "code",
62-
"execution_count": 3,
62+
"execution_count": 4,
6363
"metadata": {},
6464
"outputs": [],
6565
"source": [
66-
"include(\"smoothMinMaxAbs.jl\")\n",
6766
"include(\"solarAngles.jl\")\n",
6867
"include(\"PTCmodel.jl\")\n",
6968
"include(\"iphProcessSmooth.jl\")\n",
7069
"include(\"lifecycleCost.jl\")\n",
71-
"\n",
7270
"# Step 1: read the data into a table and extract the appropriate data into a vector\n",
7371
"input_file = \"FirebaughTMY_Julia.csv\"\n",
74-
"solData = CSV.read(input_file)\n",
72+
"solData = CSV.File(input_file) |> DataFrame\n",
7573
"yData = convert(Array{Float64,1},solData[:,7])\n",
7674
"\n",
7775
"# Step 2: get the specific thermal power potential for the region [kW/m^2]\n",
@@ -90,7 +88,7 @@
9088
},
9189
{
9290
"cell_type": "code",
93-
"execution_count": 4,
91+
"execution_count": 5,
9492
"metadata": {},
9593
"outputs": [],
9694
"source": [
@@ -106,7 +104,7 @@
106104
},
107105
{
108106
"cell_type": "code",
109-
"execution_count": 5,
107+
"execution_count": 6,
110108
"metadata": {},
111109
"outputs": [],
112110
"source": [
@@ -161,7 +159,7 @@
161159
},
162160
{
163161
"cell_type": "code",
164-
"execution_count": 6,
162+
"execution_count": 7,
165163
"metadata": {},
166164
"outputs": [],
167165
"source": [
@@ -215,7 +213,7 @@
215213
},
216214
{
217215
"cell_type": "code",
218-
"execution_count": 7,
216+
"execution_count": 8,
219217
"metadata": {},
220218
"outputs": [],
221219
"source": [
@@ -240,7 +238,7 @@
240238
},
241239
{
242240
"cell_type": "code",
243-
"execution_count": 11,
241+
"execution_count": 13,
244242
"metadata": {},
245243
"outputs": [],
246244
"source": [
@@ -262,28 +260,31 @@
262260
},
263261
{
264262
"cell_type": "code",
265-
"execution_count": 12,
263+
"execution_count": 14,
266264
"metadata": {},
267265
"outputs": [
268266
{
269267
"name": "stdout",
270268
"output_type": "stream",
271269
"text": [
272-
"-------------------------------------------------------------------------------------------------------\n",
273-
"| Iteration # | Nodes | Lower Bound | Upper Bound | Gap | Ratio | Time | Time Left |\n",
274-
"-------------------------------------------------------------------------------------------------------\n",
275-
"| 1 | 2 | -7.531E6 | 3.084E2 | 7.531E6 | 1.000E0 | 1.211E0 | 9.988E2 |\n",
276-
"| 2 | 3 | -7.531E6 | 3.084E2 | 7.531E6 | 1.000E0 | 2.007E0 | 9.980E2 |\n",
277-
"| 3 | 2 | -7.492E6 | -7.318E6 | 1.740E5 | 2.322E-2 | 5.518E0 | 9.945E2 |\n",
278-
"| 4 | 1 | -7.492E6 | -7.318E6 | 1.740E5 | 2.322E-2 | 5.787E0 | 9.942E2 |\n",
279-
"| 5 | 2 | -7.344E6 | -7.318E6 | 2.654E4 | 3.614E-3 | 7.950E0 | 9.920E2 |\n",
280-
"First Solution Found at Node 7\n",
281-
"UBD = -7.317666312971923e6\n",
270+
"-----------------------------------------------------------------------------------------------------------------------------\n",
271+
"| Iteration # | Nodes | Lower Bound | Upper Bound | Gap | Ratio | Time | Time Left |\n",
272+
"-----------------------------------------------------------------------------------------------------------------------------\n",
273+
"| 1 | 2 | --0.753E7 | 0.308E3 | 0.753E7 | 0.100E1 | 0.647E0 | 0.999E3 |\n",
274+
"| 2 | 3 | --0.753E7 | 0.308E3 | 0.753E7 | 0.100E1 | 0.142E2 | 0.986E3 |\n",
275+
"| 3 | 4 | --0.749E7 | 0.308E3 | 0.749E7 | 0.100E1 | 0.279E2 | 0.972E3 |\n",
276+
"| 4 | 5 | --0.749E7 | 0.308E3 | 0.749E7 | 0.100E1 | 0.408E2 | 0.959E3 |\n",
277+
"| 5 | 2 | --0.734E7 | --0.732E7 | 0.265E5 | 0.361E-2 | 0.420E2 | 0.958E3 |\n",
278+
" \n",
279+
"First Solution Found at Node 9\n",
280+
"LBD = -7.344210617924415e6\n",
281+
"UBD = -7.3176663129719095e6\n",
282282
"Solution is :\n",
283-
" X[1] = 11.722361250304994\n",
284-
" X[2] = 43615.190600813985\n",
285-
" 7.957378 seconds (513.77 k allocations: 5.701 GiB, 9.31% gc time)\n",
286-
"xts* = 11.722361250304994 xa* = 43615.190600813985 f* = 7.317666312971923e6 SF* = 0.6980196901665338\n",
283+
" X[1] = 11.722361246205823\n",
284+
" X[2] = 43615.19059009129\n",
285+
" \n",
286+
" 41.952241 seconds (5.48 M allocations: 60.761 GiB, 4.64% gc time)\n",
287+
"xts* = 11.722361246205823 xa* = 43615.19059009129 f* = 7.3176663129719095e6 SF* = 0.6980196900769012\n",
287288
"Algorithm terminated with a status of OPTIMAL and a result code of FEASIBLE_POINT\n"
288289
]
289290
}
@@ -313,15 +314,15 @@
313314
"lastKernelId": null
314315
},
315316
"kernelspec": {
316-
"display_name": "Julia 1.3.1",
317+
"display_name": "Julia 1.6.1",
317318
"language": "julia",
318-
"name": "julia-1.3"
319+
"name": "julia-1.6"
319320
},
320321
"language_info": {
321322
"file_extension": ".jl",
322323
"mimetype": "application/julia",
323324
"name": "julia",
324-
"version": "1.3.1"
325+
"version": "1.6.1"
325326
}
326327
},
327328
"nbformat": 4,

0 commit comments

Comments
 (0)