sol01_channel = models.AnalogChannel(name="SOL01 Current", number=0, card=sol_card) sol02_channel = models.AnalogChannel(name="SOL02 Current", number=1, card=sol_card) bpm01_channel = models.AnalogChannel(name="BPM1B", number=0, card=bpm_card) bpm02_channel = models.AnalogChannel(name="BPM2B", number=1, card=bpm_card) session.add_all([ im01_channel, fc_channel, sol01_channel, sol02_channel, bpm01_channel, bpm02_channel ]) # Add digital device types profmon_device_type = models.DeviceType(name="PROF", description="Profile Monitor") temp_device_type = models.DeviceType(name="TEMP", description="Temperature Status") gun_device_type = models.DeviceType(name="GUN", description="Gun Device") buncher_device_type = models.DeviceType(name="CAV", description="Buncher Cavity Device") vvr_device_type = models.DeviceType( name="VVPG", description="Vacuum Valve Pneumatic Status") session.add_all([ profmon_device_type, temp_device_type, vvr_device_type, gun_device_type, buncher_device_type ]) # Add analog device types im_device_type = models.DeviceType(name="TORO", description="Toroid") #units="uC")
cards.append(link_node_card) crates[i].cards.append(link_node_card) session.add(link_node_card) # Define some channels for the cards channels = [] for i in range(0, numCards): for j in range(0, channelsPerCard): channel = models.DigitalChannel(number=j) channel.name = "Channel " + str(i) + ":" + str(j) channel.card = cards[i] channels.append(channel) session.add(channel) # Define a device type digitalDeviceType = models.DeviceType(name="Generic Device Type") session.add(digitalDeviceType) faultDigitalDeviceType = models.DeviceType(name="Composed Device Type") session.add(faultDigitalDeviceType) # States for the device - these are not really used #deviceStates=[] #for i in range(0, 2**channelsPerDevice): # deviceState = models.DeviceState(name="State " + str(i), # device_type=digitalDeviceType, # value=i) # deviceStates.append(deviceState) # session.add(deviceState) # States for the faults
'M2_IN_SWITCH', 'M2_OUT_SWITCH', 'M3_IN_SWITCH', 'M3_OUT_SWITCH', 'CHI_POWER' ] for i in range(0, 9): chan = models.DigitalChannel(number=i) chan.name = chan_name[i] chan.card = link_node_card chan.z_name = "IS_FAULTED" chan.o_name = "IS_OK" chan.alarm_state = 0 digital_chans.append(chan) session.add(chan) # Add device types insertion_device_type = models.DeviceType(name="PROF", description="Insertion Device") power_device_type = models.DeviceType(name="POWR", description="Power Device") sxrss_device_type = models.DeviceType(name="SXSS", description="SXRSS Protection Device") session.add_all([insertion_device_type, power_device_type, sxrss_device_type]) session.commit() # Define some states for the insertion device type device_out = models.DeviceState(name="Out", device_type=insertion_device_type, value=1) device_in = models.DeviceState(name="In", device_type=insertion_device_type, value=2) device_moving = models.DeviceState(name="Moving", device_type=insertion_device_type,
# LN card analog channels # channel 0 - SOL01 Current # channel 1 - SOL02 Current #im01_channel = models.AnalogChannel(name="IM01 Charge", number=0, card = link_node_card) #fc_channel = models.AnalogChannel(name="Faraday Cup Current", number=1, card = link_node_card) #sol01_channel = models.AnalogChannel(name="SOL01 Current", number=2, card = link_node_card) #sol02_channel = models.AnalogChannel(name="SOL02 Current", number=3, card = link_node_card) bpm01_channel = models.AnalogChannel(name="BPM01", number=0, card=bpm_card) bpm02_channel = models.AnalogChannel(name="BPM02", number=1, card=bpm_card) # channel 0 - IM01 # channel 1 - Faraday Cup (FC) session.add_all([bpm01_channel, bpm02_channel]) # Add digital device types profmon_device_type = models.DeviceType(name="PROF", description="Profile Monitor") temp_device_type = models.DeviceType(name="TEMP", description="Temperature Status") vvr_device_type = models.DeviceType( name="VVPR", description="Vacuum Pneumatic Rouhing Valve Status") session.add_all([profmon_device_type, temp_device_type, vvr_device_type]) # Add analog device types #im_device_type = models.AnalogDeviceType(name="ICT", units="uC") #fc_device_type = models.AnalogDeviceType(name="Faraday Cup", units="mA") #sol_curr_device_type = models.AnalogDeviceType(name="Solenoid Curretn", units="mA") #session.add_all([im_device_type, fc_device_type, sol_curr_device_type]) # New analog devices bpm_device_type = models.DeviceType(name="BPMS", description="Beam Position Monitor")
#bpm_card = models.ApplicationCard(number=2) #bpm_card.type = bpm_card_type #bpm_card.slot_number = 3 #crate.cards.append(bpm_card) #session.add(bpm_card) #Define some channels for the card. digital_chans = [] for i in range(0, 4): chan = models.DigitalChannel(number=i) chan.card = pic_card digital_chans.append(chan) session.add(chan) #Add a new device type - insertion device insertion_device_type = models.DeviceType(name="Insertion Device") session.add(insertion_device_type) #Define some states for the device type. otr_screen_out = models.DeviceState(name="Out") otr_screen_out.device_type = insertion_device_type otr_screen_out.value = 1 otr_screen_in = models.DeviceState(name="In") otr_screen_in.device_type = insertion_device_type 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