AnyLogic
Expand
Font size

File resources

When modeling in AnyLogic, you can utilize external file resources: text files, Excel files, images, 3D objects, CAD drawings, Java class files, etc. The Projects view provides access to all external files related to the model via Resources folder located at the bottom of the model’s tree structure. The files are organized in sub-folders by type. In case of complex elements, all nested files making up one element (for example, .jpg textures used in 3D objects or index files and dBASE tables comprising shape files) will be displayed individually in the corresponding subfolders.

The color of the file’s name in the folder reflects the current state of this file:

  • black — the file is referenced in the model
  • grey — the file is stored in the model’s folder, but not referenced in the model
  • red — the file is referenced in the model, but it had since been removed from the specified location

If the model folder contains over 100 files, including the ALP files, the Resources folder in Projects view will display only those files that are referenced in the model.

File location

Files can be stored either in the model’s folder or at any external location.

The location of the file is indicated in the resource’s Properties view. If the file is stored in the model’s folder, the Path field will display the file’s location relative to the model’s folder. If the file is stored outside of the model’s folder, the Path field will display the absolute path to the file’s location in the file system. You can switch between relative and absolute paths as you see fit. You can copy the path to the file to clipboard directly from the Projects view by right-clicking the name of the file and selecting Copy Path to File command from the context menu.

To open the folder where the resource file is located, you have to right-click the name of the file in Projects view and select Show in System Explorer option from the context menu. If the file has been removed (the name of the file in the Projects view is highlighted in red), System Explorer will open a folder where the file has been stored previously. If the folder is unavailable, e.g. has been deleted, System Explorer will open the next available folder up the directory.

Exporting file resources

On model export or at saving the current model with a new name, AnyLogic includes the file resources that are referenced by the model elements. However, your model might also refer from code to files that are otherwise not used in the model. To include such files on export, go to the file properties and select Resource is referenced from user code option. You can also use this option to export the currently unutilized files that might prove to be useful later on.

File resources as inputs and outputs in AnyLogic Cloud

File resources like Excel files and text files can serve as inputs and outputs of AnyLogic Cloud experiments. The file must be specified in the Run Configuration panel and must satisfy the following conditions:

  • the file is referenced in the model, for example, some code writes lines to a text file
  • the file is stored in the model folder
  • the path to the file is specified as relative

It is also possible to use the Cloud API to work with file resources in experiments. For more information, see the API reference.

How can we improve this article?