From 677f4b4b7d53cd2f3cdb0f685ff5f36a741b14c5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 29 Jul 2016 10:23:11 -0400 Subject: [PATCH] Update notebooks and power flow python file --- .../Clustering and wiring potential microgrids.ipynb | 12 ++++++++---- ipynb/Percolation theory.ipynb | 10 +++++----- py/power_flow.py | 2 -- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ipynb/Clustering and wiring potential microgrids.ipynb b/ipynb/Clustering and wiring potential microgrids.ipynb index 4c79186..e5d0aa4 100644 --- a/ipynb/Clustering and wiring potential microgrids.ipynb +++ b/ipynb/Clustering and wiring potential microgrids.ipynb @@ -960,7 +960,9 @@ "collapsed": true }, "outputs": [], - "source": [] + "source": [ + "" + ] }, { "cell_type": "markdown", @@ -978,7 +980,9 @@ "collapsed": true }, "outputs": [], - "source": [] + "source": [ + "" + ] } ], "metadata": { @@ -990,7 +994,7 @@ "language_info": { "codemirror_mode": { "name": "ipython", - "version": 3 + "version": 3.0 }, "file_extension": ".py", "mimetype": "text/x-python", @@ -1006,4 +1010,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file diff --git a/ipynb/Percolation theory.ipynb b/ipynb/Percolation theory.ipynb index 8d7e9fe..281aef6 100644 --- a/ipynb/Percolation theory.ipynb +++ b/ipynb/Percolation theory.ipynb @@ -16,7 +16,8 @@ "\n", "import sys\n", "upper_path = os.path.abspath(os.path.join(os.path.dirname( \"__file__\" ), '..'))\n", - "path_add = os.path.join(upper_path, \"/\", \"py/\")\n", + "path_add = os.path.join(upper_path, \"py/\")\n", + "path_png = os.path.join(upper_path, \"png/\")\n", "sys.path.append(path_add)\n", "\n", "import matplotlib.pyplot as plt\n", @@ -64,8 +65,7 @@ "outputs": [], "source": [ "import sys\n", - "path = \"/Users/Thomas/Documents/BlocPower/Microgrids/Simulation/py/\"\n", - "sys.path.append(path)\n", + "sys.path.append(path_add)\n", "\n", "from simulated_annealing_algo import distance_matrix" ] @@ -193,7 +193,7 @@ }, "outputs": [], "source": [ - "?neighbor_generator" + "#?neighbor_generator" ] }, { @@ -308,7 +308,7 @@ "graph = T0.copy()\n", "monte_carlo_n = 100\n", "start = time.clock()\n", - "size_l = [[step_montecarlo(graph, q) for q in q_l] for j in range(monte_carlo_n)]\n", + "size_l = simulate_montecarlo(n_sim=n_sim, graph=g, q_l=q_l)[1]\n", "print(\"Execution time: %f minutes\" % ((time.clock() - start)/60))" ] }, diff --git a/py/power_flow.py b/py/power_flow.py index a7a51e0..d8c004e 100644 --- a/py/power_flow.py +++ b/py/power_flow.py @@ -53,9 +53,7 @@ def power_flow(graph, size, pcc_node, load_str='load', gen_str='gen', distance_s node_reactance += line_reactance graph.node[i]['voltage_angle'] = (graph.node[i][gen_str] - graph.node[i][load_str]) * node_reactance - absolute_flow = 0 - set_edge_attributes(graph, 'flow', 0) for i in range(size): -- GitLab