Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46274
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'else:': 0.03; 'languages,': 0.04; 'subject:Python': 0.06; '#if': 0.07; 'definitions': 0.07; 'modify': 0.07; 'welcome.': 0.07; 'hour.': 0.09; 'parameter': 0.09; 'python': 0.11; 'def': 0.12; '2.7': 0.14; '(just': 0.16; 'definition)': 0.16; 'first:': 0.16; 'guess.': 0.16; 'iterator': 0.16; 'latter,': 0.16; 'res': 0.16; 'subject:analysis': 0.16; 'subject:flow': 0.16; 'top-level': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'year,': 0.18; 'file,': 0.19; 'help.': 0.21; 'code,': 0.22; 'programming': 0.22; 'import': 0.22; 'coding': 0.22; 'print': 0.22; 'load': 0.23; 'header:User- Agent:1': 0.23; 'question': 0.24; 'source': 0.25; 'performing': 0.26; 'skip:" 20': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'wondering': 0.29; 'am,': 0.29; 'code': 0.31; "year's": 0.31; 'figure': 0.32; 'bus': 0.33; 'period': 0.33; 'there,': 0.34; 'could': 0.34; 'subject: (': 0.35; 'something': 0.35; 'version': 0.36; 'data,': 0.36; 'next': 0.36; 'turn': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'little': 0.38; 'flow': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'read': 0.60; 'tell': 0.60; 'year.': 0.61; 'new': 0.61; 'first': 0.61; "you've": 0.63; 'name': 0.63; 'such': 0.63; 'skip:n 10': 0.64; 'received:74.208': 0.68; 'hour': 0.70; 'below.': 0.71; 'electrical': 0.74; 'analysis': 0.75; 'hour,': 0.84; 'received:74.208.4.194': 0.84; 'subject:Power': 0.84; 'yourself,': 0.95 |
| Date | Tue, 28 May 2013 07:14:37 -0400 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Python for IPSA (Power flow analysis) |
| References | <6288a409-db46-4987-91a7-2f3dd65b42dc@googlegroups.com> |
| In-Reply-To | <6288a409-db46-4987-91a7-2f3dd65b42dc@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:FkS6aQaxq4VqRFUS4jTeIVLCrgq+7USBXxqrA45kI6I e76Hn/5WmrpydszBahZo75s7Xq3IPXQL8PmeDzfyV+iCosTdh9 CFr06r8vUfR7981Am6RJUMAW5tipKpTgKY/1vPZVM+KqGWWCdU Jp2Qt0KOM99S8EL1O1ykvadDYFSHvE0ocFSQ1+8RAk7mHWfNhf y8CUla1clv1UmnxaAPl4hu3WZTLsQxG5wAGETL87O9KxBsHai9 LBOAbGcWdVx7EWBHQ2BNZCgAFpAn5OXxrUQQM/0p3NG90b18Kd jFI++gCSdDljYBsRkSz0RM09F1dNbSwn4vWtsJ2T/nHOMJwRT/ daSXLBRFuqzTjBeA6plA= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2292.1369739691.3114.python-list@python.org> (permalink) |
| Lines | 93 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369739691 news.xs4all.nl 15906 [2001:888:2000:d::a6]:55006 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:46274 |
Show key headers only | View raw
On 05/28/2013 06:00 AM, Debbie wrote:
> Hi there,
> I am new to Python,
Welcome. Could you tell us a little about yourself, such as whether
you've experience in a few other languages, or if Python is your first
programming experience? Also, what version of Python (presumably 2.7 or
2.6) and what OS ?
> 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 *
I have no idea what functionality is in ipsa, so this whole message is a
guess. First question is whether the ReadFile() below and the
DoLoadFlow() read the whole year's data, or data for a particular hour.
And if the latter, how do you get the next set of data?
>
> 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
>
First you want to make a function to print out a particular hour's data.
That might turn out to be something like:
def one_hour(net):
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
(Just pasted from your code, I added in the probable parameter to the
definition)
Now your main function might be something like:
def main(filename):
ipsasys = IscInterface()
net = ipsasys.ReadFile(filename)
#if net gets you data for one hour, figure out how
#to get the data for the whole year, in the form
#of a list or an iterator called nets
bok = net.DoLoadFlow();
if bok:
for net in nets:
one_hour(net)
else:
print "Load Flow failed!"
#and your top-level code is:
main("refinery.iif")
As to ordering in the source file, put the import first:
from ipsa import *
then your function definitions one_hour() and main(), then
your top-level code.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python for IPSA (Power flow analysis) Debbie <dia.sussex@gmail.com> - 2013-05-28 03:00 -0700 Re: Python for IPSA (Power flow analysis) Dave Angel <davea@davea.name> - 2013-05-28 07:14 -0400 Re: Python for IPSA (Power flow analysis) Robert Marshall <spam@capuchin.co.uk> - 2013-05-28 13:08 +0100 Re: Python for IPSA (Power flow analysis) steve.ingram@tnei.co.uk - 2013-05-29 01:51 -0700
csiph-web