Class FM1StartFederateMessage

  • All Implemented Interfaces:
    Serializable

    public class FM1StartFederateMessage
    extends Sim0MQMessage
    StartFederateMessage, FM.1. When it receives a StartFederate message, the Federate starter creates a process to run the model with the specifications given in the message, such as the working directory, model file, output and error files etc. Creating a model instance in this way also requires a port number, to which the model instance should bind as a ROUTER. This port number is assigned by the Federate Starter. Federate Starter picks an available port from a range of ports on the machine it is running (which must be open to outside connection) and gives this to the model as an argument. If the binding is not successful, the Federate Starter creates generates a new port number.

    Copyright (c) 2016-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See Sim0MQ License.

    Author:
    Alexander Verbraeck
    See Also:
    Serialized Form
    • Constructor Detail

      • FM1StartFederateMessage

        public FM1StartFederateMessage​(Object federationId,
                                       Object senderId,
                                       Object receiverId,
                                       Object messageId,
                                       String instanceId,
                                       String softwareCode,
                                       String argsBefore,
                                       String modelPath,
                                       String argsAfter,
                                       String workingDirectory,
                                       String redirectStdin,
                                       String redirectStdout,
                                       String redirectStderr,
                                       boolean deleteWorkingDirectory,
                                       boolean deleteStdout,
                                       boolean deleteStderr)
                                throws Sim0MQException,
                                       NullPointerException
        Parameters:
        federationId - the federation id can be coded using different types. Examples are two 64-bit longs indicating a UUID, or a String with a UUID number, a String with meaningful identification, or a short or an int with a simulation run number.
        senderId - The sender id can be used to send back a message to the sender at some later time.
        receiverId - The receiver id can be used to check whether the message is meant for us, or should be discarded (or an error can be sent if we receive a message not meant for us).
        messageId - The unique message number is meant to confirm with a callback that the message has been received correctly. The number is unique for the sender, so not globally within the federation.
        instanceId - Id to identify the callback to know which model instance has been started, e.g. "IDVV.14". The model instance will use this as its sender id.
        softwareCode - Code for the software to run, will be looked up in a table on the local computer to determine the path to start the software on that computer. Example: "java". If the softwarePath is defined, softwareCode can be an empty String (0 characters).
        argsBefore - Arguments that the software needs, before the model file path and name; e.g. "–Xmx2G -jar" in case of a Java model. This String can be empty (0 characters).
        modelPath - The actual path on the target computer where the model resides, including the model that needs to be run. This String cannot be empty.
        argsAfter - Arguments that the software or the model needs, after the model file path and name; e.g. arguments for the model itself to run like a data file or a data location . This String can be empty (0 characters), but usually we would want to send the port number(s) or a location where the model can find it as well as the name under which the model was registered.
        workingDirectory - Full path on the target computer that will be used as the working directory. Some files may be temporarily stored there. If the working directory does not exist yet, it will be created.
        redirectStdin - Place to get user input from in case a model asks for it (it shouldn't, by the way).
        redirectStdout - Place to send the output to that the model normally displays on the console. If this is not redirected, the memory buffer for the stdout might get full, and the model might stop as a result. On Linux systems, this often redirected to /dev/null. On Windows systems, this can e.g., be redirected to a file "out.txt" in the current working directory. For now, it has to be a path name (including /dev/null as being acceptable). If no full path is given, the filename is relative to the working directory.
        redirectStderr - Place to send the error messages to that the model normally displays on the console. If this is not redirected, the memory buffer for the stderr might get full, and the model might stop as a result. On Linux systems, this often redirected to /dev/null. On Windows systems, this can e.g., be redirected to a file "err.txt" in the current working directory. For now, it has to be a path name (including /dev/null as being acceptable). If no full path is given, the filename is relative to the working directory.
        deleteWorkingDirectory - Whether to delete the working directory after the run of the model or not.
        deleteStdout - Whether to delete the redirected stdout after running or not (in case it is stored in a different place than the working directory)
        deleteStderr - Whether to delete the redirected stderr after running or not (in case it is stored in a different place than the working directory)
        Throws:
        Sim0MQException - on unknown data type
        NullPointerException - when one of the parameters is null
    • Method Detail

      • getInstanceId

        public final Object getInstanceId()
        Returns:
        instanceId
      • getSoftwareCode

        public final String getSoftwareCode()
        Returns:
        softwareCode
      • getArgsBefore

        public final String getArgsBefore()
        Returns:
        argsBefore
      • getModelPath

        public final String getModelPath()
        Returns:
        modelPath
      • getArgsAfter

        public final String getArgsAfter()
        Returns:
        argsAfter
      • getWorkingDirectory

        public final String getWorkingDirectory()
        Returns:
        workingDirectory
      • getRedirectStdin

        public final String getRedirectStdin()
        Returns:
        redirectStdin
      • getRedirectStdout

        public final String getRedirectStdout()
        Returns:
        redirectStdout
      • getRedirectStderr

        public final String getRedirectStderr()
        Returns:
        redirectStderr
      • isDeleteWorkingDirectory

        public final boolean isDeleteWorkingDirectory()
        Returns:
        deleteWorkingDirectory
      • isDeleteStdout

        public final boolean isDeleteStdout()
        Returns:
        deleteStdout
      • isDeleteStderr

        public final boolean isDeleteStderr()
        Returns:
        deleteStderr