Esempio n. 1
0
def _randomSemanticClass():
    randID = random.randint(0, 100)
    possibleTypes = (
        semantics.Discrete(f"Button {randID}"),
        semantics.LCDDisplay(f"LCD {randID}"),
        semantics.ContinuousDial(f"ContinuousDial {randID}",0,180,7,11),
    )

    return random.choice(possibleTypes)
Esempio n. 2
0
def create_voltmeter(pixels, range_d=(-30, 30), val_d=(0, 15)):
    r = SC.ContinuousDial('voltmeter', range_d[0], range_d[1], val_d[0],
                          val_d[1])
    r.measure_func = lambda so: B3.voltmeter.get_voltmeter_angle(so.np)
    return r
Esempio n. 3
0
def create_dial(pixels, typeof_dial='cont'):
    range_d, val_d = dial_dic[typeof_dial]
    r = SC.ContinuousDial(typeof_dial + ' dial', range_d[0], range_d[1],
                          val_d[0], val_d[1])
    r.measure_func = lambda so: B3.dial.get_angle(so.np)
    return r
Esempio n. 4
0
    msg['From'] = "*****@*****.**"
    msg['To'] = to

    sendEmail(msg)


if __name__ == "__main__":
    #from DataCollation.SemanticOutputMap import _randomSemanticClass as randSemantic

    test = Sem.Discrete("Fan Oven Status")
    test.value = True
    #    print(test.meaning, test.value)
    #    print(test._valueMap)

    Switchvalue = Sem.Discrete("Oven Power", {
        0: "left",
        1: "middle",
        2: "right"
    })
    Switchvalue.value = 1
    #print(Switchvalue.meaning, Switchvalue.value)

    Needle_test = Sem.ContinuousDial("Voltage", 20, -20, 40, 0)
    Needle_test.value = 10
    #print(Needle_test.meaning, Needle_test.value)

    Example_semanticmap = {"ID1": Needle_test, "ID2": test, "ID3": Switchvalue}
    Example_conditionsmap = {"ID1": [5, 25], "ID2": "On", "ID3": "middle"}
    dispatchFaultMessage(Example_conditionsmap, Example_semanticmap,
                         "*****@*****.**")
Esempio n. 5
0
# -*- coding: utf-8 -*-
from E3.Fault_Conditions import ConditionCheck
import DataCollation.Semantic_Class as sem
from Email import dispatchFaultMessage
from UserInput import ConditionMapCreator
import pandas as pd

example_button = sem.Discrete("BOILER ON")
example_button.value = True
example_three_state = sem.Discrete("BOILER MODE", {
    -45: "LEFT",
    0: "MIDDLE",
    45: "RIGHT"
})
example_three_state.value = 20
example_needle = sem.ContinuousDial("HEAT GAUGE", -30, 30, 0, 20)
example_needle.value = -29
example_semantic_map = {
    1: example_button,
    2: example_three_state,
    3: example_needle
}

file = pd.read_csv(
    r"C:\Users\Tomos\Documents\Programming, Projects\Python\IfM Hackathon\conditions.csv"
)

ConditionMaps = ConditionMapCreator(example_semantic_map, file)

testmap = ConditionMaps[1]
ConditionCheck(testmap, example_semantic_map)