Пример #1
0
 def __init__(self, measureNode):
     self.propSpec = measureNode.get("property")
     self.property = Property(self.propSpec)
     self.key = Property(
         measureNode.get("key")) if "key" in measureNode.attrib else None
     self.category = measureNode.get("category", self.propSpec)
     self.kind = Collector.types.index(measureNode.get("type"))
Пример #2
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.epoch = Property(xmlSource.get("epoch", "s.t"))
     self.period = xmlSource.get("period", None)
     if self.period is not None:
         self.period = number(self.period)
     self.time = getXValue(xmlSource, "time", XValueHelper(self))
Пример #3
0
class SetEntity(SimpleEntity):
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.value = getXValue(xmlSource, "value", self.xcontext)
        self.property = Property(xmlSource.get("property"))

    def action(self):
        yield self.hold(0)
        self.property.set(self.transaction, self, float(self.value))
Пример #4
0
class SetEntity(SimpleEntity):
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.value = getXValue(xmlSource, "value", self.xcontext)
        self.property = Property(xmlSource.get("property"))
    
    def action(self):
        yield self.hold(0)
        self.property.set(self.transaction, self, float(self.value))
Пример #5
0
class While(Loop):
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.property = Property(xmlSource.get("property")) 
    
    def test(self):
        return bool(self.property.get(self.transaction, self))
Пример #6
0
class While(Loop):
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.property = Property(xmlSource.get("property"))

    def test(self):
        return bool(self.property.get(self.transaction, self))
Пример #7
0
class PauseTo(SimpleEntity):
    tag = "pause_to"
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.epoch = Property(xmlSource.get("epoch", "s.t"))
        self.period = xmlSource.get("period", None)
        if self.period is not None:
            self.period = number(self.period)
        self.time = getXValue(xmlSource, "time", XValueHelper(self))
        
        
    def duration(self):
        ptime = float(self.time)
        atime = float(self.epoch.get(self.transaction, self))
        if self.period is not None:
            comper = math.floor(atime / self.period)
            start = comper * self.period
            rem = atime - start
            if ptime < rem:
                start += self.period
            ptime = start + ptime
        return ptime - atime
        
    def action(self): 
        yield self.hold(self.duration())    
Пример #8
0
class IfInRange(Branching):
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.property = Property(xmlSource.get("property")) 
        self.attributeSetter(("minimum", float), ("maximum", float))
        
    def test(self):
        value = float(self.property.get(self.transaction, self))
        return self.minimum <= value <= self.maximum    
Пример #9
0
class IfInRange(Branching):
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.property = Property(xmlSource.get("property"))
        self.attributeSetter(("minimum", float), ("maximum", float))

    def test(self):
        value = float(self.property.get(self.transaction, self))
        return self.minimum <= value <= self.maximum
Пример #10
0
class If(Branching):
    """
       If-section (= first subentity) is executed if property is interpreted as true
       (normal Python boolean semantics), otherwise else-section is only executed.
       
       Declarative element: if
    """
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.property = Property(xmlSource.get("property")) 
    
    def test(self):
        return bool(self.property.get(self.transaction, self))
Пример #11
0
class If(Branching):
    """
       If-section (= first subentity) is executed if property is interpreted as true
       (normal Python boolean semantics), otherwise else-section is only executed.
       
       Declarative element: if
    """
    def __init__(self, transaction, xmlSource):
        super().__init__(transaction, xmlSource)
        self.property = Property(xmlSource.get("property"))

    def test(self):
        return bool(self.property.get(self.transaction, self))
Пример #12
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.property = Property(xmlSource.get("property")) 
     self.attributeSetter(("minimum", float), ("maximum", float))
Пример #13
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.property = Property(xmlSource.get("property")) 
Пример #14
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.property = Property(xmlSource.get("property"))
     self.attributeSetter(("minimum", float), ("maximum", float))
Пример #15
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.property = Property(xmlSource.get("property"))
Пример #16
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.value = getXValue(xmlSource, "value", self.xcontext)
     self.property = Property(xmlSource.get("property"))
Пример #17
0
 def __init__(self, transaction, xmlSource):
     super().__init__(transaction, xmlSource)
     self.value = getXValue(xmlSource, "value", self.xcontext)
     self.property = Property(xmlSource.get("property"))