AnsweredAssumed Answered

Writing and debugging AEL Expressions

Question asked by mfredrik on Dec 20, 2002
Latest reply on May 8, 2003 by mfredrik
Custom AEL Expressions can be very useful in many cases when you need to post-process the simulation data from ADS.

The AEL Expressions has to be loaded into ADS in a special way. Please see this document for more info on how to load AEL expressions into ADS expression handler:

AEL Expression Installation Instruction ?


Once you start to write your own functions you will face the problem how to debug the code. This can be a challenge. First you need to understand how the code is loaded into the expression handler:


  • Using your function in a MeasEqn (Schematic)

    The user_defined_fun.ael file is reloaded every time you run a simulation.

  • Using your function in a Data Display Equation

    The user_defined_fun.ael file is only loaded the first time you open a Data Display in the current ADS session.
So if you are trying to write and debug your function in the Data Display then you will have to face the problem that the code is not automatically reloaded when you make a change in the AEL file. I know only two ways to force a reload of the expressions:


  • Restart ADS

    or

  • In ADS 2003A and earlier

      - Kill two processes, hpeesofdss & hpeesofdds, and re-open the Data Display

    In ADS 2003C and later

     - Kill one process, hpeesofdds, and re-open the Data Display
I use the second method all the time since it's much faster than restarting ADS. Still it's a bit of a hassle.

If your simulation is fast - then you could concider ?using your expression in a MeasEqn on a schematic and resimulate every time you've made a change in the code. However, there are no error messages, other than that the MeasEqn failed to evaluate, in the case you have a problem in your code. In that sense the Data Display provides little more help. If ?your function fails to eveluate, e.g. you have a red equation in the Data Display. Double-click on the equation to bring up the equation editor. In this dialog window you may see some helpful error messages to point you into the right direction when debugging your code.

Finding the problem in the code can sometimes be very hard. Here are some tips that may help:


  • If possible, try to write your functions one by one in equations on the Data Display window and examine the results.

  • Output debug info to the command line:

    ?fputs(stderr, identify_value(myvar));

    ?These messages appears in the terminal window where you started ADS from on UNIX. On PC you will have to start ADS in debug mode.

  • Comment out large blocks of your code to try to locate in which area the problem is.

  • Return internal variables that you compute in the function to check that the content is as expected.

  • Look in the ADS installation for examples of code. ($HPEESOF_DIR/expressions/ael)

  • Check out the examples in the Knowledge Center:
    AEL Expression Examples (Requires valid support contract to download)
URL updated by support_admin @ Mar 3 2004  

Outcomes