Why does figure close immediately after opening? And how to fix it?

58 Views Asked by At

I am having problem with a figure which closes immediatly after opening, so I can't see it.

I am programming in Python, using VS Code (cmd inside as the terminal) and using PandaPower library. I don't realize if the problem is in the coding, the vs code environment or something else?

I am following this tutorial: (scroll down to "Show tripped grid") https://github.com/e2nIEE/pandapower/blob/develop/tutorials/protection/oc_relay.ipynb

If I run this exact same code in my computer this problem happens.

Here is the code I am currently working on, with the same problem:

import pandas as pd
import pandapower as pp
from pandapower.protection import oc_relay_model as oc_protection
from pandapower.protection.utility_functions import plot_tripped_grid
import random
from random import randint

def create_network():

def random_fault():

if __name__ == '__main__':

    # create our testnetwork
    testnet = create_network()

    # run powerflow
    pp.runpp(testnet, init = 'flat')

    # get the location of the fault
    linefault, faultloc = random_fault()

    # create overcurrent protection (Definite Time OC protection)
    relay_settings_DTOC = oc_protection.oc_parameters(testnet, relay_type='DTOC', time_settings = [0.07, 0.5, 0.3])

    # trip a random line
    trip_decisions, testnet_sc = oc_protection.run_fault_scenario_oc(testnet,sc_line_id = linefault, sc_location = faultloc, relay_settings = relay_settings_DTOC)

    # !! THIS IS WHERE THE FIGURE IS DRAWN
    plot_tripped_grid(testnet_sc, trip_decisions, sc_location = faultloc, plot_annotations = True)  
0

There are 0 best solutions below