Beispiel #1
0
    def _range(self, start, end, forced=False, add=0):
        if start is None:
            start = now()
        r = []

        if forced:
            # If this pass considers force-open times, only this matters
            r.append(self._forced_range(start, end))
        else:
            # Apply groups' times
            r.append(self._group_range(start, end))
            r.append(self._group_xrange(start, end))

            # First step finished.
            r = [range_intersection(*r)]
            # Now add any group "allowed" one-shots.
            for g in self.groups.all():
                r.append(g._allowed_range(start, end))
            r = [range_union(*r)]

            # Now add any group "not-allowed" one-shots.
            for g in self.groups.all():
                r.append(g._not_blocked_range(start, end))

            # Also apply my own exclusion times
            r.append(self._not_blocked_range(start, end))

        # Exclude times when this valve is already scheduled
        r.append(self._not_scheduled(start, end))

        # Only consider times when the controller can open the valve and
        # there's enough water for it to run
        r.append(self.controller._range(start, end, add=add))
        r.append(self.feed._range(start, end, self.flow, add=add))
        return range_intersection(*r)
Beispiel #2
0
	def _range(self,start,end, forced=False, add=0):
		if start is None:
			start = now()
		r = []

		if forced:
			# If this pass considers force-open times, only this matters
			r.append(self._forced_range(start,end))
		else:
			# Apply groups' times 
			r.append(self._group_range(start,end))
			r.append(self._group_xrange(start,end))

			# First step finished.
			r = [range_intersection(*r)]
			# Now add any group "allowed" one-shots.
			for g in self.groups.all():
				r.append(g._allowed_range(start,end))
			r = [range_union(*r)]

			# Now add any group "not-allowed" one-shots.
			for g in self.groups.all():
				r.append(g._not_blocked_range(start,end))

			# Also apply my own exclusion times
			r.append(self._not_blocked_range(start,end))

		# Exclude times when this valve is already scheduled
		r.append(self._not_scheduled(start,end))

		# Only consider times when the controller can open the valve and
		# there's enough water for it to run
		r.append(self.controller._range(start,end,add=add))
		r.append(self.feed._range(start,end,self.flow,add=add))
		return range_intersection(*r)
Beispiel #3
0
	def _range(self,start,end):
		r = []
		r.append(self._days_range(start,end))
		r.append(self._no_xdays_range(start,end))
		r = range_intersection(*r)
		if self.overrides.count():
			r = range_union(r,self._allowed_range(start,end))
		r = range_intersection(r,self._not_blocked_range(start,end))
		return r
Beispiel #4
0
 def _range(self, start, end):
     return range_intersection(*list((x._range(start, end)
                                      for x in self.days.all())))
Beispiel #5
0
	def _range(self,start,end):
		return range_intersection(*list((x._range(start,end) for x in self.days.all())))