### Java Example: Basic AnyLogic ExperimentCustom run() Method Source: https://anylogic.help/api/com/anylogic/engine/ExperimentCustom This Java code provides a minimal implementation for the `run()` method within an `ExperimentCustom` class. It illustrates the basic steps for setting up and running a simulation: creating an engine, setting stop time, initializing a top-level agent, starting the engine, running the simulation in fast mode, collecting results, and destroying the model. ```Java // Create Engine, initialize random number generator: Engine engine = createEngine(); // Set stop time engine.setStopTime( 100 ); // Create new top-level agent: Main root = new Main(engine, null, null); // Setup parameters of top-level agent here root.myParameter = 10; // Prepare Engine for simulation: engine.start( root ); // Start simulation in fast mode: engine.runFast(); // Obtain results of simulation here traceln( root.myResult ); // Destroy the model: engine.stop(); ``` -------------------------------- ### AnyLogic Engine Lifecycle and Usage Example Source: https://anylogic.help/api/com/anylogic/engine/Engine Illustrates the typical lifecycle and usage pattern of the AnyLogic `Engine` class, demonstrating how to initialize, start, run, pause, step, and stop a simulation. It highlights the engine's state transitions (IDLE, PAUSED, RUNNING, FINISHED, ERROR, PLEASE_WAIT) and the interaction with `Agent` objects. ```Java Engine engine = new Engine(); // -> IDLE; random number generator is initialized Agent root = new RootAgent( engine, null, null ); ...//setup parameters of root engine.start( root ); // -> PAUSED engine.run(); // -> RUNNING; launches execution in a new thread, calls the experiment back on finish ... engine.pause(); // -> PAUSED engine.step(); // -> PAUSED engine.run(); // -> RUNNING ... engine.stop(); // -> IDLE completely destroys the model ... Agent root2 = new RootAgent2( engine, null, null ); ...etc. ``` -------------------------------- ### Experiment Setup Methods Source: https://anylogic.help/api/com/anylogic/engine/Experiment These methods are invoked during the initialization phase of an AnyLogic application or simulation engine. They ensure proper configuration and setup before execution begins. ```APIDOC void setup(com.anylogic.engine.gui.IExperimentHost experimentHost) - Description: Called in the static main() method of applications after the experiment is constructed. - Parameters: - experimentHost: An interface providing host capabilities for the experiment (IExperimentHost). - Returns: void void setupEngine(com.anylogic.engine.Engine engine) - Description: Called for the simulation engine when it is created. - Parameters: - engine: The simulation engine instance (Engine). - Returns: void ``` -------------------------------- ### OmniverseHelper Static Methods Source: https://anylogic.help/api/com/anylogic/engine/omniverse_connector/OmniverseHelper Documents static utility methods within the `OmniverseHelper` class. These methods provide functionalities for retrieving connector paths, checking Omniverse installation status, exporting stages, opening scenes, starting local connectors, and validating Omniverse/USD paths. ```APIDOC Method Details: getConnectorPath(): public static String - Returns the path to the Omniverse connector. getResourceUsdPath(String scenePath, String objectFilePath): public static String - Constructs a USD path for a resource given a scene path and object file path. - Parameters: - scenePath: The path to the scene. - objectFilePath: The path to the object file. isOmniverseConnectorInstalled(): public static boolean - Checks if the Omniverse connector is installed. - Returns: true if installed, false otherwise. exportStage(String stagePath, String exportPath, boolean flatten): public static void throws Exception - Exports an Omniverse stage to a specified path. - Parameters: - stagePath: The path of the stage to export. - exportPath: The destination path for the export. - flatten: A boolean indicating whether to flatten the stage during export. - Throws: Exception if an error occurs during export. isOpenStageSupported(): public static boolean - Checks if opening an Omniverse stage is supported. - Returns: true if supported, false otherwise. openScene(String path): public static boolean - Opens an Omniverse scene at the given path. - Parameters: - path: The path to the scene. - Returns: true if the scene was opened successfully, false otherwise. openSceneIfNeeded(OmniverseSyncParameters omniverseSyncParameters): public static void - Opens an Omniverse scene if required, based on provided synchronization parameters. - Parameters: - omniverseSyncParameters: Parameters for Omniverse synchronization. openSceneIfNeeded(String scenePath, boolean openSceneConfigured): public static void - Opens an Omniverse scene if required, based on a scene path and configuration. - Parameters: - scenePath: The path to the scene. - openSceneConfigured: A boolean indicating if scene opening is configured. startLocalConnectorIfNeeded(String password, boolean startConnectorConfigured): public static void - Starts the local Omniverse connector if required, with a password and configuration. - Parameters: - password: The password for the connector. - startConnectorConfigured: A boolean indicating if connector startup is configured. startLocalConnectorIfNeeded(OmniverseSyncParameters omniverseSyncParameters): public static void - Starts the local Omniverse connector if required, based on provided synchronization parameters. - Parameters: - omniverseSyncParameters: Parameters for Omniverse synchronization. isRenderModelRun(): public static boolean - Checks if the render model is currently running. - Returns: true if the render model is running, false otherwise. isValidOmniversePath(String path): public static boolean - Validates if the given path is a valid Omniverse path. - Parameters: - path: The path to validate. - Returns: true if the path is valid, false otherwise. isValidUsdPath(String path): public static boolean - Validates if the given path is a valid USD path. - Parameters: - path: The path to validate. - Returns: true if the path is valid, false otherwise. ``` -------------------------------- ### Get Markup Element Start Position Source: https://anylogic.help/api/com/anylogic/engine/markup/IPath Retrieves the starting position of the markup element. ```APIDOC Position getStartPosition(Position out) - Description: Returns the start position of the markup element. - Parameters: - out: Output object to write to, may be 'null'. - Returns: The Position object with coordinates of the first position. ``` -------------------------------- ### Initialize and Setup AnyLogic Experiment in Java Source: https://anylogic.help/api/com/anylogic/engine/ExperimentSimulation This Java code snippet demonstrates how to initialize and set up a basic AnyLogic experiment. It creates an instance of `MyExperiment`, sets its name, and calls the `setup` method, which is essential for preparing the experiment for execution. ```Java public static void main( String[] args ) { MyExperiment ex = new MyExperiment(); ex.setName( "My Experiment" ); ex.setup( null ); } ``` -------------------------------- ### Get Statistics Start Time Source: https://anylogic.help/api/com/anylogic/engine/markup/OverheadCraneBridge Retrieves the start time for statistics collection related to the crane or associated processes. ```APIDOC getStatisticsStartTime() - Returns the start time for statistics collection. - Return Type: double ``` -------------------------------- ### Manage Experiment Launch Source: https://anylogic.help/api/com/anylogic/engine/gui/IExperimentHost Provides methods to create and optionally run an AnyLogic experiment, along with starting frame collection. ```APIDOC launch: launch(boolean startServer, boolean startExperiment) Description: Creates and optionally runs experiment, starts frame collection. Parameters: startServer: boolean - If true, starts the server. startExperiment: boolean - If true, starts the experiment. Returns: void ``` -------------------------------- ### Get Start Position of Markup Element Source: https://anylogic.help/api/com/anylogic/engine/markup/IPath Retrieves the start position of a markup element, populating a provided Position object. ```APIDOC Position getStartPosition(Position out) Parameters: out: A Position object to populate with the start position. Returns: The provided Position object, populated with the start position. ``` -------------------------------- ### Get Start Position of Markup Segment Source: https://anylogic.help/api/com/anylogic/engine/markup/GISMarkupSegmentLine Returns the location of the start position of the segment. The result can be written to an optional output object. ```APIDOC public Position getStart(Position out) Description: Returns the location of the start position of the segment. Parameters: out: Output object to write to, may be null. Returns: The Position object with coordinates of the segment start. ``` -------------------------------- ### Extending ExperimentSimulation for Custom Models Source: https://anylogic.help/api/com/anylogic/engine/ExperimentSimulation Illustrates how to extend the `ExperimentSimulation` class to create a custom experiment. It shows how to implement the `createRoot` method to instantiate a main agent and how to use the `setup` method to configure the simulation engine and presentation. ```Java public class MyExperiment extends ExperimentSimulation { public Agent createRoot( Engine engine ) { MyMain root = new MyMain( engine, null, null ); //set parameters of root if needed ... return root; } public void setup() { Engine eng = getEngine(); //set engine stop time, time mode, etc. ... Presentation p = new Presentation( ex, null ); p.start(); } ``` -------------------------------- ### AnyLogic OverheadCrane Get Statistics Start Time API Source: https://anylogic.help/api/com/anylogic/engine/markup/OverheadCrane An internal API method to retrieve the start time for statistics collection for the crane. ```APIDOC getStatisticsStartTime() ``` -------------------------------- ### AnyLogic Optimization Setup Methods Source: https://anylogic.help/api/com/anylogic/engine/ExperimentOptimization These methods are used to configure and add various components to an AnyLogic optimization experiment, such as pre-constraints, parameter variables, post-constraints (requirements), and suggested solutions. They are typically called during the setup phase of an optimization run. ```APIDOC void addConstraint(com.anylogic.engine.optimization.IPreConstraint constraint) - Description: Adds a pre-constraint to the optimization setup. - Parameters: - constraint: An instance of IPreConstraint representing the constraint to add. void addParameterVariable(com.anylogic.engine.optimization.IVariable parameter) - Description: Adds a variable defined by the input parameter to the optimization. This is an optimization setup method and should not be called by the user. - Parameters: - parameter: An instance of IVariable representing the parameter variable to add. void addRequirement(com.anylogic.engine.optimization.IPostConstraint requirement) - Description: Adds a requirement (post-constraint) defined by the input parameter to the optimization. This is an optimization setup method and should not be called by the user. - Parameters: - requirement: An instance of IPostConstraint representing the requirement to add. void addSuggestedSolution() - Description: Signals the completion of a suggested solution definition. This method is used after setting values for each variable using `#setParameterVariableSuggestedValue(COptQuestVariable, double)`. The solution is added to the set of suggested solutions and will be evaluated early in the optimization process. This is an optimization setup method and should not be called by the user. ``` -------------------------------- ### Get Crane Statistics Start Time in AnyLogic Source: https://anylogic.help/api/com/anylogic/engine/markup/JibCrane This method retrieves the start time for statistics collection related to the crane. It is part of the internal AnyLogic API. ```APIDOC @AnyLogicInternalAPI public double getStatisticsStartTime() Specified by: getStatisticsStartTime in interface com.anylogic.engine.markup.material_handling.IJibCraneDescriptor Specified by: getStatisticsStartTime in class Crane ``` -------------------------------- ### Experiment and Database Preparation Methods Source: https://anylogic.help/api/com/anylogic/engine/ExperimentSimulation Methods for preparing the simulation environment before an experiment starts and for preparing SQL statements. ```APIDOC prepareBeforeExperimentStart_xjal(java.lang.Class clazz) - Performs necessary preparations before an experiment begins, specific to a given class. - Parameters: - clazz: The class for which to prepare. - Returns: void prepareStatement(java.lang.String sql, java.lang.Object... params) - Prepares an SQL statement with optional parameters for safe execution. - Parameters: - sql: The SQL query string. - params: Variable arguments for parameters to be substituted into the SQL string. - Returns: java.sql.PreparedStatement (or similar database statement object) ``` -------------------------------- ### AnyLogic IExperimentHost Interface Methods Source: https://anylogic.help/api/com/anylogic/engine/gui/ExperimentHost Comprehensive API documentation for the `IExperimentHost` interface, providing methods to control the AnyLogic experiment lifecycle, manage snapshots, and access internal experiment and Omniverse-related functionalities. ```APIDOC public void saveSnapshot(String fileName, Runnable successfulCallback, Consumer errorCallback) - Description: Pauses experiment if it is currently running, saves snapshot, and then resumes experiment if it was running. On any error, throws nothing. - Parameters: - fileName: The name of the snapshot file. - successfulCallback: Called when the snapshot is successfully saved. - errorCallback: Called in case of any error. - Availability: AnyLogic Professional only. public void loadSnapshot(String fileName, Runnable successfulCallback, Consumer errorCallback) - Description: Stops experiment and loads snapshot (in its 'not running' state), doesn't resume simulation of loaded snapshot. On any error, throws nothing, silently rollbacks to the current experiment and resumes it if it was running. *When snapshot is loaded, presentation forgets everything about the model which was running before (including the engine, experiment and agents), therefore, it is recommended not to keep references to model objects after this method call* - Parameters: - fileName: The name of the snapshot file. - successfulCallback: Called when the snapshot is successfully loaded. - errorCallback: Called in case of any error. - Availability: AnyLogic Professional only. public void close() - Description: This method returns immediately and performs the following actions in a separate thread: * stops experiment if it is not stopped, * destroys the model and * closes experiment window (only if model is started in the application mode) @AnyLogicInternalAPI public void launch(boolean startServer, boolean startExperiment) - Description: Creates and optionally runs experiment, starts frame collection. - Parameters: - startServer: TODO - startExperiment: (Implicitly from context) Whether to start the experiment. @AnyLogicInternalAPI public LaunchConfiguration getConfiguration() - Description: Retrieves the launch configuration for the experiment. @AnyLogicInternalAPI public AnimationPacket getUpdate(boolean fullFrame) - Description: Retrieves an animation update packet. - Parameters: - fullFrame: If true, requests a full frame update. public OmniFrame getOmniUpdate(boolean fullFrame) - Description: Retrieves an Omniverse animation update frame. - Parameters: - fullFrame: If true, requests a full frame update. @AnyLogicInternalAPI public OmniverseSyncParameters.OmniSessionParams getOmniParams() - Description: Retrieves Omniverse session parameters. @AnyLogicInternalAPI public String getOmniPassword() - Description: Retrieves the Omniverse password. @AnyLogicInternalAPI public boolean isOmniverseAnimtaion() - Description: Checks if Omniverse animation is enabled. ``` -------------------------------- ### AnyLogic Markup Segment API: Get Start Position Source: https://anylogic.help/api/com/anylogic/engine/markup/AbstractMarkupSegment Documents the `getStart` method, which retrieves the location of the start position of a markup segment. It accepts an optional output `Position` object and returns the `Position` object representing the segment's start. ```APIDOC public abstract Position getStart(Position out) - Description: Returns the location of the start position of the segment. - Parameters: - out (Position): Output object to write to, may be `null`. - Returns: - Position: The Position object with coordinates of the segment start. ``` -------------------------------- ### Get Start Position of Path Source: https://anylogic.help/api/com/anylogic/engine/markup/GISRoute This method retrieves the starting position of a path or markup element. An existing Position object can be passed to 'out' to populate, or null to create a new one. ```APIDOC getStartPosition: public Position getStartPosition(Position position) - Description: Returns the start position of the path or markup element. - Parameters: - position (Position): Output object to write to, may be `null`. - Returns: The Position object with coordinates of the first position on the path. ``` -------------------------------- ### Get Start Position of Markup Element Source: https://anylogic.help/api/com/anylogic/engine/markup/Path Returns the start position of the markup element. An overloaded version allows writing the coordinates to an existing Position object to avoid new object creation. ```APIDOC public Position getStartPosition(Position out) - Description: Returns the start position - Parameters: - out: Position - output object to write to, may be null - Returns: Position - the Position object with coordinates of the first position public Position getStartPosition() - Description: Returns the start position - Returns: Position - the Position object with coordinates of the first position ``` -------------------------------- ### AnyLogic IExperimentHost Interface Methods Source: https://anylogic.help/api/com/anylogic/engine/AutotestExperimentHost Comprehensive API documentation for methods within the `com.anylogic.engine.gui.IExperimentHost` interface, covering various functionalities for managing experiments, controlling the simulation GUI, and interacting with model elements. This includes methods for navigation, display settings, data inspection, and experiment state management. ```APIDOC IExperimentHost Interface Methods: logFrame() - Logs the current frame. getExperiment() - Returns the current experiment object. getFrameProducer() - Retrieves the frame producer for the experiment. setPresentable(boolean presentable) - Sets the presentable state of the experiment. getPresentable() - Returns the presentable state of the experiment. navigateHome() - Navigates the view to the home position. setZoomAndPanningEnabled(boolean enabled) - Enables or disables zoom and panning functionality. isZoomAndPanningEnabled() - Checks if zoom and panning are enabled. setDeveloperPanelEnabled(boolean enabled) - Enables or disables the developer panel. setDeveloperPanelVisibleOnStart(boolean visible) - Sets the visibility of the developer panel on start-up. setRunControlEnabled(boolean enabled) - Enables or disables run control elements. isRunControlEnabled() - Checks if run control is enabled. setSpeedControlEnabled(boolean enabled) - Enables or disables speed control elements. isSpeedControlEnabled() - Checks if speed control is enabled. setCenter(double x, double y) - Sets the center of the view to specified coordinates. zoomIn() - Zooms in the view. zoomOut() - Zooms out the view. navigateTo(Object target) - Navigates the view to a specific target object. addInspect(Object object) - Adds an object to the inspection list. removeInspect(Object object) - Removes an object from the inspection list. showMessageDialog(String message) - Displays a message dialog. showErrorDialog(String message) - Displays an error message dialog. showErrorInModelDialog(String message) - Displays an error message dialog specific to the model. saveSnapshot(String path) - Saves a snapshot of the experiment to a specified path. loadSnapshot(String path) - Loads an experiment snapshot from a specified path. close() - Closes the experiment. openWebSite(String url) - Opens a website in the default browser. copyToClipboard(String text) - Copies text to the system clipboard. executeUserAction(String actionName) - Executes a user-defined action by name. executeCommand(String command) - Executes a command string. getExperimentState() - Returns the current state of the experiment. setValue(String name, Object value) - Sets the value of a named parameter or variable. getValue(String name) - Retrieves the value of a named parameter or variable. callFunction(String functionName, Object... args) - Calls a function by name with optional arguments. launch() - Launches the experiment. getConfiguration() - Retrieves the experiment configuration. getUpdate() - Gets update information for the experiment. getNextFrameNumber() - Returns the next frame number. setSendConsoleItems(boolean send) - Sets whether console items should be sent. getProgress() - Returns the current progress of the experiment. setSpeed(double speed) - Sets the simulation speed. setMaxFPS(int fps) - Sets the maximum frames per second for the display. postExperimentSettings() - Posts experiment settings. onAgentDestroyed_xjal(Object agent) - Callback method invoked when an agent is destroyed. isOmniverseAnimtaion() - Checks if Omniverse animation is enabled. getCurrentNavigationPoint() - Returns the current navigation point. getFrameFlag() - Retrieves the current frame flag. setFrameFlag(int flag) - Sets the frame flag. getDependencyModelFolders() - Returns a list of dependency model folders. has3D() - Checks if the experiment host supports 3D visualization. ``` -------------------------------- ### Get Start Point of Markup Element Source: https://anylogic.help/api/com/anylogic/engine/markup/IPath Retrieves the location of the start point of a markup element. Overloaded methods allow returning a new Point object or populating an existing one. ```APIDOC Point getStartPoint() Returns: The location of the start point as a new Point object. Point getStartPoint(Point out) Parameters: out: A Point object to populate with the start point's location. Returns: The provided Point object, populated with the start point's location. ``` -------------------------------- ### Get Pipe Start Point Source: https://anylogic.help/api/com/anylogic/engine/markup/Pipe Returns the 2D Point object representing the coordinates of the pipe's starting point. An optional output object can be provided to write the coordinates into, or a new Point object will be created. ```APIDOC public Point getStartPoint(Point out) Returns the Point object with coordinates of the pipe's starting point. Parameters: out: Output object to write to, may be null. public Point getStartPoint() Returns the Point object with coordinates of the pipe's starting point. ``` -------------------------------- ### AnyLogic IExperimentServer API Methods Source: https://anylogic.help/api/com/anylogic/engine/gui/IExperimentServer Comprehensive API documentation for the `com.anylogic.engine.gui.IExperimentServer` interface methods. This interface provides core functionalities for controlling an AnyLogic experiment server, including starting and stopping operations. As an internal API, these methods are not designed for direct user interaction and may be subject to change in future releases. ```APIDOC Interface: IExperimentServer Methods: start(): int - Description: Initiates the experiment server. - Parameters: None - Returns: An integer representing the status or result of the start operation. stop(): void - Description: Halts the experiment server. - Parameters: None - Returns: None (void) ``` -------------------------------- ### AnyLogic Top-Level Agent Parameter Setup Source: https://anylogic.help/api/com/anylogic/engine/ExperimentCompareRuns Documents the `setupRootParameters` method, an internal API for configuring parameters of the top-level agent in an AnyLogic model. This abstract method must be implemented by subclasses and allows for conditional execution of `onChange` actions during parameter assignment. ```APIDOC @AnyLogicInternalCodegenAPI public abstract void setupRootParameters(ROOT root, boolean callOnChangeActions) Description: Is called to setup parameters of top-level agent. This method must be defined in a subclass. Parameters: root: The top-level agent instance callOnChangeActions: If true this method should use set_* methods of root to setup parameters, otherwise parameter values should be simply assigned to the fields of root ``` -------------------------------- ### AnyLogic IMarkupSegment: Get Segment Start Point Source: https://anylogic.help/api/com/anylogic/engine/markup/MarkupSegment Retrieves the location of the start point of the segment. An optional output `Point` object can be provided to store the result, preventing new object allocation. ```APIDOC public final Point getStart(Point out) - Description: Returns the location of the start point of the segment. - Parameters: - `out`: Output object to write to, may be `null`. - Returns: The `Point` object with coordinates of the segment start. ``` -------------------------------- ### Get Pipe Start Position Source: https://anylogic.help/api/com/anylogic/engine/markup/Pipe Returns the 3D Position object representing the coordinates and orientation of the pipe's starting point. An optional output object can be provided to write the position into, or a new Position object will be created. ```APIDOC public Position getStartPosition(Position out) Returns the Position object with coordinates and orientation of the pipe's starting point. Parameters: out: Output object to write to, may be null. public Position getStartPosition() Returns the Position object with coordinates of the first position. Returns: The Position object with coordinates of the first position. ``` -------------------------------- ### AnyLogic Engine Core API: Experiment, Utilities, and Presentable Classes Source: https://anylogic.help/api/com/anylogic/engine/ExperimentSimulation This section documents key components of the AnyLogic engine API, including nested classes and inherited fields from `com.anylogic.engine.Experiment`, `com.anylogic.engine.Utilities`, and `com.anylogic.engine.Presentable`. These elements define experiment states, commands, common utilities like time and length units, and presentation-related constants for visual elements. ```APIDOC com.anylogic.engine.Experiment: Nested Classes: - Experiment.Command: Enum class defining commands for experiment control (e.g., RUN, PAUSE, STOP). - Experiment.State: Enum class defining the various states an experiment can be in (e.g., IDLE, RUNNING, PAUSED, FINISHED, ERROR). Inherited Fields (Constants): - ERROR: State indicating an error occurred during experiment execution. - FINISHED: State indicating the experiment has completed successfully. - IDLE: State indicating the experiment is not currently running or paused. - modelExecutionCommandQueue: Internal queue for managing model execution commands. - mutexModelActionQueue: Mutex for synchronizing access to model action queues. - OPEN_RESULTS: Command to open the experiment's results. - OPEN_SNAPSHOT: Command to open a saved snapshot of the experiment state. - PAUSE: Command to pause the currently running experiment. - PAUSED: State indicating the experiment is currently paused. - PLEASE_WAIT: State indicating the system is busy and waiting for an operation to complete. - RUN: Command to start or resume the experiment. - RUNNING: State indicating the experiment is currently executing. - SAVE_RESULTS: Command to save the experiment's results. - SAVE_SNAPSHOT: Command to save the current state of the experiment as a snapshot. - STEP: Command to advance the experiment by a single step. - STOP: Command to stop the experiment. com.anylogic.engine.Utilities: Inherited Fields (Constants): - AM, PM: Constants for AM/PM time designation. - APRIL, AUGUST, DECEMBER, FEBRUARY, JANUARY, JULY, JUNE, MARCH, MAY, NOVEMBER, OCTOBER, SEPTEMBER, UNDECIMBER: Constants representing months of the year. - FRIDAY, MONDAY, SATURDAY, SUNDAY, THURSDAY, TUESDAY, WEDNESDAY: Constants representing days of the week. - LENGTH_UNIT_CENTIMETER, LENGTH_UNIT_FOOT, LENGTH_UNIT_INCH, LENGTH_UNIT_KILOMETER, LENGTH_UNIT_METER, LENGTH_UNIT_MILE: Constants for various length units. - TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_MONTH, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIME_UNIT_YEAR: Constants for various time units. com.anylogic.engine.Presentable: Inherited Fields (Constants): - ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT: Constants for text alignment. - ARROW_FILLED, ARROW_NONE, ARROW_THIN: Constants for arrow styles. - CAD_ANTIALIASING, CAD_INVERTED: Constants related to CAD drawing options. - LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_SOLID: Constants for line styles. - SHAPE_DRAW_2D, SHAPE_DRAW_2D3D, SHAPE_DRAW_3D: Constants for specifying drawing dimensions for shapes. ``` -------------------------------- ### Define setupEngine_xjal Method in Java Source: https://anylogic.help/api/com/anylogic/engine/ExperimentTest This Java method is part of the AnyLogic Engine and is intended for internal system use, specifically overriding a method from the `ExperimentCustom` class. Users should not call this method directly as it handles core engine setup or initialization processes. ```Java public void setupEngine_xjal(Engine engine) ``` -------------------------------- ### Get Y-Coordinate of Shape Point Source: https://anylogic.help/api/com/anylogic/engine/markup/TargetLine Retrieves the y-coordinate of a specific point on the shape, relative to its start point. ```APIDOC public double getPointDy(int i) - Parameters: - i: int - the index of the point (starting from 0) - Returns: double - the y coordinate of the point relative to the start point ``` -------------------------------- ### AnyLogic IExperimentHost Interface Methods Source: https://anylogic.help/api/com/anylogic/engine/AutotestExperimentHost These methods are inherited from the `com.anylogic.engine.gui.IExperimentHost` interface, providing functionalities related to managing and interacting with AnyLogic experiments, such as launching, loading, and saving snapshots. ```APIDOC void launch() - Description: Launches the experiment associated with this host. - Returns: void void loadSnapshot(String fileName) - Description: Loads an experiment snapshot from the specified file. - Parameters: - fileName: The path to the snapshot file as a String. - Returns: void void saveSnapshot(String fileName) - Description: Saves the current state of the experiment to a snapshot file. - Parameters: - fileName: The path where the snapshot file will be saved as a String. - Returns: void ``` -------------------------------- ### Get AnyLogic Statistics Start Time Source: https://anylogic.help/api/com/anylogic/engine/markup/Crane Retrieves the start time for statistics collection within the AnyLogic simulation engine. This method is marked as an internal API, indicating it's primarily for internal use by AnyLogic components. ```Java @AnyLogicInternalAPI public abstract double getStatisticsStartTime() ``` ```APIDOC getStatisticsStartTime() - Description: Retrieves the start time for statistics collection in the AnyLogic simulation. - Parameters: None - Returns: A `double` value representing the start time of statistics collection. - Annotation: `@AnyLogicInternalAPI` - Indicates this method is intended for internal use within the AnyLogic framework. ``` -------------------------------- ### AnyLogic Agent Lifecycle Starting API Source: https://anylogic.help/api/com/anylogic/engine/Agent Provides methods for initiating activities within an AnyLogic agent, such as scheduling events, starting statecharts, and submitting equations, with specific methods for main and embedded agent startup. ```APIDOC start() - Starts activities (e.g., schedules initial events) in this agent: events, statecharts and embedded objects, submits equations. - Method doStart() should be implemented in subclasses; by default does nothing. ``` ```APIDOC startAsEmbedded() - Internal method to be called for embedded agents inside doStart() of an upper-level agent. - Since: 8.4 ``` ```APIDOC doStart() - Starts activities (e.g., schedules initial events) in this agent: events, statecharts and embedded objects, submits equations. - Should be implemented in subclasses, by default does nothing. - If there are any embedded objects, this method should be implemented in subclass to call agent.startAsEmbedded() method on each agent. - Since: 7.2 ``` -------------------------------- ### Get Statistics Start Time (Internal) Source: https://anylogic.help/api/com/anylogic/engine/markup/ConveyorPath This internal method retrieves the timestamp when statistics collection for the conveyor began. ```APIDOC getStatisticsStartTime() Description: Returns the start time for statistics collection. Returns: double Note: This is an internal AnyLogic API method. ``` -------------------------------- ### AnyLogic IMarkupSegment: Get Segment Start/End Coordinates Source: https://anylogic.help/api/com/anylogic/engine/markup/MarkupSegment Provides individual access to the X, Y, and Z coordinates of both the start and end points of the segment. ```APIDOC public final double getStartX() - Description: Returns the x coordinate of the start point of the segment. - Returns: The x coordinate as a double. public final double getStartY() - Description: Returns the y coordinate of the start point of the segment. - Returns: The y coordinate as a double. public final double getStartZ() - Description: Returns the z coordinate of the start point of the segment. - Returns: The z coordinate as a double. public final double getEndX() - Description: Returns the x coordinate of the end point of the segment. - Returns: The x coordinate as a double. public final double getEndY() - Description: Returns the y coordinate of the end point of the segment. - Returns: The y coordinate as a double. public final double getEndZ() - Description: Returns the z coordinate of the end point of the segment. - Returns: The z coordinate as a double. ``` -------------------------------- ### AnyLogic IExperimentHost Interface Methods Source: https://anylogic.help/api/com/anylogic/engine/AutotestExperimentHost Comprehensive documentation for the IExperimentHost interface methods, including details on controlling the model's graphical presentation, enabling/disabling interactive features like zoom and panning, managing the developer panel, and controlling the visibility and state of run control buttons. ```APIDOC IExperimentHost Interface Methods: getPresentable() - Signature: public Presentable getPresentable() - Description: Returns the current top-level object (Agent or Experiment) whose presentation is displayed. - Returns: Presentable - the current top-level object being displayed, or null. navigateHome() - Signature: public void navigateHome() - Description: Navigates presentation home, i.e., moves the presentation coordinate origin (0,0) to the top left corner of the window, and sets zoom to match the initial frame. - Returns: void. setZoomAndPanningEnabled(boolean yes) - Signature: public void setZoomAndPanningEnabled(boolean yes) - Description: Enables or disables zoom & panning initiated from the GUI (button, mouse, or keyboard). - Parameters: - yes (boolean): If true, zoom & panning should be enabled; if false, disabled. - Returns: void. isZoomAndPanningEnabled() - Signature: public boolean isZoomAndPanningEnabled() - Description: Tests if zoom & panning from the GUI is enabled. - Returns: boolean - true if zoom & panning are enabled, false if not. setDeveloperPanelEnabled(boolean yes) - Signature: public void setDeveloperPanelEnabled(boolean yes) - Description: Enables or disables the developer panel. - Parameters: - yes (boolean): If false, there will be no button to show the developer panel. - Returns: void. setDeveloperPanelVisibleOnStart(boolean yes) - Signature: public void setDeveloperPanelVisibleOnStart(boolean yes) - Description: Shows (if enabled by setDeveloperPanelEnabled) the developer panel when the model window is shown. - Parameters: - yes (boolean): If true, the panel will be visible from the beginning, and may be later hidden by pressing the special button. - Returns: void. setRunControlEnabled(boolean runControlEnabled) - Signature: public void setRunControlEnabled(boolean runControlEnabled) - Description: Enables or disables Run, Pause, and Stop buttons on the model toolbar (but not in the developer panel), and sets the corresponding tooltips. - Parameters: - runControlEnabled (boolean): If false, those buttons will be disabled. - Returns: void. isRunControlEnabled() - Signature: public boolean isRunControlEnabled() - Description: Tests if Run, Pause, and Stop buttons on the model toolbar are enabled. - Returns: boolean - true if they are enabled, false if not. ``` -------------------------------- ### AnyLogic IMarkupSegment: Set Start Point Relative to Another Segment Source: https://anylogic.help/api/com/anylogic/engine/markup/MarkupSegment Sets the starting point of the current path segment to match the end point coordinates of a specified previous segment. This method is intended for segments created without initial arguments and requires a subsequent call to `AbstractMarkupSegment.initialize()` to finalize setup. ```APIDOC public final void setStartNextTo(IMarkupSegment previousSegment) - Description: Sets the start point of the path segment to the coordinates of the end point of the given `previousSegment`. - Parameters: - `previousSegment`: The segment to get end-point from, typically the previous segment in the path. - Notes: This function may be called only for segments created using a constructor without arguments. Please call `AbstractMarkupSegment.initialize()` after segment setup is finished. ``` -------------------------------- ### AnyLogic Experiment Host Core Functions Source: https://anylogic.help/api/com/anylogic/engine/gui/ExperimentHost Core methods of the `IExperimentHost` interface, including retrieving the associated experiment and generating internal unique IDs for USD (Universal Scene Description) elements. ```APIDOC generateNewUsdId() - Generates a new unique ID for USD (Universal Scene Description) elements. - Returns: A long representing the new unique ID. - Annotation: @AnyLogicInternalAPI getExperiment() - Returns the experiment associated with this host. - Returns: The experiment associated with this host. - Specified by: IExperimentHost.getExperiment ``` -------------------------------- ### Load AnyLogic Experiment Snapshot Source: https://anylogic.help/api/com/anylogic/engine/gui/ExperimentHost Illustrates how to use the `loadSnapshot` method of the `IExperimentHost` interface to load a previously saved AnyLogic experiment snapshot. It includes logic to set the presentation and resume the experiment after loading, along with error handling. ```Java getExperimentHost().loadSnapshot( "file.als", () -> { traceln("Loaded!"); getExperimentHost().setPresentable( getExperiment().getEngine().getRoot() ); getExperiment().run(); }, e -> { traceln("Error!"); e.printStackTrace(); } ); ``` -------------------------------- ### AnyLogic OverheadCrane Get Methods Source: https://anylogic.help/api/com/anylogic/engine/markup/OverheadCrane Comprehensive API documentation for various 'get' methods available on the OverheadCrane and related classes in AnyLogic, providing access to crane properties, positions, states, and dimensions. This includes methods for retrieving hook positions, initial setup parameters, movement modes, and statistical data. ```APIDOC getHookPosition(com.anylogic.engine.markup.OverheadCraneBridge bridge) Returns: Position Parameters: bridge: The OverheadCraneBridge instance. Description: Retrieves the hook position relative to a specific bridge. getInitialBridgePosition(com.anylogic.engine.LengthUnits units) Returns: double Parameters: units: The LengthUnits enum specifying the desired unit of measurement. Description: Deprecated. This method will be removed. Use OverheadCraneBridge.getInitialBridgeOffset(LengthUnits) instead. getInitialHookPoint() Returns: Point Description: Returns the initial hook point in pixels, calculated according to the crane's dimensions and converted to pixels with the crane's space. getInitialHookPoint(com.anylogic.engine.LengthUnits units) Returns: Point Parameters: units: The LengthUnits enum specifying the desired unit of measurement. Description: Returns the initial hook point in the specified length units. getInitialHookPosition(com.anylogic.engine.LengthUnits units) Returns: double Parameters: units: The LengthUnits enum specifying the desired unit of measurement. Description: Deprecated. This method will be removed. Use OverheadCraneBridge.getInitialHookOffset(LengthUnits) instead. getInitialTrolleyPosition(com.anylogic.engine.LengthUnits units) Returns: double Parameters: units: The LengthUnits enum specifying the desired unit of measurement. Description: Deprecated. This method will be removed. Use OverheadCraneBridge.getInitialTrolleyOffset(LengthUnits) instead. getLibraryDescriptor() Returns: com.anylogic.engine.markup.material_handling.IOverheadCraneDescriptor Description: Retrieves the library descriptor for the overhead crane. getMovementMode() Returns: com.anylogic.engine.markup.OverheadCraneMovementMode Description: Returns the movement mode of the crane. getNumberOfBridges() Returns: int Description: Returns the number of bridges the crane has. getPMLProxy(com.anylogic.engine.markup.OverheadCraneBridge bridge) Returns: Object Parameters: bridge: The OverheadCraneBridge instance. Description: Retrieves the PML proxy object for a specific bridge. getPriority(com.anylogic.engine.markup.OverheadCraneBridge bridge) Returns: double Parameters: bridge: The OverheadCraneBridge instance. Description: Retrieves the priority value for a specific bridge. getQueue(com.anylogic.engine.markup.Crane crane) Returns: java.util.List Parameters: crane: The Crane instance. Description: Retrieves the queue of agents associated with the crane. getRotation() Returns: double Description: Returns the rotation angle of the crane. getRunwayLength() Returns: double Description: Returns the runway length in pixels. getRunwayLength(com.anylogic.engine.LengthUnits units) Returns: double Parameters: units: The LengthUnits enum specifying the desired unit of measurement. Description: Returns the runway length in the specified units. getSafetyGap() Returns: double Description: Returns the safety gap of the crane. getSafetyGap(com.anylogic.engine.LengthUnits units) Returns: double Parameters: units: The LengthUnits enum specifying the desired unit of measurement. Description: Returns the safety gap of the crane in the specified units. getState(com.anylogic.engine.markup.OverheadCraneBridge bridge) Returns: com.anylogic.engine.markup.OverheadCraneBridgeState Parameters: bridge: The OverheadCraneBridge instance. Description: Retrieves the current state of a specific overhead crane bridge. getStatisticsStartTime() Returns: double Description: Retrieves the start time for statistics collection. getTargetPoint(com.anylogic.engine.markup.OverheadCraneBridge bridge) Returns: Point Parameters: bridge: The OverheadCraneBridge instance. Description: Retrieves the target point for a specific overhead crane bridge. getTrolleyColor() Returns: java.awt.Color Description: Returns the color of the crane's trolley. ``` -------------------------------- ### Get Position at Offset on Path with Rotations Source: https://anylogic.help/api/com/anylogic/engine/markup/Path Returns a Position object, including rotation information, located on the markup element at a specified offset distance from its start point. ```APIDOC getPositionAtOffset(offset: double, units: com.anylogic.engine.LengthUnits, out: com.anylogic.engine.Position): com.anylogic.engine.Position - Description: Returns the point (+rotations) located on the markup element with the given `offset` distance calculated from start point. ``` -------------------------------- ### AnyLogic ExperimentHost Constructors Source: https://anylogic.help/api/com/anylogic/engine/gui/ExperimentHost Documents the constructors available for the `ExperimentHost` class, including one that initializes with an `Experiment` object and a deprecated constructor that takes a `String` representing the experiment's class name. ```APIDOC ExperimentHost(experiment: com.anylogic.engine.Experiment) - Parameters: - experiment: The experiment object to host. ExperimentHost(experimentClassName: java.lang.String) - Deprecated. - Parameters: - experimentClassName: The fully qualified class name of the experiment to host. ``` -------------------------------- ### AnyLogic Engine Transition Class API Reference Source: https://anylogic.help/api/com/anylogic/engine/Transition This API documentation provides a detailed reference for the `com.anylogic.engine.Transition` class, an abstract base class for statechart transitions. It includes method signatures, return types, parameter descriptions, and usage notes for its direct methods, as well as a list of methods inherited from `com.anylogic.engine.EventOriginator` and `java.lang.Object`. ```APIDOC Class: com.anylogic.engine.Transition Description: Base class for all kinds of statechart transitions: TransitionTimeout, TransitionRate, TransitionCondition and TransitionMessage. Inherits from: com.anylogic.engine.EventOriginator Implements: com.anylogic.engine.internal.Child, java.io.Serializable Direct Known Subclasses: - TransitionCondition - TransitionMessage - TransitionRate - TransitionTimeout Methods: 1. cancel() - Signature: public abstract void cancel() - Description: Should be called when this transition becomes deactivated, e.g., as a result of an alternative transition being taken. - Overrides: EventOriginator.cancel() 2. isLoggingToDB() - Signature: public boolean isLoggingToDB() - Description: Returns `true` if the given event (or dynamic event) is logged to the database (note that this may be overridden by logging settings of Agent). 3. restoreOwner(Object owner) - Signature: public void restoreOwner(java.lang.Object owner) - Description: Deprecated. This method is no longer recommended for use. - Parameters: - owner: (java.lang.Object) The owner object to restore. Inherited Methods from com.anylogic.engine.EventOriginator: - getActiveObject() - getAgent() - getFullName() - getName() - getRest() - getRest(com.anylogic.engine.TimeUnits) - isActive() - isCurrent() - onDestroy() - toString() Inherited Methods from java.lang.Object: - equals(java.lang.Object) - getClass() - hashCode() - notify() - notifyAll() - wait() - wait(long) - wait(long, int) ``` -------------------------------- ### Get Point at Offset on Path Source: https://anylogic.help/api/com/anylogic/engine/markup/TargetLine Returns a Point object representing the location and orientation on the path at a specified distance from the start point. An optional output object can be provided to write the results to. ```APIDOC public final Point getPointAtOffset(double offset, Point out) - Parameters: - offset: double - offset, non-negative value, should be less than or equal to the path's length. - out: Point - output object to write to, may be null - Returns: Point - the Point object with coordinates of the path point with the given offset and orientation along path at this point ```