EMT_Slack_PiLine_VSI_with_PF_Init.ipynb 2.66 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# DP Simulation of topology with slack, line and PQ load"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    " %%bash\n",
    "TOP=${TOP:-$(git rev-parse --show-toplevel)}\n",
    "PATH=${TOP}/build/Examples/Cxx\n",
    "\n",
    "EMT_Slack_PiLine_VSI_with_PF_Init"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from villas.dataprocessing.readtools import *\n",
    "from villas.dataprocessing.timeseries import *\n",
    "import matplotlib.pyplot as plt\n",
    "import re\n",
    "\n",
Jan Dinkelbach's avatar
Fix CI    
Jan Dinkelbach committed
34
    "# %matplotlib widget"
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PF results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_PF'\n",
    "path = 'logs/' + modelName + '/'\n",
    "dpsim_result_file = path + modelName + '.csv'\n",
    "\n",
    "ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EMT results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_EMT'\n",
    "path = 'logs/' + modelName + '/'\n",
    "dpsim_result_file = path + modelName + '.csv'\n",
    "PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)\n",
    "ts_dpsim = read_timeseries_csv(dpsim_result_file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.figure(figsize=(12,6))\n",
    "for ts_name, ts_obj  in ts_dpsim.items():\n",
    "    if '_0' in ts_name:\n",
    "        plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)\n",
    "for ts_name, ts_obj  in ts_dpsim_pf.items():\n",
    "        plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}