示例#1
0
                            description="SOL01 Current",
                            evaluation=1,
                            area="GUNB")
sol02 = models.AnalogDevice(name="SOL2B",
                            device_type=sol_curr_device_type,
                            channel=sol02_channel,
                            card=sol_card,
                            position=823,
                            description="SOL02 Current",
                            evaluation=1,
                            area="GUNB")
session.add_all([bpm01, bpm02, im01, fc, sol01, sol02])

# Give the device some inputs.  It has in and out limit switches.
yag_out_lim_sw = models.DeviceInput(channel=digital_chans[0],
                                    bit_position=0,
                                    digital_device=screen,
                                    fault_value=1)
yag_in_lim_sw = models.DeviceInput(channel=digital_chans[1],
                                   bit_position=1,
                                   digital_device=screen,
                                   fault_value=1)
gun_temp_channel = models.DeviceInput(channel=digital_chans[2],
                                      bit_position=0,
                                      digital_device=gun_temp,
                                      fault_value=0)
wg_temp_channel = models.DeviceInput(channel=digital_chans[3],
                                     bit_position=0,
                                     digital_device=wg_temp,
                                     fault_value=0)
buncher_temp_channel = models.DeviceInput(channel=digital_chans[4],
                                          bit_position=0,
示例#2
0
                                 position=72,
                                 description="M3 Insertion Device",
                                 device_type=insertion_device_type,
                                 card=link_node_card,
                                 area="UND1")
cp_device = models.DigitalDevice(name="CP",
                                 position=10,
                                 description="Chicane Power Device",
                                 device_type=power_device_type,
                                 card=link_node_card,
                                 area="UND1")
session.add_all([m1_device, slit_device, m2_device, m3_device, cp_device])

# Assign inputs to devices
m1_in_sw = models.DeviceInput(channel=digital_chans[0],
                              bit_position=0,
                              digital_device=m1_device,
                              fault_value=0)
m1_out_sw = models.DeviceInput(channel=digital_chans[1],
                               bit_position=1,
                               digital_device=m1_device,
                               fault_value=0)
slit_in_sw = models.DeviceInput(channel=digital_chans[2],
                                bit_position=0,
                                digital_device=slit_device,
                                fault_value=0)
slit_out_sw = models.DeviceInput(channel=digital_chans[3],
                                 bit_position=1,
                                 digital_device=slit_device,
                                 fault_value=0)
m2_in_sw = models.DeviceInput(channel=digital_chans[4],
                              bit_position=0,
示例#3
0
for i in range(0, numCards):
    for j in range(0, devicesPerCard):
        device = models.DigitalDevice(name="Device " + str(i) + ":" + str(j),
                                      z_position=i * devicesPerCard + j,
                                      description="Device #" + str(j) +
                                      " for card #" + str(i),
                                      device_type=digitalDeviceType,
                                      application=global_app)
        devices.append(device)
        session.add(device)

# Assign inputs to devices
for i in range(0, len(devices)):
    for j in range(0, channelsPerDevice):
        deviceInput = models.DeviceInput(
            channel=channels[i * channelsPerDevice + j],
            bit_position=j,
            digital_device=devices[i])
        session.add(deviceInput)

# Configure faults - each fault is the result of the inputs from neighboring devices
# each one has two bits as input
numFaults = devicesPerCard - 1
faults = []
faultStates = []
for i in range(0, numCards):
    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,
示例#4
0
otr_screen_broken.value = 3

session.add_all(
    [otr_screen_out, otr_screen_in, otr_screen_moving, otr_screen_broken])

#Add a device - an OTR screen.
otr_screen = models.DigitalDevice(name="OTR",
                                  z_position=101,
                                  description="OTR screen")
otr_screen.device_type = insertion_device_type
otr_screen.application = global_app
session.add(otr_screen)

#Give the device some inputs.  It has in and out limit switches.
#Connect these limit switches to channels 0 and 1 of our link node card.
otr_out_lim_sw = models.DeviceInput()
otr_out_lim_sw.channel = digital_chans[0]
otr_out_lim_sw.bit_position = 0
otr_out_lim_sw.digital_device = otr_screen
session.add(otr_out_lim_sw)
otr_in_lim_sw = models.DeviceInput()
otr_in_lim_sw.channel = digital_chans[1]
otr_in_lim_sw.bit_position = 1
otr_in_lim_sw.digital_device = otr_screen
session.add(otr_in_lim_sw)

#Configure a fault for the device
otr_fault = models.Fault(name="OTR Fault")
session.add(otr_fault)

#This fault only has one input: the device state.