Menu

Relative reference in scripting

robot6
2015-01-15
2015-01-15
  • robot6

    robot6 - 2015-01-15

    I have checked the Membrane Unit Operation model to see how to write a script in IronPython. Unfortunately, it seems that the model uses absolute naming conventions for the feed stream, and not relative. What I mean to say by this is that it references "feed" directly on the sheet, not "Input Stream 1->". The disadvantage to this is that this unit operation cannot be generalized, since it doesn't refer to its inputs directly but refers to some named objects on the sheet that may not be actually connected to it.

    So how do I refer to the object which I have attached to Inlet Stream 1?

    Thanks!

     
  • Daniel Medeiros

    Daniel Medeiros - 2015-01-15

    Hi John,

    In the help (F1) file you'll find a section for the Script UO where you can find the associated objects and their names:

    There are up to six streams available for the UO, three as input and three as output. Supported Languages are IronPython, IronRuby, VBScript and JScript. You can use some predefined reference variables inside your script, defined as shortcuts to the most common objects:

    ims1: Input Material Stream in slot 1 (MaterialStream class instance)
    ims2: Input Material Stream in slot 2 (MaterialStream class instance)
    ims3: Input Material Stream in slot 3 (MaterialStream class instance)
    oms1: Output Material Stream in slot 1 (MaterialStream class instance)
    oms2: Output Material Stream in slot 2 (MaterialStream class instance)
    oms3: Output Material Stream in slot 3 (MaterialStream class instance)
    Me: Reference variable to the Custom UO object instance (CustomUO UnitOperation class)
    Flowsheet: Reference variable to the active flowsheet object (FormChild class)
    Solver: Flowsheet solver class instance, used to send commands to the calculator (COMSolver class)

     
  • Daniel Medeiros

    Daniel Medeiros - 2015-01-15

    Except that it doesn't support IronRuby anymore, nor VBScript/JScript. :-)

     
  • robot6

    robot6 - 2015-01-15

    Thank you.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.