My personal 'Utility Functions' collection
Like an Excel add-in, this file enhances my Ebsilon functionality
In an earlier post, I wrote about how to write reusable functions that can be used within Text Fields, EbsScripts, and specification expressions. I also described how to make them available within ONE Ebsilon model or ALL your models and EbsScripts.
That post discussed a simple function called “DoubleIt” just to illustrate the concept.
Now, here’s something more useful that I use in my own work: an EbsScript file that defines the following functions:
uomP, uomT, uomH, and uomM (read as “units-of-measure for Pressure”, e.g.). These give the units-of-measure for P-T-H-M as shown when you hover over a pipe. Super-useful in text field. Since they don’t take any arguments, just type ‘uomP’ or whatever and the units are shown, or can be used in SItoUNITS or other functions.
InDesignMode. This returns True or False for a component or macro. Very useful in EbsScripts, where engineering code is usually different for Design vs. Off-Design mode.
NumSep. Ebsilon always uses a decimal point to separate the whole vs. fractional part of a number. This function lets you set the separator characters.
UtilityFunctionsVersion. This takes no arguments. It returns the
full path to file containing the function definitions. Useful in a text field to document the source of the functions being used in the model.
Get the files
Download the function definition EbsScript fie “UtilityFunctions20231024.esc” from the “Utility Functions” folder on my Ebsilon Tips OneDrive and store it anywhere convenient on your computer. The filename contains a time-stamp.
The model shown in the screenshot is “UtilityFunctions20231024 demo.ebs” from that same folder.
How to use the functions
Installation and usage Instructions are given in the file “Utility Functions Add-In for Ebsilon.pdf” in the “Utility Functions” folder on my Ebsilon Tips OneDrive.
I've edited the post to fix the links to the files, and added a link to the new doc that gives Installation and Usage instructions.