Fluids

Fluids

Workbench input/output parameter be adjusted through a conditional expression (else, if, and, or)

    • admin
      Ansys Employee

      Could a Workbench input/output parameter be adjusted through a conditional expression (else, if, and, or)?

    • Vishal Ganore
      Ansys Employee

       Yes and this will be done via expression tab for the input as well as output parameter. There we have to be careful with the units. Note that the format is “value if argument else another-value if argument … else default-value.” The expression and mathematical function evaluation in Workbench is based on the Python 2.6 programing language. All python numeric and function capabilities can be used. Here are some sample logical expressions: Simple: 500 if P1 == 15 else 250 With several parameters: 500 if P1 + P3 < 15 else 250 With units: 125 [mm] if P1 == 15 [mm] else 250 [mm] With an interval: 450 [K] if 5 [kg/s] < P1 < 15 [kg/s] else 300 [K] With or/and operators: 500 [MPa] if P1 < 15 [mm] and P3 >= 50 [m s^-1] else 250 [MPa] 500 [MPa] if P1 < 15 [mm] or P3 >= 50 [m s^-1] else 250 [MPa] With “logical” output: ‘Yes’ if P1 >= 8 else ‘No’ if P1 <= 7 With several conditions: 117 if P1 >= 8 else 102 if P1 == 7 else 69 if P1 == 6 else 3 These examples would be then given in the Expression Field of the parameter under the properties of the outline. For more information refer to ANSYS Help: ANSYS Documentation > ANSYS Workbench Documentation > User’s Guide > Working with Parameters and Design Points > Parameters > Custom Parameters.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.