Additional libraries



This page describes a set of useful Analytica function libraries. These are additional to the Standard libraries that are automatically installed when you install Analytica. If you want to use any of these additional libraries, click on its link and it will download onto your computer. Depending on your download settings, it may automatically open it in Analytica. Either way, you should save it into a directory so that you can add it into your models. It's usually most convenient to save it with your Standard libraries in directory

c: Lumina/Analytica 4.6/Libraries

You can then easily add it into your models using the standard menu option Add Library... from the File menu.

See User-defined Functions and Libraries to build your own functions and libraries.


Large Sample Library

Download: Large sample library v10.ana

Large sample library.png

The Large Sample Library is an Analytica library that lets you run a Monte Carlo simulation for large models or a large sample size that might otherwise exhaust computer memory, including virtual memory. It breaks up a large sample into a series of batch samples, each small enough to run in memory. For selected variables, known as the Large Sample Variables or LSVs, it accumulates the batches into a large sample. You can then view the probability distributions for each LSV using the standard methods — confidence bands, PDF, CDF, etc. — with the full precision of the large sample.

See Large Sample Library: User Guide.

The Sensitivity Analysis Library

The Sensitivity Analysis Library provides functions for analyzing the sensitivity of an output to each cell of each array-valued chance input, and locating those individual scalar inputs that have the greatest impact on the result. See The Sensitivity Analysis Library for documentation on using this library.

The library itself can be downloaded from Sensitivity Analysis Library.ana, and an example model to demonstrate its usage is at Sensitivity Functions Examples.ana.

Model Documentation Library

Download: Model Documentation Library.ana

Some people like to create a concise report on paper that contains all objects in their model along with descriptions or other selected attributes. The "Print Report" feature in Analytica can be used for this purpose, but is not at all concise and ends up placing each object window on a separate page. The Model Documentation Library allows you to select a module from your model and produce a result table containing every object within that module with its selected attributes such as title, description, units, definition, or user-defined attributes. This table can then be exported to Excel where you can format it nicely and print it. Thus, you can end up with a very concise report on paper.

To use this library, load your model and then select File → Add Module.... Add the Model Documentation Library.ana module file using Embed. In that module, using the pulldown, select the top-level module for the report. Follow the instructions shown on the diagram. If you make changes to your model later, press the Update Model Documentation button to adjust the pulldown content.

Units Conversion Library

Download: Units conversion library.ana

The functions in this library provide conversions between different units -- for example, from feet to kilometers, or from Btu (British thermal units) to gigajoules of energy. Using this library relieves you from having to look up conversion factors. It also makes the model more transparent by making it clear where you are converting from one units to another -- instead of just embedding conversion constants in the formulas.

Use Conversion_Factor(oldUnits, newUnits) to give a conversion factor between two units.

If you omit «newUnits», it will assume the standard units for that type (dimensions).

When specifying units , you must use a symbol (abbreviation) from the Units table.

If the units are of different dimensions, e.g. energy and power, or if it doesn't recognize the units, it will give an error.

Use Nom_to_real_dollars(yr, baseYr) to convert from nominal dollars for year «yr» to "real dollars" for specified «baseYr». If you omit «baseYr», it defaults to the Standard base year.

Greatest Common Divisor functions

Download: GCD function library.ana

This library contains two User-Defined Functions for computing the greatest common divisor.

DB Conversion Library

Download: DB conversion lib.ana

Lets you embed data obtained from a database into the Analytica model. This breaks the need to use it with an external database, so -- for example -- you can send to someone (e.g. Lumina tech support) who does not have access to the database or has an edition of Analytica (e.g. Professional) that doesn't support database access.

Press a button in this library to transform all the variables defined using DbQuery, DbLabels and DbTable to literal data. Variables and indexes defined using DbQuery or DbLabels are transformed to list definitions, and those defined using DbTable are transformed into edit tables. This breaks the connection to the external database. So, of course, the model will no longer be able to get new or extended data from the database.

The library is limited in its scope. It only works when all calls to DbQuery, DbLabels and DbTable occur at the top level of variable definitions. Do not try to use it if the calls to these functions are embedded within larger expressions or in User-Defined Functions.

Use with extreme caution!!: Make a copy of your original model before adding and executing this module. After running the transformation, be sure to use File → Save As... to save the transformed model under a different filename, so you don't clobber your original model.

Spreadsheet Helper Library

Download: Spreadsheet Helper lib.ana

Includes functions that return the list of worksheet names and the Excel filename of the workbook. It also contains a SpreadsheetOpenEx function that can be used in place of SpreadsheetOpen, but which remembers the filename selected by the user so the next time he doesn't have to select the file again.

Data Standardization Library

Download: Data Standardization Library.ana

Imported data is often inconsistent. This library allows you to choose what the "standard" values should be in a column of data. You can then map any non-standard value to one of the standard values. The result is a column of consistent data.

Individual functions with examples

Download: Recumulate example.ana : Like Cumulate, but resets to zero at selected points.

Download: Apportion.ana: Aggregates or disaggregates an array of values from one index to another index, where the second index may be larger or smaller. Does not require the indexes to be index multiples of each other. For example, if you map from a 47-element index to a 13-element index, each 3.62 elements of the original map to an element in the destination, so for example, the first 3 items map to the first item, then the fourth item is shared, with 0.62 apportioned to the first element and 0.38 apportioned to the second element. Supports aggregation types 'SUM', 'AVERAGE', 'MIN' and 'MAX'. Contributed by Paul Sanford of EPRI.

See Also

Comments


You are not allowed to post comments.