Setting-up and simple example for PSSL

Installing JyDT

This section describes how to install JyDT by connecting to the JyDT update site on the internet. If you have downloaded an update site to a computer on your network, please follow the instructions to install from a lonullcal update site.

If you have another plug-in installed that includes an editor to open .py files, it might be better to uninstall it before proceeding with the installation of JyDT.

1. Choose Help>Software Updates>Find and Install from the bar

2. The Install/Update dialog appears. Select option "Search for new features to install" and press "Next".

3. The dialog displays "Update sites to visit" which looks like this:

Press "New Remote Site". The "New Update Site" dialog appears. Fill it in as follows and press "OK".

JyDT Update Site

4. Check item "JyDT Update Site" and press "Finish".

5. Eclipse searches for updates. After a while, a new dialog displays "Search Results" with the available features. Expand item "JyDT Update Site". When you install the plug-in, there will probably be more recent versions than shown below. Check the version of "JyDT" that is appropriate for the version of Eclipse that you are running and press "Next".

6. The dialog now displays the "Feature Licence". Read and accept the licence agreement. Press "Next".

7. The dialog now displays "Installation". Select the sites to install the plug-in in. The default install location is probably OK. Press "Finish".

8. Eclipse downloads the plug-in. When you are prompted that you are installling an unsigned feature, press "Install".

9. Eclipse installs the plug-in. When you are prompted to restart the workbench, press "Yes".

10. Done. Read the getting started section to configure the plug-in before switching to the Jython perspective or the Jython Browsing perspective and creating your first Jython project.

Getting Started

  • Default class path

When most of your Jython projects use the same JAR files, it is handy to set the default class path. The default class path will be set as the class path of new Jython projects.

In the preferences, you find a category "Jython". Select the subcategory "Class Path" and add default JARs and folders as desired:

    • Setup for launching Jython modules

To run a Jython module, you have to install Jython on your computer. In the remainder, it is assumed that you have downloaded the Jython 2.1 distribution from and that you installed it at C:\dev\jython-2.1 on a MS Windows machine.

The plug-in needs to know where Jython is installed and where to find important Jython files. These settings are used when a Jython launch configuration is created.

In the preferences, you find a category "Jython". Select the subcategory "Installation" and fill in the preferences as follows. Do not set the Jython library if you will set up a project for the Jython library.

When the second and the third field are empty and you enter a full path in the first field, the second and the third field will be filled in automatically.

Creating a Jython Project

Although Jython module editing is supported in a simple Eclipse project, the most powerful editing facilities are available only when a module resides in a Jython project. A Jython project knows the source folders that contain Jython

modules and it knows where to find Jython libraries used by the modules. It holds onto a system path and a class path that describe where to find modules and jars when a module is launched.

The plug-in comes with a new wizard to create Jython projects and to specify the project's properties.

1. Select "New Project..." from the toolbar or "New>Project..." from the menubar to open the new wizard.

2. Press the "Next" button to move to the page to enter the project name and the project location.

3. Press the "Next" button to move to the page to specify the referenced projects.

If you have a project for the Jython library, as shown in the picture, and you do not want to specify the Jython library as a library used by the project (see Organizing Projects), tick that project. Tick all other projects of which you need modules in your project.

4. Press the "Next" button to move to the page to specify the project's source folders and the Jython system path.

5. Add source folders using the "Add Folder..." button. Remove folders with the "Remove" button if the folders should not be treated as source folders.

6. Thick the source folders that should be put on the Jython system path. They will be listed on the "Order" page.

7. On the "Libraries" page, add library folders with the "Add Folder..." button. Typically, the library folder of your Jython installation is added here if the Jython library is not specified as a referenced project. Therefore, the library folder specified in the preferences will be included automatically.

8. Press the "Next" button to move to the page to specify the project's class path. The class path of a project is used when a Jython launch configuration is created for a file in the project. The jars on the project's class path will be added to the class path of a launch configuration.

9. On the "Libraries" page, add individual JARs to the class path with the "Add External JAR..." button, all JARs in a folder with the "Add JARs in Folder..." button and folders with the "Add Folder..." button.

10. Press "Finish". The Jython project will be built, which means that all libraries and all modules in the source folders are parsed and analyzed. All modules are put in the so-called Jython model. The model holds an abstract representation of the modules that can be used for browsing without the need of having the source files in memory (see the Jython Browsing perspective).

A sample load flow example

    1. Creat a project (follow the steps of creating a project above)
    2. Set class properties . remember to add the latest JARs (check out in google code site) as follow:
    3. Make a new empty Jython Module (just like a java class)
    4. The code for this sample load flow example: (just copy and paste it)

from com.interpss.simu.dsl import IpssAclf;

from com.interpss.common.datatype import UnitType;

from org.apache.commons.math.complex import Complex;

from com.interpss.core.aclf import AclfGenCode;

from com.interpss.core.aclf import AclfLoadCode;

from com.interpss.core.aclf import AclfBranchCode;

from com.interpss.core.algorithm import AclfMethod;

from org.interpss.display import AclfOutFunc

aclfNet = IpssAclf.createAclfNetwork("Sample AclfNetwork") \

.setBaseKva(100000.0) \


IpssAclf.addAclfBus("Bus1", "name-Bus 1", aclfNet) \

.setBaseVoltage(4000.0) \

.setGenCode(AclfGenCode.SWING) \

.setVoltageSpec(1.0, UnitType.PU, 0.0, UnitType.Deg);

IpssAclf.addAclfBus("Bus2", "name-Bus 2", aclfNet) \

.setBaseVoltage(4000.0) \

.setLoadCode(AclfLoadCode.CONST_P) \

.setLoad(Complex(1.0, 0.8), UnitType.PU);

IpssAclf.addAclfBranch("Bus1", "Bus2", aclfNet) \

.setBranchCode(AclfBranchCode.LINE) \

.setZ(Complex(0.05, 0.1), UnitType.PU);

IpssAclf.createLoadflowAlgorithm(aclfNet) \

.setLfMethod(AclfMethod.NR) \

.setTolerance(0.0001, UnitType.PU) \


print AclfOutFunc.loadFlowSummary(aclfNet);

5. right button click on the main window and Run it as Jython

Remember can’t run as JAVA application by click run button

6. you can get the following result if there is no errors

Load Flow Summary

Max Power Mismatches

Bus dPmax Bus dQmax


Bus2 0.000008 Bus2 0.000007 (pu)

0.795773 0.716587 (kva)

BusID Code Volt(pu) Angle(deg) P(pu) Q(pu)


Bus1 Swing 1.00000 0.0 1.1153 1.0306

Bus2 ConstP 0.84331 -4.1 -1.0000 -0.8000