state_value = (state_value << 1)
# Integrator #4 - bits 24 though 32
for i in range(0, 8):
    state_name = "I3_T" + str(i)
    #  threshold_state = models.DeviceState(name=state_name, value=state_value, mask=state_value, device_type = im_device_type)
    #  if (i < 2):
    #    im_int4_states.append(threshold_state)
    #  session.add(threshold_state)
    state_value = (state_value << 1)

session.commit()

#Add digital devices
screen = models.DigitalDevice(name="YAG01B",
                              position=753,
                              description="YAG01B Screen",
                              device_type=profmon_device_type,
                              card=link_node_card,
                              area="GUNB")
gun_temp = models.DigitalDevice(name="Gun Temperature",
                                device_type=temp_device_type,
                                card=link_node_card,
                                position=100,
                                description="Gun Temperature Summary Input",
                                area="GUNB",
                                measured_device_type_id=gun_device_type.id)
wg_temp = models.DigitalDevice(
    name="Waveguide Temperature",
    device_type=temp_device_type,
    card=link_node_card,
    position=100,
    description="Waveguide A3/A4 Temperature Summary Input",
Beispiel #2
0
# 2 sets of 2**channelsPerDevice
faultDeviceStates = []
for i in range(0, 2**(2**channelsPerDevice)):
    faultDeviceState = models.DeviceState(name="FaultState " + str(i),
                                          device_type=faultDigitalDeviceType,
                                          value=i)
    faultDeviceStates.append(faultDeviceState)
    session.add(faultDeviceState)

# Add digital devices
devices = []
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
Beispiel #3
0
                                          value=0x1A6,
                                          device_type=sxrss_device_type)
sxrss_state_sase = models.DeviceState(name="SXRSS SASE",
                                      value=0xAA,
                                      mask=0xFF,
                                      device_type=sxrss_device_type)

session.add_all([
    device_out, device_in, device_moving, device_broken, power_on, power_off,
    sxrss_default_state, sxrss_state_ss, sxrss_state_harmonic, sxrss_state_sase
])

# add devices
m1_device = models.DigitalDevice(name="M1",
                                 position=30,
                                 description="M1 Insertion Device",
                                 device_type=insertion_device_type,
                                 card=link_node_card,
                                 area="UND1")
slit_device = models.DigitalDevice(name="SL",
                                   position=60,
                                   description="Slit Insertion Device",
                                   device_type=insertion_device_type,
                                   card=link_node_card,
                                   area="UND1")
m2_device = models.DigitalDevice(name="M2",
                                 position=70,
                                 description="M2 Insertion Device",
                                 device_type=insertion_device_type,
                                 card=link_node_card,
                                 area="UND1")
m3_device = models.DigitalDevice(name="M3",
Beispiel #4
0
    state_name = "T_T" + str(i)
    bpm_threshold_state = models.DeviceState(name=state_name,
                                             value=state_value,
                                             mask=state_value,
                                             device_type=bpm_device_type)
    if (i < 4):
        bpm_t_states.append(bpm_threshold_state)
    session.add(bpm_threshold_state)
    state_value = (state_value << 1)

session.commit()

#Add digital devices
screen = models.DigitalDevice(name="YAG01",
                              position=855,
                              description="YAG Screen",
                              device_type=profmon_device_type,
                              card=link_node_card,
                              area="GUNB")
gun_temp = models.DigitalDevice(name="Gun Temperature",
                                device_type=temp_device_type,
                                card=link_node_card,
                                position=100,
                                description="Gun Temperature Summary Input",
                                area="GUNB")
wg_temp = models.DigitalDevice(
    name="Waveguide Temperature",
    device_type=temp_device_type,
    card=link_node_card,
    position=150,
    description="Waveguide Temperature Summary Input",
    area="GUNB")
Beispiel #5
0
otr_screen_in.value = 2

otr_screen_moving = models.DeviceState(name="Moving")
otr_screen_moving.device_type = insertion_device_type
otr_screen_moving.value = 0

otr_screen_broken = models.DeviceState(name="Broken")
otr_screen_broken.device_type = insertion_device_type
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