Ask Your Question
0

Print individual contingencies to sliders

asked 2017-04-20 10:48:52 -0500

psse_sam gravatar image

I am trying to print individual contingencies in an accc. Right now the only ways I can think of doing this is either by creating a pseudo accc that prints a system slider after each contingency solution or by somehow interrupting the accc solution at each contingency to print a slider.

Does anyone have any ideas on this?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-05-28 19:44:44 -0500

oppossumX gravatar image

updated 2017-05-28 19:46:32 -0500

Interesting, I like the powerpoint idea. I often need to generate SLDs showing results of overload violations under different contingencies for reports. When there are a lot of overloads it can be very tedious to manually generate an SLD for each one. So I made a python script to do it :)

I use a python script ran from inside the GUI with a SLD and case already open. The code reads and parses the ".con" file used in ACCC. Using the contingency definitions in the ".con" file it applies the contingency to the case, solves, refreshes the open SLD, saves a pdf of it, then reload the original case and repeat for the next contingency. I use sliderpy to add a title to each SLD with the respective contingency name read from the ".con" file before saving the SLD pdf.

Prior to running the code, I make sure the SLD is setup with any diagram annotation or contouring settings I desire in my output files.

Couple issues: user needs to ensure solution settings used in ACCC and SLD automation are same. extra coding is needed to handle dispatch mode, induction machine stalls, and load throwover if required you may want to read the mon and sub files as well if their content is important to your SLD creation

edit flag offensive delete link more
0

answered 2017-04-28 17:02:21 -0500

nwilson gravatar image

updated 2017-05-25 17:41:34 -0500

I don't think you can write a python script to print ACCC results on a slider for multiple contingencies. If you're looking to create a slider-like graphical report for different contingencies, you could write a python script that populates PowerPoint slides with labeled objects (lines that represent buses, branches) that are customized for each contingency. Here's something to get you going:

import win32com.client as win32

from time import sleep

msoRoundRectangle = 5   #5 is a rounded rectangle. https://msdn.microsoft.com/en-us/library/office/aa170976(v=office.11).aspx

def main():
    ppoint()

RANGE = range(3, 8)

def RGBtoInt(R,G,B):
    result = R*(256**2) + G*256 + B
    return result

def ppoint():
    app = 'PowerPoint'
    ppoint = win32.gencache.EnsureDispatch('%s.Application' % app)
    pres = ppoint.Presentations.Add()
    ppoint.Visible = True

    s1 = pres.Slides.Add(1, win32.constants.ppLayoutText)
    sleep(1)
    s1a = s1.Shapes[0].TextFrame.TextRange
    s1a.Text = 'Python-to-%s Demo' % app
    sleep(1)
    s1b = s1.Shapes[1].TextFrame.TextRange
    s1.Shapes.AddShape(msoRoundRectangle,900,20,50,30)
    s1.Shapes.AddShape(msoRoundRectangle,450,500,50,30)
    sleep(1)
    #connect "buses"
    #see https://msdn.microsoft.com/EN-US/library/office/ff840820.aspx
    myline = s1.Shapes.AddLine(925,35,475,515).Line
    #change line properties with LineFormat object: https://msdn.microsoft.com/en-us/library/office/ff194214.aspx
    myline.ForeColor.RGB = RGBtoInt(50,0,128)   #violet line color
    sleep(1)
    #warn(app)
    #pres.Save()     #saves to default location (My Documents). https://msdn.microsoft.com/en-us/library/office/ff745194.aspx
    pres.SaveAs("C:\\temp\\test")     #https://msdn.microsoft.com/en-us/library/office/ff746389.aspx
    ppoint.Quit()


if __name__ == '__main__':
    main()
edit flag offensive delete link more

Comments

can you share with us this python script ?

yaya gravatar imageyaya ( 2017-05-03 04:37:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2017-04-20 10:48:52 -0500

Seen: 993 times

Last updated: May 28 '17