Main Content


Retrieve RoadRunner Scenario API server port number in MATLAB

Since R2022b



    simPortNum = getCoSimPort(rrApp) retrieves the API server port number for RoadRunner Scenario.


    collapse all

    This example assumes that RoadRunner is installed in its default location.

    Specify the location in which to create a project. For example, this code shows the path to a RoadRunner project, on a Windows® machine, located at C:\RR\MyProject.

    Create a roadrunner object and open RoadRunner by specifying your project as the location where you want to create a scene. The roadrunner function returns an object, rrApp, that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.

    projectFolder = "C:\RR\MyProject";
    rrApp = roadrunner(projectFolder); 

    Retrieve the RoadRunner Scenario port number, for this instance of RoadRunner Scenario, by using the getCoSimPort function.

    simPortNum = getCoSimPort(rrApp);

    Input Arguments

    collapse all

    RoadRunner application associated with a project, specified as a roadrunner object. This object provides functions for performing common workflow tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

    Output Arguments

    collapse all

    RoadRunner Scenario simulation port number, returned as a positive integer.

    Version History

    Introduced in R2022b