Menu

Where is defined ims1?

2017-08-07
2017-08-08
  • Milos Dobes

    Milos Dobes - 2017-08-07

    Hi,
    I'm trying to write a simple script to overwrite some values using the example that works:

    Import clr
    from DWSIM import *
    Input = ims1
    T = 350
    etc.

    But right after start I get an error:
    File "<string>", line 3, in <module>
    NameError: name 'ims1' is not defined
    What am I doing wrong?

     
  • Daniel Medeiros

    Daniel Medeiros - 2017-08-07

    ims1 is defined only for scripts inside the Script Unit Operation, not for global flowsheet scripts.

     
  • Milos Dobes

    Milos Dobes - 2017-08-08

    Hi Daniel,
    Thank you for answer. I rewrited script as UO, it seems to be OK.
    Now I read some properties from input stream. Some are OK, but with some I have problem.

    Vapor mass fraction:
    y = input.GetProp("massfraction", "Vapor", None, "Vapor", "mass")
    It works, but returns a bad result.

    Surface tension:
    surfTenL = input.GetProp("surfaceTension", "Liquid", None, "LIquid", "mass")
    TypeError: At least one element in the source array could not be cast down to the destination array type.

    Vapor specific volume:
    vv = input.GetProp("spec_vol", "Vapor", None, "Vapor", "mass")
    StandardError: Error in the application.

    Milos

     
  • Daniel Medeiros

    Daniel Medeiros - 2017-08-08

    Take a look at the other script samples (Hydrocyclone and Membrane).

     
  • Milos Dobes

    Milos Dobes - 2017-08-12

    Hi Daniel
    Something has been solved, but the problem with "surface tension" is failing to solve for me.

    surfTen = outlet.GetProp("surfaceTension", "Overall", None, "LIquid", "")
    TypeError: At least one element in the source array could not be cast down to the destination array type.

    I do not understand exactly what each parameter means, but I tried different combinations, all with the same error.
    I do not know if it is related, but in Tutorials - Object Property Codes-Material Stream property surface tension does not exist.

     
  • Daniel Medeiros

    Daniel Medeiros - 2017-08-21

    Your syntax is wrong (the third argument must be an empty array).

    Surface tension is stored as a mixture property in the Material Stream. You can get its value in a much easier way:

    surft = outlet.Phases[0].Properties.surfaceTension

    This will return the surface tension in N/m.

     
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.