Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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.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()