예제 #1
0
    def simulate_until(self,
                       max_duration,
                       population,
                       operator='and',
                       measure_time=False):
        """
        Runs the network for the maximal duration in milliseconds. If the ``stop_condition`` defined in the population becomes true during the simulation, it is stopped.

        One can specify several populations. If the stop condition is true for any of the populations, the simulation will stop ('or' function).

        Example::

            pop1 = Population( ..., stop_condition = "r > 1.0 : any")
            compile()
            simulate_until(max_duration=1000.0. population=pop1)

        *Parameters*:

        * **duration**: the maximum duration of the simulation in milliseconds.
        * **population**: the (list of) population whose ``stop_condition`` should be checked to stop the simulation.
        * **operator**: operator to be used ('and' or 'or') when multiple populations are provided (default: 'and').
        * **measure_time**: defines whether the simulation time should be printed (default=False).

        *Returns*:

        * the actual duration of the simulation in milliseconds.
        """
        return Global.simulate_until(max_duration, population, operator,
                                     measure_time, self.id)