{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Inspecting Models" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First of all, import `andes` and configure the logger to the WARNING level (30)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:41:43.994435Z", "start_time": "2021-03-18T00:41:43.446521Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:41:50.927219Z", "iopub.status.busy": "2021-09-26T22:41:50.926922Z", "iopub.status.idle": "2021-09-26T22:41:51.686459Z", "shell.execute_reply": "2021-09-26T22:41:51.686018Z" } }, "outputs": [], "source": [ "import andes\n", "\n", "andes.config_logger(30)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Inspect Model Equations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create an empty `andes.System` object and call `prepare(nomp=True)` to generate equations and pretty print, where `nomp` disables multiprocessing so that equations can be properly returned. This operation may take a moment.\n", "\n", "To only generate equations for a specific model, such as `GENCLS`, do:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.629128Z", "start_time": "2021-03-18T00:42:51.621593Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.538880Z", "iopub.status.busy": "2021-09-26T22:42:05.538580Z", "iopub.status.idle": "2021-09-26T22:42:05.541651Z", "shell.execute_reply": "2021-09-26T22:42:05.541386Z" } }, "outputs": [], "source": [ "ss = andes.System()\n", "ss.GENCLS.prepare()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### List all models" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Supported Groups and Models\n", "\n", " Group | Models \n", "-------------------+----------------------------------------------------------\n", " ACLine | Line \n", " ACShort | Jumper \n", " ACTopology | Bus \n", " Calculation | ACE, ACEc, COI \n", " Collection | Area \n", " DCLink | Ground, R, L, C, RCp, RCs, RLs, RLCs, RLCp \n", " DCTopology | Node \n", " DG | PVD1, ESD1, EV1, EV2 \n", " DGProtection | DGPRCT1, DGPRCTExt \n", " DynLoad | ZIP, FLoad \n", " Exciter | EXDC2, IEEEX1, ESDC2A, EXST1, ESST3A, SEXS, IEEET1, \n", " | EXAC1, EXAC4, ESST4B, AC8B, IEEET3, ESAC1A, ESST1A \n", " FreqMeasurement | BusFreq, BusROCOF \n", " Information | Summary \n", " Motor | Motor3, Motor5 \n", " PLL | PLL1 \n", " PSS | IEEEST, ST2CUT \n", " PhasorMeasurement | PMU \n", " RenAerodynamics | WTARA1, WTARV1 \n", " RenExciter | REECA1, REECA1E, REECA1G \n", " RenGen | REGCA1, REGCP1, REGCV1, REGCV2 \n", " RenGovernor | WTDTA1, WTDS \n", " RenPitch | WTPTA1 \n", " RenPlant | REPCA1 \n", " RenTorque | WTTQA1 \n", " StaticACDC | VSCShunt \n", " StaticGen | PV, Slack \n", " StaticLoad | PQ \n", " StaticShunt | Shunt, ShuntTD, ShuntSw \n", " SynGen | GENCLS, GENROU, PLBVFU1, GENROUOS \n", " TimedEvent | Toggle, Fault, Alter \n", " TurbineGov | TG2, TGOV1, TGOV1DB, TGOV1N, TGOV1NDB, IEEEG1, IEESGO, \n", " | GAST, HYGOV, HYGOVDB \n", " Undefined | TimeSeries \n", " VoltComp | IEEEVC \n", "\n", "\n" ] } ], "source": [ "print(ss.supported_models())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Check model documentation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To check the documentation for the model, print the return of `doc()` for the model instance. \n", "\n", "For example, the documentation for `GENCLS` can be printed with" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.649941Z", "start_time": "2021-03-18T00:42:51.633592Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.551103Z", "iopub.status.busy": "2021-09-26T22:42:05.550856Z", "iopub.status.idle": "2021-09-26T22:42:05.553625Z", "shell.execute_reply": "2021-09-26T22:42:05.553424Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model in Group \n", "Classical generator model.\n", "\n", "Parameters\n", "\n", " Name | Description | Default | Unit | Properties \n", "--------+--------------------------+---------+------+-------------------------\n", " idx | unique device idx | | | \n", " u | connection status | 1 | bool | \n", " name | device name | | | \n", " bus | interface bus id | | | mandatory \n", " gen | static generator index | | | mandatory \n", " coi | center of inertia index | | | \n", " coi2 | center of inertia index | | | \n", " Sn | Power rating | 100 | MVA | \n", " Vn | AC voltage rating | 110 | | \n", " fn | rated frequency | 60 | | \n", " D | Damping coefficient | 0 | | power \n", " M | machine start up time | 6 | | non_zero,non_negative,po\n", " | (2H) | | | wer \n", " ra | armature resistance | 0 | | z \n", " xl | leakage reactance | 0 | | z \n", " xd1 | d-axis transient | 0.302 | | z \n", " | reactance | | | \n", " kp | active power feedback | 0 | | \n", " | gain | | | \n", " kw | speed feedback gain | 0 | | \n", " S10 | first saturation factor | 0 | | \n", " S12 | second saturation factor | 1 | | \n", " gammap | P ratio of linked static | 1 | | \n", " | gen | | | \n", " gammaq | Q ratio of linked static | 1 | | \n", " | gen | | | \n", " subidx | Generator idx in plant; | 0 | | \n", " | only used by PSS/E data | | | \n", "\n", "Variables\n", "\n", " Name | Type | Description | Unit | Properties\n", "--------+----------+-----------------------------------+----------+-----------\n", " delta | State | rotor angle | rad | v_str \n", " omega | State | rotor speed | pu (Hz) | v_str \n", " Id | Algeb | d-axis current | | v_str \n", " Iq | Algeb | q-axis current | | v_str \n", " vd | Algeb | d-axis voltage | | v_str \n", " vq | Algeb | q-axis voltage | | v_str \n", " tm | Algeb | mechanical torque | | v_str \n", " te | Algeb | electric torque | | v_str \n", " vf | Algeb | excitation voltage | pu | v_str \n", " XadIfd | Algeb | d-axis armature excitation | p.u (kV) | v_str \n", " | | current | | \n", " Pe | Algeb | active power injection | | v_str \n", " Qe | Algeb | reactive power injection | | v_str \n", " psid | Algeb | d-axis flux | | v_str \n", " psiq | Algeb | q-axis flux | | v_str \n", " a | ExtAlgeb | Bus voltage phase angle | | \n", " v | ExtAlgeb | Bus voltage magnitude | | \n", "\n", "Initialization Equations\n", "\n", " Name | Type | Initial Value \n", "--------+----------+----------------------------\n", " delta | State | delta0 \n", " omega | State | u \n", " Id | Algeb | u * Id0 \n", " Iq | Algeb | u * Iq0 \n", " vd | Algeb | u * vd0 \n", " vq | Algeb | u * vq0 \n", " tm | Algeb | tm0 \n", " te | Algeb | u * tm0 \n", " vf | Algeb | u * vf0 \n", " XadIfd | Algeb | u * vf0 \n", " Pe | Algeb | u * (vd0 * Id0 + vq0 * Iq0)\n", " Qe | Algeb | u * (vq0 * Id0 - vd0 * Iq0)\n", " psid | Algeb | u * psid0 \n", " psiq | Algeb | u * psiq0 \n", " a | ExtAlgeb | \n", " v | ExtAlgeb | \n", "\n", "Differential Equations\n", "\n", " Name | Type | RHS of Equation \"T x' = f(x, y)\" | T (LHS)\n", "-------+-------+----------------------------------+--------\n", " delta | State | u * (2 * pi * fn) * (omega - 1) | \n", " omega | State | u * (tm - te - D * (omega - 1)) | M \n", "\n", "Algebraic Equations\n", "\n", " Name | Type | RHS of Equation \"0 = g(x, y)\" \n", "--------+----------+---------------------------------\n", " Id | Algeb | + xq * Id - vf+ psid \n", " Iq | Algeb | + xq * Iq+ psiq \n", " vd | Algeb | u * v * sin(delta - a) - vd \n", " vq | Algeb | u * v * cos(delta - a) - vq \n", " tm | Algeb | tm0 - tm \n", " te | Algeb | u * (psid * Iq - psiq * Id) - te\n", " vf | Algeb | u * vf0 - vf \n", " XadIfd | Algeb | u * vf0 - XadIfd \n", " Pe | Algeb | u * (vd * Id + vq * Iq) - Pe \n", " Qe | Algeb | u * (vq * Id - vd * Iq) - Qe \n", " psid | Algeb | u * (ra*Iq + vq) - psid \n", " psiq | Algeb | u * (ra*Id + vd) + psiq \n", " a | ExtAlgeb | -u * (vd * Id + vq * Iq) \n", " v | ExtAlgeb | -u * (vq * Id - vd * Iq) \n", "\n", "Services\n", "\n", " Name | Equation | Type \n", "---------+------------------------------------------------------+-------------\n", " p0 | p0s * gammap | ConstService\n", " q0 | q0s * gammaq | ConstService\n", " _V | v * exp(1j * a) | ConstService\n", " _S | p0 - 1j * q0 | ConstService\n", " _I | _S / conj(_V) | ConstService\n", " _E | _V + _I * (ra + 1j * xq) | ConstService\n", " _deltac | log(_E / abs(_E)) | ConstService\n", " delta0 | u * im(_deltac) | ConstService\n", " vdq | u * (_V * exp(1j * 0.5 * pi - _deltac)) | ConstService\n", " Idq | u * (_I * exp(1j * 0.5 * pi - _deltac)) | ConstService\n", " Id0 | re(Idq) | ConstService\n", " Iq0 | im(Idq) | ConstService\n", " vd0 | re(vdq) | ConstService\n", " vq0 | im(vdq) | ConstService\n", " tm0 | u * ((vq0 + ra * Iq0) * Iq0 + (vd0 + ra * Id0) * | ConstService\n", " | Id0) | \n", " psid0 | u * (ra * Iq0) + vq0 | ConstService\n", " psiq0 | -u * (ra * Id0) - vd0 | ConstService\n", " vf0 | (vq0 + ra * Iq0) + xq * Id0 | ConstService\n", "\n", "\n", "Config Fields in [GENCLS]\n", "\n", " Option | Value | Info | Acceptable values\n", "--------------+-------+------------------------------------+------------------\n", " allow_adjust | 1 | allow adjusting upper or lower | (0, 1) \n", " | | limits | \n", " adjust_lower | 0 | adjust lower limit | (0, 1) \n", " adjust_upper | 1 | adjust upper limit | (0, 1) \n", " vf_lower | 1 | lower limit for vf warning | \n", " vf_upper | 5 | upper limit for vf warning | \n", "\n", "\n" ] } ], "source": [ "print(ss.GENCLS.doc())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Pretty print of variables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All symbols are stored in the attributes of `Model.syms`. For example," ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.662593Z", "start_time": "2021-03-18T00:42:51.652044Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.559067Z", "iopub.status.busy": "2021-09-26T22:42:05.558830Z", "iopub.status.idle": "2021-09-26T22:42:05.563908Z", "shell.execute_reply": "2021-09-26T22:42:05.563237Z" } }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\delta\\\\\\omega\\\\I_{d}\\\\I_{q}\\\\V_{d}\\\\V_{q}\\\\\\tau_{m}\\\\\\tau_{e}\\\\v_{f}\\\\X_{ad}I_{fd}\\\\P_{e}\\\\Q_{e}\\\\\\psi_{d}\\\\\\psi_{q}\\\\\\theta\\\\V\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ \\delta],\n", "[ \\omega],\n", "[ I_d],\n", "[ I_q],\n", "[ V_d],\n", "[ V_q],\n", "[ \\tau_m],\n", "[ \\tau_e],\n", "[ v_f],\n", "[X_{ad}I_{fd}],\n", "[ P_e],\n", "[ Q_e],\n", "[ \\psi_d],\n", "[ \\psi_q],\n", "[ \\theta],\n", "[ V]])" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.syms.xy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Differential variables comes before algebraic variables." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.669271Z", "start_time": "2021-03-18T00:42:51.664357Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.566343Z", "iopub.status.busy": "2021-09-26T22:42:05.566091Z", "iopub.status.idle": "2021-09-26T22:42:05.569646Z", "shell.execute_reply": "2021-09-26T22:42:05.569232Z" } }, "outputs": [ { "data": { "text/plain": [ "OrderedDict([('delta', State: GENCLS.delta, []),\n", " ('omega', State: GENCLS.omega, [])])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.states" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.690064Z", "start_time": "2021-03-18T00:42:51.671386Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.572435Z", "iopub.status.busy": "2021-09-26T22:42:05.572029Z", "iopub.status.idle": "2021-09-26T22:42:05.574150Z", "shell.execute_reply": "2021-09-26T22:42:05.573748Z" } }, "outputs": [ { "data": { "text/plain": [ "OrderedDict([('Id', Algeb: GENCLS.Id, []),\n", " ('Iq', Algeb: GENCLS.Iq, []),\n", " ('vd', Algeb: GENCLS.vd, []),\n", " ('vq', Algeb: GENCLS.vq, []),\n", " ('tm', Algeb: GENCLS.tm, []),\n", " ('te', Algeb: GENCLS.te, []),\n", " ('vf', Algeb: GENCLS.vf, []),\n", " ('XadIfd', Algeb: GENCLS.XadIfd, []),\n", " ('Pe', Algeb: GENCLS.Pe, []),\n", " ('Qe', Algeb: GENCLS.Qe, []),\n", " ('psid', Algeb: GENCLS.psid, []),\n", " ('psiq', Algeb: GENCLS.psiq, [])])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.algebs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Pretty print of equations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Formatted equations are stored in each model. The following attributes of `Model.syms` are available for equation printing.\n", "\n", "- f: differential equations\n", "- g: algebraic equations\n", "- df: df/dxy\n", "- dg: dg/dxy" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.706991Z", "start_time": "2021-03-18T00:42:51.692982Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.576738Z", "iopub.status.busy": "2021-09-26T22:42:05.576419Z", "iopub.status.idle": "2021-09-26T22:42:05.579264Z", "shell.execute_reply": "2021-09-26T22:42:05.578966Z" } }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}2 \\pi f u \\left(\\omega - 1\\right)\\\\u \\left(- D \\left(\\omega - 1\\right) - \\tau_{e} + \\tau_{m}\\right)\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 2*pi*f*u*(\\omega - 1)],\n", "[u*(-D*(\\omega - 1) - \\tau_e + \\tau_m)]])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.syms.f" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.759933Z", "start_time": "2021-03-18T00:42:51.712205Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.581659Z", "iopub.status.busy": "2021-09-26T22:42:05.581354Z", "iopub.status.idle": "2021-09-26T22:42:05.584077Z", "shell.execute_reply": "2021-09-26T22:42:05.583811Z" } }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}I_{d} xq + \\psi_{d} - v_{f}\\\\I_{q} xq + \\psi_{q}\\\\V u \\sin{\\left(\\delta - \\theta \\right)} - V_{d}\\\\V u \\cos{\\left(\\delta - \\theta \\right)} - V_{q}\\\\- \\tau_{m} + \\tau_{m0}\\\\- \\tau_{e} + u \\left(- I_{d} \\psi_{q} + I_{q} \\psi_{d}\\right)\\\\u v_{f0} - v_{f}\\\\- X_{ad}I_{fd} + u v_{f0}\\\\- P_{e} + u \\left(I_{d} V_{d} + I_{q} V_{q}\\right)\\\\- Q_{e} + u \\left(I_{d} V_{q} - I_{q} V_{d}\\right)\\\\- \\psi_{d} + u \\left(I_{q} r_{a} + V_{q}\\right)\\\\\\psi_{q} + u \\left(I_{d} r_{a} + V_{d}\\right)\\\\- u \\left(I_{d} V_{d} + I_{q} V_{q}\\right)\\\\- u \\left(I_{d} V_{q} - I_{q} V_{d}\\right)\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ I_d*xq + \\psi_d - v_f],\n", "[ I_q*xq + \\psi_q],\n", "[ V*u*sin(\\delta - \\theta) - V_d],\n", "[ V*u*cos(\\delta - \\theta) - V_q],\n", "[ -\\tau_m + \\tau_{m0}],\n", "[-\\tau_e + u*(-I_d*\\psi_q + I_q*\\psi_d)],\n", "[ u*v_{f0} - v_f],\n", "[ -X_{ad}I_{fd} + u*v_{f0}],\n", "[ -P_e + u*(I_d*V_d + I_q*V_q)],\n", "[ -Q_e + u*(I_d*V_q - I_q*V_d)],\n", "[ -\\psi_d + u*(I_q*r_a + V_q)],\n", "[ \\psi_q + u*(I_d*r_a + V_d)],\n", "[ -u*(I_d*V_d + I_q*V_q)],\n", "[ -u*(I_d*V_q - I_q*V_d)]])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.syms.g" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.767740Z", "start_time": "2021-03-18T00:42:51.761462Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.586634Z", "iopub.status.busy": "2021-09-26T22:42:05.586287Z", "iopub.status.idle": "2021-09-26T22:42:05.588325Z", "shell.execute_reply": "2021-09-26T22:42:05.588571Z" } }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{array}{cccccccccccccccc}0 & 2 \\pi f u & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & - D u & 0 & 0 & 0 & 0 & u & - u & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\end{array}\\right]$" ], "text/plain": [ "Matrix([\n", "[0, 2*pi*f*u, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", "[0, -D*u, 0, 0, 0, 0, u, -u, 0, 0, 0, 0, 0, 0, 0, 0]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.syms.df" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.791586Z", "start_time": "2021-03-18T00:42:51.772159Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.590955Z", "iopub.status.busy": "2021-09-26T22:42:05.590367Z", "iopub.status.idle": "2021-09-26T22:42:05.592966Z", "shell.execute_reply": "2021-09-26T22:42:05.593247Z" } }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{array}{cccccccccccccccc}0 & 0 & xq & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\\\0 & 0 & 0 & xq & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\\\V u \\cos{\\left(\\delta - \\theta \\right)} & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & - V u \\cos{\\left(\\delta - \\theta \\right)} & u \\sin{\\left(\\delta - \\theta \\right)}\\\\- V u \\sin{\\left(\\delta - \\theta \\right)} & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & V u \\sin{\\left(\\delta - \\theta \\right)} & u \\cos{\\left(\\delta - \\theta \\right)}\\\\0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & - \\psi_{q} u & \\psi_{d} u & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & I_{q} u & - I_{d} u & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & V_{d} u & V_{q} u & I_{d} u & I_{q} u & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & V_{q} u & - V_{d} u & - I_{q} u & I_{d} u & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & r_{a} u & 0 & u & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0\\\\0 & 0 & r_{a} u & 0 & u & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\\\0 & 0 & - V_{d} u & - V_{q} u & - I_{d} u & - I_{q} u & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & - V_{q} u & V_{d} u & I_{q} u & - I_{d} u & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\end{array}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0, xq, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0],\n", "[ 0, 0, 0, xq, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],\n", "[ V*u*cos(\\delta - \\theta), 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -V*u*cos(\\delta - \\theta), u*sin(\\delta - \\theta)],\n", "[-V*u*sin(\\delta - \\theta), 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, V*u*sin(\\delta - \\theta), u*cos(\\delta - \\theta)],\n", "[ 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", "[ 0, 0, -\\psi_q*u, \\psi_d*u, 0, 0, 0, -1, 0, 0, 0, 0, I_q*u, -I_d*u, 0, 0],\n", "[ 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0],\n", "[ 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0],\n", "[ 0, 0, V_d*u, V_q*u, I_d*u, I_q*u, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0],\n", "[ 0, 0, V_q*u, -V_d*u, -I_q*u, I_d*u, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0],\n", "[ 0, 0, 0, r_a*u, 0, u, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0],\n", "[ 0, 0, r_a*u, 0, u, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],\n", "[ 0, 0, -V_d*u, -V_q*u, -I_d*u, -I_q*u, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", "[ 0, 0, -V_q*u, V_d*u, I_q*u, -I_d*u, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.syms.dg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Pretty print of services" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The list of services is in `services`." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.804147Z", "start_time": "2021-03-18T00:42:51.795821Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.597841Z", "iopub.status.busy": "2021-09-26T22:42:05.597547Z", "iopub.status.idle": "2021-09-26T22:42:05.601374Z", "shell.execute_reply": "2021-09-26T22:42:05.601111Z" } }, "outputs": [ { "data": { "text/plain": [ "OrderedDict([('p0', ConstService: GENCLS.p0, v=0.0),\n", " ('q0', ConstService: GENCLS.q0, v=0.0),\n", " ('_V', ConstService: GENCLS._V, v=0.0),\n", " ('_S', ConstService: GENCLS._S, v=0.0),\n", " ('_I', ConstService: GENCLS._I, v=0.0),\n", " ('_E', ConstService: GENCLS._E, v=0.0),\n", " ('_deltac', ConstService: GENCLS._deltac, v=0.0),\n", " ('delta0', ConstService: GENCLS.delta0, v=0.0),\n", " ('vdq', ConstService: GENCLS.vdq, v=0.0),\n", " ('Idq', ConstService: GENCLS.Idq, v=0.0),\n", " ('Id0', ConstService: GENCLS.Id0, v=0.0),\n", " ('Iq0', ConstService: GENCLS.Iq0, v=0.0),\n", " ('vd0', ConstService: GENCLS.vd0, v=0.0),\n", " ('vq0', ConstService: GENCLS.vq0, v=0.0),\n", " ('tm0', ConstService: GENCLS.tm0, v=0.0),\n", " ('psid0', ConstService: GENCLS.psid0, v=0.0),\n", " ('psiq0', ConstService: GENCLS.psiq0, v=0.0),\n", " ('vf0', ConstService: GENCLS.vf0, v=0.0)])" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.services" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Service equations are in `Model.syms.s` For example, services of `GENCLS` is in" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2021-03-18T00:42:51.831075Z", "start_time": "2021-03-18T00:42:51.808859Z" }, "execution": { "iopub.execute_input": "2021-09-26T22:42:05.604167Z", "iopub.status.busy": "2021-09-26T22:42:05.603851Z", "iopub.status.idle": "2021-09-26T22:42:05.607203Z", "shell.execute_reply": "2021-09-26T22:42:05.607449Z" } }, "outputs": [ { "data": { "text/plain": [ "[P_{0s}*\\gamma_P,\n", " Q_{0s}*\\gamma_Q,\n", " V*exp(I*\\theta),\n", " P_0 - I*Q_0,\n", " S/conj(V_c),\n", " I_c*(r_a + I*xq) + V_c,\n", " log(E/Abs(E)),\n", " u*im(\\delta_c),\n", " V_c*u*exp(-\\delta_c + 0.5*I*pi),\n", " I_c*u*exp(-\\delta_c + 0.5*I*pi),\n", " re(I_{dq}),\n", " im(I_{dq}),\n", " re(V_{dq}),\n", " im(V_{dq}),\n", " u*(I_{d0}*(I_{d0}*r_a + V_{d0}) + I_{q0}*(I_{q0}*r_a + V_{q0})),\n", " I_{q0}*r_a*u + V_{q0},\n", " -I_{d0}*r_a*u - V_{d0},\n", " I_{d0}*xq + I_{q0}*r_a + V_{q0}]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss.GENCLS.syms.s" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.10" }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }