Example #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)
Example #2
0
def create_light(pixels, typeof_light):
    r = SC.Discrete(typeof_light + ' light')
    r.measure_func = lambda so: B3.light_switch.get_button_state(
        so.np, np.array(so.cal_on), np.array(so.cal_off))

    r.cal_on = cals_dict[typeof_light]["on"]
    r.cal_off = cals_dict[typeof_light]["off"]
    return r
Example #3
0
def create_threestate(pixels):
    r = SC.Discrete('threestate',
                    valueMap={
                        -45.0: 'left',
                        0.0: 'middle',
                        45.0: 'right'
                    })
    r.measure_func = lambda so: B3.dial.get_angle(so.np)[0]
    return r
Example #4
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
Example #5
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
Example #6
0
def create_silver(pixels):
    r = SC.Discrete('silver_switch')
    r.measure_func = lambda so: B3.silver_switch.get_switch_state(so.np)
    return r
Example #7
0
def create_placeholder(pixels):
    r = SC.Discrete("light")
    return r
Example #8
0
def create_disp(pixels):
    r = SC.LCDDisplay('7sed_disp')
    r.measure_func = lambda so : B3.seven_seg.seven_seg_disp(so.np)
    return r
Example #9
0
        "Commander,\n\nFault conditions have been violated on your control panel!\n\n{}\n\nThe factory is in peril! \n\nBest wishes, \nGeeWhizWare"
        .format(error_message))

    # me == the sender's email address
    # you == the recipient's email address
    msg['Subject'] = f"Error on your control panel"
    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 #10
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)