Exemple #1
0
 def temp(self, timestep):
     """The temperature of this component at the chosen timestep
     :param timestep: the timestep at which to query the temperature
     :type timestep: int
     :return: the temperature of the component at the chosen timestep
     :rtype: float, in units of kelvin
     """
     validation.validate_ge("timestep", timestep, 0)
     validation.validate_le("timestep", timestep, self.timer.timesteps())
     return self.T[timestep]
Exemple #2
0
 def temp(self, timestep):
     """The temperature of this component at the chosen timestep
     :param timestep: the timestep at which to query the temperature
     :type timestep: int
     :return: the temperature of the component at the chosen timestep
     :rtype: float, in units of kelvin
     """
     validation.validate_ge("timestep", timestep, 0)
     validation.validate_le("timestep", timestep, self.timer.timesteps())
     return self.T[timestep]
Exemple #3
0
 def advance_time(self, time):
     new_ts = self.t_idx(time)
     old_ts = self.ts
     if (abs(new_ts - old_ts) > 1):
         msg = "At timestep "
         msg += str(self.ts)
         msg += ", which translates to time ("
         msg += str(self.t(self.ts))
         msg += ") the new timestep ("
         msg += str(new_ts)
         msg += ") was more than one step greater than the old timestep: "
         msg += str(old_ts)
         raise RuntimeError(msg)
     self.ts = new_ts
     return validation.validate_le("current time", time, self.tf)
Exemple #4
0
 def advance_time(self, time):
     new_ts = self.t_idx(time)
     old_ts = self.ts
     if (abs(new_ts - old_ts) > 1):
         msg = "At timestep "
         msg += str(self.ts)
         msg += ", which translates to time ("
         msg += str(self.t(self.ts))
         msg += ") the new timestep ("
         msg += str(new_ts)
         msg += ") was more than one step greater than the old timestep: "
         msg += str(old_ts)
         raise RuntimeError(msg)
     self.ts = new_ts
     return validation.validate_le("current time", time, self.tf)
Exemple #5
0
    def advance_time(self, time):
        """Advances the timer to a specific time

        :param time: the time to advance to
        :type time: Quantity units seconds
        """
        new_ts = self.t_idx(time)
        old_ts = self.ts
        if (abs(new_ts - old_ts) > 1):
            msg = "At timestep "
            msg += str(self.ts)
            msg += ", which translates to time ("
            msg += str(self.t(self.ts))
            msg += ") the new timestep ("
            msg += str(new_ts)
            msg += ") was more than one step greater than the old timestep: "
            msg += str(old_ts)
            raise RuntimeError(msg)
        self.ts = new_ts
        return validation.validate_le("current time", time, self.tf)
Exemple #6
0
    def advance_time(self, time):
        """Advances the timer to a specific time

        :param time: the time to advance to
        :type time: Quantity units seconds
        """
        new_ts = self.t_idx(time)
        old_ts = self.ts
        if (abs(new_ts - old_ts) > 1):
            msg = "At timestep "
            msg += str(self.ts)
            msg += ", which translates to time ("
            msg += str(self.t(self.ts))
            msg += ") the new timestep ("
            msg += str(new_ts)
            msg += ") was more than one step greater than the old timestep: "
            msg += str(old_ts)
            raise RuntimeError(msg)
        self.ts = new_ts
        return validation.validate_le("current time", time, self.tf)