3 Created on Sat May 9 21:21:36 2020
10 from efo.rule
import RuleBase
11 from efo.time
import TimeBase
12 from efo.junction
import JunctionRegulated
13 from efo.qin
import QinRouted
14 from efo.rule_compliance
import RuleComplianceBase
24 if cls
is RuleDwnstrmBase:
26 if set(cls.__abstractmethods__) <= attrs:
33 def __init__(self, name, time, junctions,*, ruleType=RuleComplianceBase.MAX):
36 super().
__init__(name, time, junctions)
41 for curJnc
in self.
junctionsjunctions[1:]:
42 for curQin
in curJnc.qIn:
43 if isinstance(curQin, QinRouted):
44 self.
maxLagmaxLag += curQin.reachUs.lagTime
48 qDelta = np.empty([self.
maxLagmaxLag+1, len(self.
junctionsjunctions[1:])])
49 for i
in range(0, self.
maxLagmaxLag+1):
50 self.
junctionsjunctions[0].set_qout(qOutSpecified=rlsProposed, tsOffset=i)
51 for j, curJnc
in enumerate(self.
junctionsjunctions[1:]):
52 if isinstance(curJnc, JunctionRegulated):
53 qDelta[i, j] = curJnc.calc_delta(ruleType=self.
ruleTyperuleType, tsOffset=i)
60 def get_qcomp(self, *, rlsPrev=None, rlsUnCtrl=None, stor=None, qIn=None, tsOffset=0):
62 qDelta = self.
_calc_delta_calc_delta(rlsProposed=0.)
if self.
ruleTyperuleType==RuleComplianceBase.MIN\
64 maxDelta = np.nanmax(qDelta[:])
def __init__(self, name, time, junctions, *ruleType=RuleComplianceBase.MAX)
def get_qcomp(self, *rlsPrev=None, rlsUnCtrl=None, stor=None, qIn=None, tsOffset=0)
def _calc_delta(self, rlsProposed)
def __subclasshook__(cls, C)
def __init__(self, name, time, junctions)