示例#1
0
    def Initialize(self):

        try:

            self._schedulee.Initialize()

        except Exception, e:

            raise ScheduleeError("%s" % e)
示例#2
0
    def Reset(self):

        try:

            self._schedulee.Reset()

        except Exception, e:

            raise ScheduleeError("" % (self.GetName(), e))
示例#3
0
    def Compile(self):

        try:

            self._schedulee.Compile()

        except Exception, e:

            raise ScheduleeError("%s" % e)
示例#4
0
    def Finish(self):
        """

        """
        try:

            self._schedulee.Finish()

        except Exception, e:

            raise ScheduleeError("%s" % e)
示例#5
0
    def GetTimeStep(self):
        """

        """
        try:

            return self._schedulee.GetTimeStep()

        except TypeError, e:

            return ScheduleeError("Can't retrieve time step: %s" % e)
示例#6
0
    def SetTimeStep(self, time_step):
        """

        """
        try:

            self._schedulee.SetTimeStep(time_step)

        except TypeError, e:

            return ScheduleeError("Can't set time step: %s" % e)
示例#7
0
    def Step(self, current_time):
        """
        
        """

        try:

            self._schedulee.Step(current_time)

        except Exception, e:
            pdb.set_trace()
            raise ScheduleeError("%s" % e)
示例#8
0
    def __init__(self, schedulee=None, schedulee_type=None, verbose=False):

        if schedulee is None:

            raise ScheduleeError("Not defined")

        if schedulee_type is None:

            raise ScheduleeError("Type not defined")

        if schedulee_type not in schedulee_types:

            raise ScheduleeError("Invalid type '%s'" % schedulee_type)

#         try:

#             self.time_step = schedulee.GetTimeStep()

#         except Exception, e:

#             raise ScheduleeError("Can't obtain time step: %s\n" % e)

#         if self.time_step < 0.0 or self.time_step is None:

#             raise ScheduleeError("Invalid step value: '%s'\n" % self.time_step)

# This error check isn't needed since we always grab it from the top level.
#         if current_time is None:

#             raise ScheduleeError("Current time not passed")

        self.current_step = 0

        self._schedulees_type = schedulee_type

        self._schedulee = schedulee

        self.type = schedulee_type

        self.verbose = verbose
示例#9
0
    def Report(self):
        """

        """

        if self.verbose:

            pass
            # commented this out since it produces a lot of unuseful output
#            print "%s: %d %f" % (self.GetName(), self.GetTimeStep(), self.GetCurrentTime())

        try:
            # The internals of the report are handled by passing
            # verbose options to the simulation object through the
            # specifcation file
            self._schedulee.Report()

        except Exception, e:

            raise ScheduleeError("Can't report schedulee for '%s': %s" %
                                 (self.GetName(), e))