<jupyter_start><jupyter_text>ANDES Demonstration of `DGPRCTExt` on IEEE 14-Bus SystemPrepared by <NAME>. Last revised 12 September 2021. BackgroundVoltage signal is set manually to demonstrate `DGPRCTExt`.In the modified IEEE 14-bus system, 10 `PVD1` are conencted to `Bus4`, and 1 `DGPRCTExt` is added aiming at `PVD1_2`. Conclusion`DGPRCTExt` can be used to implement protection on `DG` models, where the voltage signal can be manipulated manually. This feature allows co-simulation where you can input the external voltage signal into ADNES by `set` function.<jupyter_code>import andes
from andes.utils.paths import get_case

andes.config_logger(stream_level=30)
ss = andes.load(get_case('ieee14/ieee14_dgprctext.xlsx'),
                setup=False,
                no_output=True)
ss.setup()
# use constant power model for PQ
ss.PQ.config.p2p = 1
ss.PQ.config.q2q = 1
ss.PQ.config.p2z = 0
ss.PQ.config.q2z = 0

# turn off under-voltage PQ-to-Z conversion
ss.PQ.pq2z = 0
ss.PFlow.run()<jupyter_output><empty_output><jupyter_text>SimulationLet's run the simulation and manipulate the voltage signal manually.1) run the TDS to 1s.<jupyter_code>ss.TDS.config.tf = 1
ss.TDS.run()<jupyter_output>TGOV1.LAG_lim out of limits <VMIN>

  idx    | Flag | Input Value | Limit
---------+------+-------------+------
 TGOV1_2 | zl   | 0           | 0.300<jupyter_text>2) store initial Bus4 voltage value.<jupyter_code>bus4v0 = ss.Bus.v.v[3]<jupyter_output><empty_output><jupyter_text>3) set the external voltage at 0.7 manually.<jupyter_code>ss.DGPRCTExt.set(src='v', idx='DGPRCTExt_1', attr='v', value=0.7)<jupyter_output><empty_output><jupyter_text>4) continue the TDS to 5s.<jupyter_code>ss.TDS.config.tf = 5
ss.TDS.run()<jupyter_output>100%|█████████████████████████████| 100.0/100 [00:00<00:00, 264.89%/s]<jupyter_text>5) reset the external voltage back to normal manually.<jupyter_code>ss.DGPRCTExt.set(src='v', idx='DGPRCTExt_1', attr='v', value=bus4v0)<jupyter_output><empty_output><jupyter_text>6) continue the TDS to 10s.<jupyter_code>ss.TDS.config.tf = 10
ss.TDS.run()<jupyter_output>100%|█████████████████████████████| 100.0/100 [00:00<00:00, 191.20%/s]<jupyter_text>Results  system frequency<jupyter_code>ss.TDS.plt.plot(ss.GENROU.omega,
                ycalc=lambda x:60*x,
                title='Generator Speed $\omega$')<jupyter_output><empty_output><jupyter_text>Lock flagThe lock flag is raised at after `TVl1` when the voltage drop below `Vl1`.<jupyter_code>ss.TDS.plt.plot(ss.DGPRCTExt.ue,
                title='DGPRCTExt\_1 lock flag (applied on PVD1\_2)')<jupyter_output><empty_output><jupyter_text>PVD1_2 read frequency and frequency signal sourceThe `PVD1_2` read frequency is locked, but the signal source (in the `BusFreq 4`) remains unchanged<jupyter_code>ss.TDS.plt.plot(ss.PVD1.fHz,
                a=(0,1),
                title='PVD1 Read f')

ss.TDS.plt.plot(ss.DGPRCTExt.fHz,
                title='BusFreq 4 Output f')<jupyter_output><empty_output><jupyter_text>PVD1_2 power command`PVD1_2` power commands are locked to 0 **immediately**.Once the protection was released, they returned to normal **immediately**.<jupyter_code>ss.TDS.plt.plot(ss.PVD1.Psum,
                a=(0,1),
                title='PVD1 $P_{tot}$ (active power command)')

ss.TDS.plt.plot(ss.PVD1.Qsum,
                a=(0,1),
                title='PVD1 $Q_{tot}$ (reactive power command)')<jupyter_output><empty_output><jupyter_text>PVD1_2 current commandConsequently, `PVD1_2` current commands are locked to 0 **immediately**.Once the protection was released, they returned to normal **immediately**.<jupyter_code>ss.TDS.plt.plot(ss.PVD1.Ipul,
                a=(0,1),
                title='PVD1 $I_{p,ul}$ (current command before hard limit)')

ss.TDS.plt.plot(ss.PVD1.Iqul,
                a=(0,1),
                title='PVD1 $I_{q,ul}$ (current command before hard limit)')<jupyter_output><empty_output><jupyter_text>PVD1_2 output currentAs a result, `PVD1_2` output current decreased to 0 **gradually**.When the protection was released, they returned to normal **gradually**.Here, the `PVD1` output current `Lag` time constant (`tip` and `tiq`) are modified to 0.5, which is only for observation.Usually, power electronic device can response in ms level.<jupyter_code>ss.TDS.plt.plot(ss.PVD1.Ipout_y,
                a=(0,1),
                title='PVD1 $I_{p,out}$ (actual output current)')

ss.TDS.plt.plot(ss.PVD1.Iqout_y,
                a=(0,1),
                title='PVD1 $I_{q,out}$ (actual output current)')<jupyter_output><empty_output><jupyter_text>Cleanup<jupyter_code>!andes misc -C<jupyter_output>_           _         | Version 1.5.7.post29.dev0+g8b9dfdff
   /_\  _ _  __| |___ ___ | Python 3.9.7 on Linux, 12/14/2021 05:18:12 PM
  / _ \| ' \/ _` / -_|_-< | 
 /_/ \_\_||_\__,_\___/__/ | This program comes with ABSOLUTELY NO WARRANTY.

No output file found in the working directory.
{'fraction_non_alphanumeric': 0.1454471379099613, 'fraction_numerical': 0.0401303727846812, 'mean_word_length': 3.8326771653543306, 'pattern_counts': {'":': 0, '<': 58, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '13918', 'license': 'Apache-2.0', 'n_tokens_mistral': 1998, 'n_tokens_neox': 1803, 'n_words': 396, 'path': 'examples/demonstration/1.2 demo_DGPRCTExt.ipynb', 'repo_name': 'cuihantao/Andes', 'size': '4915'}