Interface OTSSimulatorInterface

    • Method Detail

      • initialize

        void initialize​(OTSModelInterface model,
                        OTSReplication replication)
                 throws SimRuntimeException
        Initialize a simulation engine without animation; the easy way. PauseOnError is set to true;
        Parameters:
        model - OTSModelInterface; the simulation to execute
        replication - OTSReplication; the replication with the run control parameters
        Throws:
        SimRuntimeException - when e.g., warmupPeriod is larger than runLength
      • initialize

        void initialize​(Time startTime,
                        Duration warmupPeriod,
                        Duration runLength,
                        OTSModelInterface model)
                 throws SimRuntimeException,
                        NamingException
        Initialize a simulation engine without animation; the easy way. PauseOnError is set to true;
        Parameters:
        startTime - Time; the start time of the simulation
        warmupPeriod - Duration; the warm up period of the simulation (use new Duration(0, SECOND) if you don't know what this is)
        runLength - Duration; the duration of the simulation
        model - OTSModelInterface; the simulation to execute
        Throws:
        SimRuntimeException - when e.g., warmupPeriod is larger than runLength
        NamingException - when the context for the replication cannot be created
      • initialize

        void initialize​(Time startTime,
                        Duration warmupPeriod,
                        Duration runLength,
                        OTSModelInterface model,
                        int replicationNr)
                 throws SimRuntimeException,
                        NamingException
        Initialize a simulation engine without animation and prescribed replication number; the easy way. PauseOnError is set to true;
        Parameters:
        startTime - Time; the start time of the simulation
        warmupPeriod - Duration; the warm up period of the simulation (use new Duration(0, SECOND) if you don't know what this is)
        runLength - Duration; the duration of the simulation
        model - OTSModelInterface; the simulation to execute
        replicationNr - int; the replication number
        Throws:
        SimRuntimeException - when e.g., warmupPeriod is larger than runLength
        NamingException - when context for the animation cannot be created
      • scheduleEventAbsTime

        default SimEvent<Duration> scheduleEventAbsTime​(Time executionTime,
                                                        short priority,
                                                        Object source,
                                                        Object target,
                                                        String method,
                                                        Object[] args)
                                                 throws SimRuntimeException
        Construct and schedule a SimEvent using a Time to specify the execution time.
        Parameters:
        executionTime - Time; the time at which the event must happen
        priority - short; should be between SimEventInterface.MAX_PRIORITY and SimEventInterface.MIN_PRIORITY; most normal events should use SimEventInterface.NORMAL_PRIORITY
        source - Object; the object that creates/schedules the event
        target - Object; the object that must execute the event
        method - String; the name of the method of target that must execute the event
        args - Object[]; the arguments of the method that must execute the event
        Returns:
        SimEvent<Duration>; the event that was scheduled (the caller should save this if a need to cancel the event may arise later)
        Throws:
        SimRuntimeException - when the executionTime is in the past
      • scheduleEventAbsTime

        default SimEvent<Duration> scheduleEventAbsTime​(Time executionTime,
                                                        Object source,
                                                        Object target,
                                                        String method,
                                                        Object[] args)
                                                 throws SimRuntimeException
        Construct and schedule a SimEvent using a Time to specify the execution time.
        Parameters:
        executionTime - Time; the time at which the event must happen
        source - Object; the object that creates/schedules the event
        target - Object; the object that must execute the event
        method - String; the name of the method of target that must execute the event
        args - Object[]; the arguments of the method that must execute the event
        Returns:
        SimEvent<Duration>; the event that was scheduled (the caller should save this if a need to cancel the event may arise later)
        Throws:
        SimRuntimeException - when the executionTime is in the past
      • getSimulatorAbsTime

        default Time getSimulatorAbsTime()
        Return the absolute simulator time rather than the relative one since the start of the simulation.
        Returns:
        Time; the absolute simulator time rather than the relative one since the start of the simulation
      • getStartTimeAbs

        default Time getStartTimeAbs()
        Return the absolute start time of the replication.
        Returns:
        Time; the absolute start time of the replication
      • runUpTo

        default void runUpTo​(Time stopTime)
                      throws SimRuntimeException
        Runs the simulator up to a certain time; any events at that time, or the solving of the differential equation at that timestep, will not yet be executed.
        Parameters:
        stopTime - Time; the absolute time till when we want to run the simulation, coded as a SimTime object
        Throws:
        SimRuntimeException - whenever starting fails. Possible occasions include starting a started simulator
      • runUpToAndIncluding

        default void runUpToAndIncluding​(Time stopTime)
                                  throws SimRuntimeException
        Runs the simulator up to a certain time; all events at that time, or the solving of the differential equation at that timestep, will be executed.
        Parameters:
        stopTime - Time; the absolute time till when we want to run the simulation, coded as a SimTime object
        Throws:
        SimRuntimeException - whenever starting fails. Possible occasions include starting a started simulator