Python for IPSA (Power flow analysis)

steve.ingram at tnei.co.uk steve.ingram at tnei.co.uk
Wed May 29 04:51:36 EDT 2013


On Tuesday, May 28, 2013 11:00:42 AM UTC+1, Debbie wrote:
> Hi there,
> 
> I am new to Python, and wondering if you could help me with python based coding for the IPSA (Power system analysis software). I have a electrical distribution network with generators, buses and loads, on which I am performing the load flow analysis every 1 hour for a period of 1 year. 
> 
> 
> 
> The code to perform instantaneous load/power flow analysis is given below. I need to modify it such that I can perform this load flow analysis every 1 hour for a period of 1 year. Please help.
> 
> 
> 
> from ipsa import *
> 
> 
> 
> ipsasys = IscInterface()
> 
> net = ipsasys.ReadFile("refinery.iif")
> 
> bok = net.DoLoadFlow();
> 
> if bok:
> 
>     busbars = net.GetBusbars()
> 
>     print "Load Flow results:"
> 
>     print ""
> 
>     print "BusName     Vmag(kV)"
> 
>     print "===================="
> 
>     for bus in busbars.itervalues():
> 
>         name = bus.GetName()
> 
>         vm = bus.GetVoltageMagnitudekV()
> 
>         res = "%-8s  %10.5f" % (name, vm)
> 
>         print res
> 
> else:
> 
>     print "Load Flow failed!"
> 
> 
> 
> Regards,
> 
> Debbie

Hi Debbie,

Just found your question. I work for Ipsa and, among other things, provide support for the scripting side.

The quickest way to achieve what you want is to adjust the loads on the network and perform a load flow. The sequence would be roughly as follows;

for hours in year():
    # set load values
    loads = net.GetLoads()
    for load in loads().itervalues:
        # set new value for each load to represent the next hour of data
        load.SetDValue(IscLoad.ReactiveMVAr, next_MVAr_value)
        load.SetDValue(IscLoad.RealMW, next_MW_value)

        net.DoLoadFlow()
        # do something with these results
 
The above code obviously won't work and will need tweaking, but should give you the idea. The next version of Ipsa (2.3.2) will have load profiles in so will give a different way of achieving the same results, as well as speed improvements.

As Robert mentioned, the best place for Ipsa support is to go onto the website (www.ipsa-power.com) and check the Support of Education pages or check the LinkedIn group Ipsa Power Software Group at http://www.linkedin.com/groups/IPSA-Power-Software-4860907

Hope this helps,

Steve



More information about the Python-list mailing list