예제 #1
0
sol1_int1_fault_input = models.FaultInput(bit_position=0,
                                          device=sol01,
                                          fault=sol1_int1_fault)
sol2_int1_fault_input = models.FaultInput(bit_position=0,
                                          device=sol02,
                                          fault=sol2_int1_fault)
fc_int1_fault_input = models.FaultInput(bit_position=0,
                                        device=fc,
                                        fault=fc_int1_fault)

session.add_all(
    [sol1_int1_fault_input, sol2_int1_fault_input, fc_int1_fault_input])

# FaultStates
yag_fault_in = models.FaultState(device_state=screen_in, fault=yag_fault)
yag_fault_moving = models.FaultState(fault=yag_fault,
                                     device_state=screen_moving)
yag_fault_broken = models.FaultState(fault=yag_fault,
                                     device_state=screen_broken)
gun_temp_fault_state = models.FaultState(fault=gun_temp_fault,
                                         device_state=temp_device_fault)
wg_temp_fault_state = models.FaultState(fault=wg_temp_fault,
                                        device_state=temp_device_fault)
buncher_temp_fault_state = models.FaultState(fault=buncher_temp_fault,
                                             device_state=temp_device_fault)
sol01_temp_fault_state = models.FaultState(fault=sol01_temp_fault,
                                           device_state=temp_device_fault)
sol02_temp_fault_state = models.FaultState(fault=sol02_temp_fault,
                                           device_state=temp_device_fault)
vvr1_fault_state = models.FaultState(fault=vvr1_fault,
예제 #2
0
                                   device=m2_device,
                                   fault=sxrss_fault)
m3_fault_input = models.FaultInput(bit_position=6,
                                   device=m3_device,
                                   fault=sxrss_fault)
cp_fault_input = models.FaultInput(bit_position=8,
                                   device=cp_device,
                                   fault=sxrss_fault)
session.add_all([
    m1_fault_input, slit_fault_input, m2_fault_input, m3_fault_input,
    cp_fault_input
])

# Add fault states
sxrss_fault_state_default = models.FaultState(device_state=sxrss_default_state,
                                              fault=sxrss_fault,
                                              default=True)
sxrss_fault_state_ss = models.FaultState(device_state=sxrss_state_ss,
                                         fault=sxrss_fault)
sxrss_fault_state_harmonic = models.FaultState(
    device_state=sxrss_state_harmonic, fault=sxrss_fault)
sxrss_fault_state_sase = models.FaultState(device_state=sxrss_state_sase,
                                           fault=sxrss_fault)
session.add_all([
    sxrss_fault_state_default, sxrss_fault_state_ss,
    sxrss_fault_state_harmonic, sxrss_fault_state_sase
])

sxrss_fault_state_default.add_allowed_class(beam_class=class_0,
                                            mitigation_device=shutter)
sxrss_fault_state_harmonic.add_allowed_class(beam_class=class_3,
예제 #3
0
    for j in range(0, numFaults):
        fault = models.Fault(name="Fault card #" + str(i) + " devices #" +
                             str(j) + "/" + str(j + 1))
        faults.append(fault)
        session.add(fault)
        faultInput0 = models.FaultInput(bit_position=0,
                                        device=devices[j],
                                        fault=fault)  # 2 bits for first input
        faultInput1 = models.FaultInput(
            bit_position=2, device=devices[j + 1],
            fault=fault)  # 2 bits for the next input
        session.add_all([faultInput0, faultInput1])

        # Add fault states, and allowed beam class - one for each DeviceState
        for k in range(0, len(faultDeviceStates)):
            faultState = models.FaultState(device_state=faultDeviceStates[k],
                                           fault=fault)
            faultStates.append(faultState)
            session.add(faultState)
            faultState.add_allowed_class(
                beam_class=beamClasses[k],
                mitigation_device=mitigationDevices[0])

# Add same ignore logic - If fault #0 -> ignore fault #1; if fault #2 -> ignore fault #3 ... so on
for i in range(0, len(faults)):
    if (i % 2 == 0):
        condition = models.Condition(name="Condition #" + str(i),
                                     description="Condition for fault state",
                                     value=1)
        session.add(condition)

        # The input for the condition is the first state listed for the fault
예제 #4
0
otr_fault = models.Fault(name="OTR Fault")
session.add(otr_fault)

#This fault only has one input: the device state.
otr_fault_input = models.FaultInput()
otr_fault_input.bit_position = 0
otr_fault_input.device = otr_screen
otr_fault_input.fault = otr_fault
session.add(otr_fault_input)

#This fault's states match up exactly with the device states.
#otr_fault_out = models.FaultState(name="Out")
#otr_fault_out.fault = otr_fault
#otr_fault_out.value = 1
#session.add(otr_fault_out)
otr_fault_in = models.FaultState(name="In")
otr_fault_in.fault = otr_fault
otr_fault_in.value = 2
session.add(otr_fault_in)
otr_fault_moving = models.FaultState(name="Moving")
otr_fault_moving.fault = otr_fault
otr_fault_moving.value = 0
session.add(otr_fault_moving)
otr_fault_broken = models.FaultState(name="Broken")
otr_fault_broken.fault = otr_fault
otr_fault_broken.value = 3
session.add(otr_fault_broken)

#Give the fault states allowed beam classes.
#otr_fault_out.add_allowed_classes(beam_classes=[class_1, class_2, class_3], mitigation_device=gun)
#otr_fault_out.add_allowed_classes(beam_classes=[class_1, class_2, class_3], mitigation_device=hard_kicker)