private int Callback(IntPtr context, IntPtr deviceProfile, HotplugEvent e, IntPtr userData) { //Task.Run(() => //{ if (e == HotplugEvent.DeviceArrived) { var newBoard = new TreehopperUsb(new LibUsbConnection(deviceProfile)); Debug.WriteLine("Adding " + newBoard); if (currentContext == null) { Boards.Add(newBoard); } else { currentContext.Post( delegate { Boards.Add(newBoard); }, null); } } else if (e == HotplugEvent.DeviceLeft) { var devicePath = deviceProfile.ToString(); Debug.WriteLine("Removing devicePath " + devicePath); RemoveDevice(devicePath); } //}); return(0); }
async void SecChanged() { Boards.Clear(); var symbol = (Security?.Name ?? SecText)?.Split(' ')?.First(); Info = ""; if (symbol != null) { try { var resp = await Task.Run((() => new SecurityDefinitionRequest(symbol).Response)); Info = string.Join("\n", resp.Description.Data.Select(d => $"{d["name"]}: {d["value"]}")); foreach (var board in resp.Boards.Data) { Boards.Add(new Item() { Name = board["boardid"], Value = board["boardid"], Data = board }); } } catch (Exception e) { } } FirePropertyChanged(nameof(Info)); }
private void DeviceList_Changed(object sender, DeviceListChangedEventArgs e) { var devs = DeviceList.Local.GetHidDevices(BootloaderVid, BootloaderPid); var boardsToRemove = Boards.Where(board => devs.Where(dev => dev.DevicePath == board.DevicePath).Count() == 0).ToList(); foreach (var board in boardsToRemove) { if (currentContext == null) { Boards.Remove(board); } else { currentContext.Post(delegate { Boards.Remove(board); }, null); } } var devsToAdd = devs.Where(dev => Boards.Where(board => board.DevicePath == dev.DevicePath).Count() == 0); foreach (var dev in devsToAdd) { if (currentContext == null) { Boards.Add(new FirmwareUpdateDevice(dev)); } else { currentContext.Post(delegate { Boards.Add(new FirmwareUpdateDevice(dev)); }, null); } } }
/// <summary> /// This function creates a new Board for a User. /// </summary> /// <param name="u">User</param> public Board CreateNewGameBoard(User player, int maxPlayers, int maxRounds) { var board = new Board(); board.Status = "New"; board.MaximumPlayers = maxPlayers; board.MaximumRounds = maxRounds; board.Host = player; var boardUser = new BoardUser(); boardUser.Money = 1500; boardUser.Position = 1; boardUser.Board = board; boardUser.BoardId = board.Id; boardUser.User = player; boardUser.Rounds = 0; boardUser.Turn = -1; BoardUsers.Add(boardUser); board.BoardUsers.Add(boardUser); board.ActiveBoardPlayer = player; Boards.Add(board); SaveChanges(); return(board); }
private async void LoadBoardsByUser() { if (ActiveUser.IsActive == true) { List <ShortBoardDTO> listaDTO = await BoardService.GetBoardsByUser(ActiveUser.Instance.LoggedUser.Token); if (listaDTO != null) { List <ShortBoard> lista = new List <ShortBoard>(); foreach (ShortBoardDTO dto in listaDTO) { //Consider refactoring - observable mehanizam se zove svaki put kad dodam novi bord Boards.Add(new ShortBoard(dto)); } } else { ShowMessageBox(null, "Error getting boards."); } } else { ShowMessageBox(null, "Error getting active user."); } }
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { foreach (var dll in Directory.GetFiles("Plugins", "*.dll")) { try { var assembly = Assembly.LoadFrom(dll); var providerTypes = assembly.GetTypes().Where(type => typeof(IRelayDeviceProvider).IsAssignableFrom(type)); foreach (var providerType in providerTypes) { if (providerType != null) { var provider = (IRelayDeviceProvider)Activator.CreateInstance(providerType); foreach (var board in provider.GetBoards) { Boards.Add(board); } } } } catch { } } }
public int DeviceAdded(IOObject usbDevice, string name, string serialNumber) { var board = new TreehopperUsb(new MacUsbConnection(usbDevice, name, serialNumber)); Boards.Add(board); return(Boards.IndexOf(board)); }
public BoardListPage() { InitializeComponent(); BindingContext = this; #if DEBUG Boards.Add(new OWBoard() { Name = "Onewheel v1", BoardType = OWBoardType.V1, }); Boards.Add(new OWBoard() { Name = "Onewheel Plus", BoardType = OWBoardType.Plus, }); Boards.Add(new OWBoard() { Name = "Onewheel XR", BoardType = OWBoardType.XR, }); Boards.Add(new OWBoard() { Name = "Onewheel unknown", BoardType = OWBoardType.Unknown, }); #endif }
void Adapter_DeviceDiscovered(object sender, Plugin.BLE.Abstractions.EventArgs.DeviceEventArgs e) { System.Diagnostics.Debug.WriteLine($"Device detected {e.Device.Name} {e.Device.Id}"); var board = new OWBoard() { Name = e.Device.Name, ID = e.Device.Id.ToString(), IsAvailable = true, Device = e.Device, }; _foundInLastScan.Add(board); var boardIndex = Boards.IndexOf(board); if (boardIndex == -1) { Boards.Add(board); } else { // Its odd that we set the name again, but when a board is just powered on its name is "Onewheel", not "ow123456" Boards[boardIndex].Name = e.Device.Name; Boards[boardIndex].IsAvailable = true; Boards[boardIndex].Device = e.Device; } }
private void InitialAdd() { IntPtr deviceProfilePtrPtr; var ret = NativeMethods.GetDeviceList(context, out deviceProfilePtrPtr); if (ret > 0 || deviceProfilePtrPtr == IntPtr.Zero) { for (var i = 0; i < ret; i++) { // calculate the offset pointer var deviceProfilePtr = Marshal.ReadIntPtr(new IntPtr(deviceProfilePtrPtr.ToInt64() + i * IntPtr.Size)); var desc = new LibUsbDeviceDescriptor(); NativeMethods.GetDeviceDescriptor(deviceProfilePtr, desc); if (desc.idVendor == TreehopperUsb.Settings.Vid && desc.idProduct == TreehopperUsb.Settings.Pid) { var board = new TreehopperUsb(new LibUsbConnection(deviceProfilePtr)); Debug.WriteLine("Adding " + board); Boards.Add(board); } } } }
public void AddBoard() { var ret = new BoardItemModel(Boards); Boards.Add(ret); Selection = ret; }
public void Add(string name) { _Board = new Board() { Name = name }; Boards.Add(_Board); }
public BufferGasHardware() { // add the boards Boards.Add("daq", "/dev1"); Boards.Add("pg", "/dev2"); // map the digital channels string pgBoard = (string)Boards["pg"]; AddDigitalOutputChannel("q", pgBoard, 0, 0); //Pin 10 AddDigitalOutputChannel("aom", pgBoard, 1, 1); // AddDigitalOutputChannel("flash", pgBoard, 0, 2); //Pin 45 //(0,3) pin 12 is unconnected AddDigitalOutputChannel("shutterTrig1", pgBoard, 1, 6); // Pin 21, triggers camera for on-shots AddDigitalOutputChannel("shutterTrig2", pgBoard, 1, 7); // Pin 22, triggers camera for off-shots (not wired up) AddDigitalOutputChannel("probe", pgBoard, 0, 1); //Pin 44 previously connected to aom (not wired up) AddDigitalOutputChannel("valve", pgBoard, 0, 6); // AddDigitalOutputChannel("detector", pgBoard, 1, 0); //Pin 16 (onShot)from pg to daq AddDigitalOutputChannel("detectorprime", pgBoard, 0, 7); //Pin 15 (OffShot)from pg to daq //digital output P 0.6 wired up, not used (Pin 48) // this is the digital output from the daq board that the TTlSwitchPlugin wil switch AddDigitalOutputChannel("digitalSwitchChannel", (string)Boards["daq"], 0, 0);//enable for camera // add things to the info // the analog triggers Info.Add("analogTrigger0", (string)Boards["daq"] + "/PFI0"); Info.Add("analogTrigger1", (string)Boards["daq"] + "/PFI1"); Info.Add("phaseLockControlMethod", "analog"); Info.Add("PGClockLine", Boards["pg"] + "/PFI2"); Info.Add("PatternGeneratorBoard", pgBoard); Info.Add("PGType", "dedicated"); // map the analog channels string daqBoard = (string)Boards["daq"]; AddAnalogInputChannel("detector1", daqBoard + "/ai0", AITerminalConfiguration.Nrse); //Pin 68 AddAnalogInputChannel("detector2", daqBoard + "/ai3", AITerminalConfiguration.Nrse); //Pin AddAnalogInputChannel("detector3", daqBoard + "/ai8", AITerminalConfiguration.Nrse); //Pin 34 AddAnalogInputChannel("pressure1", daqBoard + "/ai1", AITerminalConfiguration.Nrse); //Pin 33 pressure reading at the moment AddAnalogInputChannel("cavity", daqBoard + "/ai2", AITerminalConfiguration.Nrse); //Pin 65 AddAnalogInputChannel("cavitylong", daqBoard + "/ai4", AITerminalConfiguration.Nrse); //Pin 28 AddAnalogInputChannel("cavityshort", daqBoard + "/ai5", AITerminalConfiguration.Nrse); //Pin 60 AddAnalogOutputChannel("laser", daqBoard + "/ao0"); //Pin 22 AddAnalogOutputChannel("phaseLockAnalogOutput", daqBoard + "/ao1"); //pin 21 //map the counter channels //AddCounterChannel("pmt", daqBoard + "/ctr0"); //AddCounterChannel("sample clock", daqBoard + "/ctr1"); //These need to be activated for the phase lock AddCounterChannel("phaseLockOscillator", daqBoard + "/ctr0"); //This should be the source pin of a counter AddCounterChannel("phaseLockReference", daqBoard + "/PFI9"); //This should be the gate pin of the same counter - need to check it's name }
public void Begin(Player player1, Player player2, int boardSize) { Player1 = player1; Player2 = player2; Board board = new Board(boardSize); Boards.Add(board); CurrentMoves = CurrentBoard.GetAvailableMovesForCurrentPlayer().ToList(); }
private void generateBoard() { if (!CreatePartialSolutions) { return; } var board = new Board(_data.Width, _data.Height); foreach (var colpos in _colPossibilities) { var col = getSurePoints(board.Height, colpos); for (var y = 0; y < col.Length; y++) { if (col[y] != Board.State.Unknown) { board.Set(colpos.Index, y, col[y]); } } } foreach (var rowpos in _rowPossibilities) { var row = getSurePoints(board.Height, rowpos); for (var x = 0; x < row.Length; x++) { if (row[x] != 0) { board.Set(x, rowpos.Index, row[x]); } } } var prevBoard = Boards.LastOrDefault(); if (prevBoard == null) { Boards.Add(board); } else { var fire = false; for (var x = 0; x < board.Width; x++) { for (var y = 0; y < board.Height; y++) { if (board.Get(x, y) != prevBoard.Get(x, y)) { fire = true; break; } } } if (fire) { Boards.Add(board); } } }
private void AddPermissionUserAction(object obj) { BasicBoardDTO board = (BasicBoardDTO)obj; if (board != null) { Boards.Add(new ShortBoard(board)); } //ShowMessageBox(null, "Stigla poruka"); }
public void AddBoard() { var ret = new BoardItemViewModel() { ItemSource = Boards, Name = Utils.GetUniqueName("New Board", Boards.Select(x => (x as BoardItemViewModel).Name)) }; Boards.Add(ret); Selection = ret; }
public override bool AddBoard(IBoard <T> board) { try { Boards.Add(board); return(true); } catch (NullReferenceException) { return(false); } }
protected void ListBoards(Intent intent) { ThrowIfNotInitialized(); ThrowIfNotItems(intent); if (Boards.Count == 0) { Boards.Add(FetchBoards()); } SetItemsContext("BOARDS"); if (!Empty(intent) && intent.Top.Label == "list") { DescribeItems(Boards.Page); } }
public D006MMTFZ400Hardware() { Boards.Add("pgBoard", "/PXI1Slot2"); string pgBoard = (string)Boards["pgBoard"]; Info.Add("PatternGeneratorBoard", pgBoard); Info.Add("PGType", "dedicated"); Info.Add("PGClockLine", pgBoard + "/PFI4"); //Boards.Add("testBoard2", "/dev2"); //string TCLBoard2 = (string)Boards["testBoard2"]; //PG channels AddDigitalOutputChannel("q", pgBoard, 0, 1); //t = 0; AddDigitalOutputChannel("valve", pgBoard, 0, 6); //Use this for the microwaves as it has the valvePulseLength feature! AddDigitalOutputChannel("flash", pgBoard, 0, 2); //Basically unused AddDigitalOutputChannel("detector", pgBoard, 0, 3); AddDigitalOutputChannel("detectorprime", pgBoard, 0, 4); AddDigitalOutputChannel("aom", pgBoard, 0, 5); //Info.Add("analogTrigger2", TCLBoard + "/PFI0"); //TCL Lockable lasers //Info.Add("TCLLockableLasers", new string[] { "laser" }); //Info.Add("TCLPhotodiodes", new string[] { "cavity", "master", "p1" });// THE FIRST TWO MUST BE CAVITY AND MASTER PHOTODIODE!!!! //Info.Add("TCL_Slave_Voltage_Limit_Upper",5.0); //volts: Laser control //Info.Add("TCL_Slave_Voltage_Limit_Lower", 0.0); //volts: Laser control //Info.Add("TCL_Default_Gain", 0.5); //Info.Add("TCL_Default_VoltageToLaser", 0.0); //Info.Add("TCL_MAX_INPUT_VOLTAGE", 10.0); //Info.Add("TCL_Default_ScanPoints", 100); //Info.Add("TCLReadAutostart", true); // Some matching up for TCL //Info.Add("laser", "p1"); //Info.Add("laser2", "p2"); // AddAnalogInputChannel("p1", TCLBoard + "/ai0", AITerminalConfiguration.Rse);//Pin 2 //AddAnalogInputChannel("p2", TCLBoard + "/ai1", AITerminalConfiguration.Rse);//Pin 5 //AddAnalogInputChannel("cavity", TCLBoard + "/ai2", AITerminalConfiguration.Rse); //Pin 8 //AddAnalogInputChannel("master", TCLBoard + "/ai3", AITerminalConfiguration.Rse); //Pin 8 //map the analog output channels // AddAnalogOutputChannel("laser", TCLBoard2 + "/ao0",0,5); // Pin 22 //AddAnalogOutputChannel("rampfb", TCLBoard2 + "/ao1",0,5); //AddAnalogOutputChannel("cavity", TCLBoard2 + "/ao1"); // Pin 21 }
private async void OnNewBoardClick() { if (ActiveUser.IsActive == true) { ShortBoardDTO dto = await BoardService.CreateBoard(ActiveUser.Instance.LoggedUser.Token, new CreateBoardDTO("Unnamed Board")); if (dto == null) { ShowMessageBox(null, "Creation unsuccessful."); } else { Boards.Add(new ShortBoard(dto)); } } }
void OWBLE_BoardDiscovered(OWBaseBoard board) { Debug.WriteLine($"OWBLE_BoardDiscovered: {board.Name} {board.ID}"); var boardIndex = Boards.IndexOf(board); if (boardIndex == -1) { Boards.Add(board); } else { // Its odd that we set the name again, but when a board is just powered on its name is "Onewheel", not "ow123456" Boards[boardIndex].Name = board.Name; Boards[boardIndex].IsAvailable = true; Boards[boardIndex].NativePeripheral = board.NativePeripheral; } }
/// <summary> /// Создать контроллер. /// </summary> /// <param name="nameBoard"> Имя доски. </param> public BoardController(string nameBoard) { if (string.IsNullOrWhiteSpace(nameBoard)) { throw new ArgumentNullException("Наименованиие доски не может быть пустым!", nameof(nameBoard)); } Boards = GetBoardsData(); Board = Boards.SingleOrDefault(b => b.Name == nameBoard); if (Board == null) { Board = new Board(nameBoard); IsNewBoard = true; Boards.Add(Board); Save(); } }
private void OnBoardUpdated(object sender, Board board) { var current = Boards.FirstOrDefault(b => b.Id == board.Id); if (current != null) { var index = Boards.IndexOf(current); if (index >= 0) { Boards[index] = board; } } else { Boards.Add(board); } Board = board; Background = GetBoardBrush(); }
public override void OnReceive(Context context, Intent intent) { if (intent.Action == UsbManager.ActionUsbDeviceDetached) { UsbDevice usbDevice = (UsbDevice)intent.GetParcelableExtra(UsbManager.ExtraDevice); DeviceRemoved(usbDevice); } if (intent.Action == UsbManager.ActionUsbDeviceAttached) { UsbDevice usbDevice = (UsbDevice)intent.GetParcelableExtra(UsbManager.ExtraDevice); createTreehopperFromDevice(usbDevice); } if (intent.Action == ActionUsbPermission) { lock (lockObject) { UsbDevice device = (UsbDevice)intent.GetParcelableExtra(UsbManager.ExtraDevice); if (intent.GetBooleanExtra(UsbManager.ExtraPermissionGranted, false)) { if (device != null) { if (Boards.Count(b => b.SerialNumber == device.SerialNumber) > 0) { return; } var board = new TreehopperUsb(new UsbConnection(device, Manager)); Log.Info(TAG, "Got permission to add new board (name=" + board.Name + ", serial=" + board.SerialNumber + "). Total number of boards: " + Boards.Count); Boards.Add(board); } } else { Log.Debug(TAG, "permission denied for device " + device); } } } }
public async void OnNavigatedTo() { Boards.Clear(); RecentBoards.Clear(); try { BusyMessage = "Downloading available agile boards..."; IsBusy = true; var boards = await _jiraApi.Agile.GetAgileBoards(); var recentBoards = GetRecentBoardsIds(); foreach (var board in boards.OrderBy(b => b.Name)) { Boards.Add(board); if (recentBoards.Contains(board.Id)) { RecentBoards.Add(board); } } } catch (MissingJiraAgileSupportException) { MessageBox.Show("Please log into JIRA instance with JIRA Agile installed.", "JIRA Assistant", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception e) { Sentry.CaptureException(e); MessageBox.Show("Failed to retrieve list of available JIRA boards. Can't go any further.\nReason: " + e.Message, "JIRA Assistant", MessageBoxButton.OK, MessageBoxImage.Warning); } finally { IsBusy = false; BusyMessage = ""; } }
private void ProviderOnBoardAdded(ExchangeBoard board) { Dispatcher.GuiAsync(() => { //using (Dispatcher.DisableProcessing()) try { _updatingUI = true; //var selectedVal = CbBoardCode.SelectedValue as string ?? CbBoardCode.Text.Trim(); //Boards.Clear(); Boards.Add(board); CbBoardCode.SelectedItem = board; //if (!selectedVal.IsEmpty()) SetBoardCode(board.Code); } finally { _updatingUI = false; } }); }
public PXISympatheticHardware() { // add the boards Boards.Add("multiDAQ", "/PXI1Slot6"); Boards.Add("aoBoard", "/PXI1Slot5"); Boards.Add("usbDAQ", "/Dev1"); string multiDAQ = (string)Boards["multiDAQ"]; string aoBoard = (string)Boards["aoBoard"]; string usbDAQ = (string)Boards["usbDAQ"]; // add things to the info Info.Add("PGClockLine", multiDAQ + "/PFI14"); Info.Add("PatternGeneratorBoard", multiDAQ); Info.Add("PGClockCounter", "/ctr0"); Info.Add("APGClockCounter", aoBoard + "/ctr0"); Info.Add("AOPatternTrigger", aoBoard + "/PFI0"); Info.Add("MOTMasterDigitalPatternClockFrequency", 10000); Info.Add("MOTMasterAnalogPatternClockFrequency", 10000); Info.Add("Element", "Li"); //Test this //Info.Add("PGType", "dedicated"); Info.Add("PGType", "integrated"); // map the digital output channels // Control of atoms AddDigitalOutputChannel("MOTMasterPatternTrigger", multiDAQ, 0, 0); AddDigitalOutputChannel("aom0enable", multiDAQ, 0, 0); AddDigitalOutputChannel("aom1enable", multiDAQ, 0, 1); AddDigitalOutputChannel("aom2enable", multiDAQ, 0, 2); AddDigitalOutputChannel("aom3enable", multiDAQ, 0, 3); AddDigitalOutputChannel("CameraTrigger", multiDAQ, 0, 4); AddDigitalOutputChannel("AnalogPatternTrigger", multiDAQ, 0, 5); AddDigitalOutputChannel("TranslationStageTrigger", multiDAQ, 0, 6); AddDigitalOutputChannel("shutterenable", multiDAQ, 1, 1); /* * //Control of molecules * AddDigitalOutputChannel("valve", multiDAQ, 0, 0); * AddDigitalOutputChannel("valve2", multiDAQ, 0, 1); * AddDigitalOutputChannel("q", multiDAQ, 0, 2); * AddDigitalOutputChannel("discharge", multiDAQ, 0, 3); * AddDigitalOutputChannel("aom", multiDAQ, 0, 4); * AddDigitalOutputChannel("flash2", multiDAQ, 0, 5); * AddDigitalOutputChannel("q2", multiDAQ, 0, 6); * AddDigitalOutputChannel("detector", multiDAQ, 0, 7); * AddDigitalOutputChannel("detectorprime", multiDAQ, 0, 8); * AddDigitalOutputChannel("flash", multiDAQ, 0, 9); */ // map the analog input channels AddAnalogInputChannel("pmt", multiDAQ + "/ai0", AITerminalConfiguration.Rse); //Pin 68 AddAnalogInputChannel("lockcavity", multiDAQ + "/ai1", AITerminalConfiguration.Rse); //Pin 33 AddAnalogInputChannel("probepower", multiDAQ + "/ai9", AITerminalConfiguration.Rse); //Pin 66 AddAnalogInputChannel("laserLockErrorSignal", multiDAQ + "/ai2", AITerminalConfiguration.Rse); AddAnalogInputChannel("chamber1Pressure", usbDAQ + "/ai0", AITerminalConfiguration.Differential); AddAnalogInputChannel("chamber2Pressure", usbDAQ + "/ai1", AITerminalConfiguration.Differential); // map the analog output channels // Control of atoms AddAnalogOutputChannel("aom0amplitude", aoBoard + "/ao16"); AddAnalogOutputChannel("aom0frequency", aoBoard + "/ao9"); AddAnalogOutputChannel("aom1amplitude", aoBoard + "/ao10"); AddAnalogOutputChannel("aom1frequency", aoBoard + "/ao11"); AddAnalogOutputChannel("aom2amplitude", aoBoard + "/ao12"); AddAnalogOutputChannel("aom2frequency", aoBoard + "/ao13"); AddAnalogOutputChannel("aom3amplitude", aoBoard + "/ao14"); AddAnalogOutputChannel("aom3frequency", aoBoard + "/ao15"); AddAnalogOutputChannel("coil0current", aoBoard + "/ao8"); AddAnalogOutputChannel("coil1current", aoBoard + "/ao17"); AddAnalogOutputChannel("laser", aoBoard + "/ao1"); AddAnalogOutputChannel("cavity", multiDAQ + "/ao1"); //Control of molecules //AddAnalogOutputChannel("laser", aoBoard + "/ao0"); // Pin 22 //AddAnalogOutputChannel("highvoltage", aoBoard + "/ao1"); // Note - this is just here because a channel called "highvoltage" has been hard-wired into DecelerationHardwareControl - this needs to be rectified //AddAnalogOutputChannel("cavity", aoBoard + "/ao1"); // Pin 21 // map the counter channels AddCounterChannel("pmt", multiDAQ + "/ctr0"); //Source is pin 37, gate is pin 3, out is pin 2 AddCounterChannel("sample clock", multiDAQ + "/ctr1"); //Source is pin 42, gate is pin 41, out is pin 40 // Calibrations AddCalibration("chamber1Pressure", new PowerCalibration(1, 0, 10.875, 1, 10)); AddCalibration("chamber2Pressure", new PowerCalibration(1, 0, 10.875, 1, 10)); //AddCalibration("aom3frequency", new PolynomialCalibration //(new double[] {-27.2757, 0.698297, -0.0075598, 0.000045057, -1.33872 * Math.Pow(10,-7), 1.57402* Math.Pow(10, -10)})); AddCalibration("aom0frequency", new PolynomialCalibration(new double[] { 9.73471, -0.389447, 0.00439124, -0.0000200009, 4.27697 * Math.Pow(10, -8), -3.44365 * Math.Pow(10, -11) }, 130, 260)); AddCalibration("aom1frequency", new PolynomialCalibration(new double[] { -11.9562, 0.185676, -0.00161757, 0.0000109047, -3.54351 * Math.Pow(10, -8), 4.35218 * Math.Pow(10, -11) }, 130, 260)); AddCalibration("aom2frequency", new PolynomialCalibration(new double[] { 0.471968, -0.139565, 0.00173958, -6.18839 * Math.Pow(10, -6), 7.4987 * Math.Pow(10, -9), 8.99272 * Math.Pow(10, -13) }, 130, 260)); AddCalibration("aom3frequency", new PolynomialCalibration(new double[] { 0.879515, -0.143097, 0.00170292, -5.6672 * Math.Pow(10, -6), 5.44491 * Math.Pow(10, -9), 3.56736 * Math.Pow(10, -12) }, 130, 260)); //AddCalibration("coil0current", new LinearInterpolationCalibration(new double[,] {{0.0, 0.0}, {0.0, 0.5}, {0.23, 0.75}, {0.82, 1}, {1.44, 1.25}, //{2.1, 1.5}, {2.75, 1.75}, {3.41, 2}, {4.73, 2.5}, {6.08, 3}, {7.4, 3.5}, {8.76, 4}, {10.08, 4.5}, {11.45, 5}, {12.77, 5.5}, {14.14, 6}, //{15.46, 6.5}, {16.83, 7}, {17.48, 7.25}, {18.15, 7.5}, {18.83, 7.75}, {19.53, 8}, {19.98, 8.5}, {19.98, 9}, {19.98, 9.5}, {19.98, 10}})); }
public EDMHardware() { // add the boards Boards.Add("daq", "/dev1"); Boards.Add("pg", "/dev2"); Boards.Add("counter", "/dev3"); Boards.Add("usbDAQ1", "/dev4"); Boards.Add("analogIn", "/dev5"); Boards.Add("usbDAQ2", "/dev6"); Boards.Add("usbDAQ3", "/dev7"); Boards.Add("usbDAQ4", "/dev9"); string pgBoard = (string)Boards["pg"]; string daqBoard = (string)Boards["daq"]; string counterBoard = (string)Boards["counter"]; string usbDAQ1 = (string)Boards["usbDAQ1"]; string analogIn = (string)Boards["analogIn"]; string usbDAQ2 = (string)Boards["usbDAQ2"]; string usbDAQ3 = (string)Boards["usbDAQ3"]; string usbDAQ4 = (string)Boards["usbDAQ4"]; // add things to the info // the analog triggers Info.Add("analogTrigger0", (string)Boards["analogIn"] + "/PFI0"); Info.Add("analogTrigger1", (string)Boards["analogIn"] + "/PFI1"); Info.Add("sourceToDetect", 1.3); Info.Add("moleculeMass", 193.0); Info.Add("phaseLockControlMethod", "synth"); Info.Add("PGClockLine", Boards["pg"] + "/PFI2"); Info.Add("PatternGeneratorBoard", pgBoard); Info.Add("PGType", "dedicated"); // YAG laser yag = new BrilliantLaser("ASRL1::INSTR"); // add the GPIB instruments Instruments.Add("green", new HP8657ASynth("GPIB0::7::INSTR")); Instruments.Add("red", new HP3325BSynth("GPIB0::12::INSTR")); Instruments.Add("4861", new ICS4861A("GPIB0::4::INSTR")); Instruments.Add("bCurrentMeter", new HP34401A("GPIB0::22::INSTR")); Instruments.Add("rfCounter", new Agilent53131A("GPIB0::3::INSTR")); Instruments.Add("rfPower", new HP438A("GPIB0::13::INSTR")); // map the digital channels // these channels are generally switched by the pattern generator // they're all in the lower half of the pg AddDigitalOutputChannel("valve", pgBoard, 0, 0); AddDigitalOutputChannel("flash", pgBoard, 0, 1); AddDigitalOutputChannel("q", pgBoard, 0, 2); AddDigitalOutputChannel("detector", pgBoard, 0, 3); AddDigitalOutputChannel("detectorprime", pgBoard, 1, 2); // this trigger is for switch scanning // see ModulatedAnalogShotGatherer.cs // for details. AddDigitalOutputChannel("rfSwitch", pgBoard, 0, 4); AddDigitalOutputChannel("fmSelect", pgBoard, 1, 0); // This line selects which fm voltage is // sent to the synth. AddDigitalOutputChannel("attenuatorSelect", pgBoard, 0, 5); // This line selects the attenuator voltage // sent to the voltage-controlled attenuator. AddDigitalOutputChannel("piFlip", pgBoard, 1, 1); AddDigitalOutputChannel("ttlSwitch", pgBoard, 1, 3); // This is the output that the pg // will switch if it's switch scanning. AddDigitalOutputChannel("scramblerEnable", pgBoard, 1, 4); // these channel are usually software switched - they should not be in // the lower half of the pattern generator AddDigitalOutputChannel("b", pgBoard, 2, 0); AddDigitalOutputChannel("notB", pgBoard, 2, 1); AddDigitalOutputChannel("db", pgBoard, 2, 2); AddDigitalOutputChannel("notDB", pgBoard, 2, 3); // AddDigitalOutputChannel("notEOnOff", pgBoard, 2, 4); // this line seems to be broken on our pg board // AddDigitalOutputChannel("eOnOff", pgBoard, 2, 5); // this and the above are not used now we have analog E control AddDigitalOutputChannel("targetStepper", pgBoard, 2, 5); AddDigitalOutputChannel("ePol", pgBoard, 2, 6); AddDigitalOutputChannel("notEPol", pgBoard, 2, 7); AddDigitalOutputChannel("eBleed", pgBoard, 3, 0); AddDigitalOutputChannel("piFlipEnable", pgBoard, 3, 1); AddDigitalOutputChannel("notPIFlipEnable", pgBoard, 3, 5); AddDigitalOutputChannel("pumpShutter", pgBoard, 3, 3); AddDigitalOutputChannel("probeShutter", pgBoard, 3, 4); AddDigitalOutputChannel("argonShutter", pgBoard, 3, 2);// (3,6) & (3,7) are dead. // map the analog channels // These channels are on the daq board. Used mainly for diagnostic purposes. // On no account should they switch during the edm acquisition pattern. AddAnalogInputChannel("iodine", daqBoard + "/ai2", AITerminalConfiguration.Nrse); AddAnalogInputChannel("cavity", daqBoard + "/ai3", AITerminalConfiguration.Nrse); AddAnalogInputChannel("probePD", daqBoard + "/ai4", AITerminalConfiguration.Nrse); AddAnalogInputChannel("pumpPD", daqBoard + "/ai5", AITerminalConfiguration.Nrse); AddAnalogInputChannel("northLeakage", daqBoard + "/ai6", AITerminalConfiguration.Nrse); AddAnalogInputChannel("southLeakage", daqBoard + "/ai7", AITerminalConfiguration.Nrse); // Used ai10,11 & 12 over 6,7 & 8 for miniFluxgates, because ai8, 9 have an isolated ground. AddAnalogInputChannel("miniFlux1", daqBoard + "/ai10", AITerminalConfiguration.Nrse); AddAnalogInputChannel("miniFlux2", daqBoard + "/ai11", AITerminalConfiguration.Nrse); AddAnalogInputChannel("miniFlux3", daqBoard + "/ai12", AITerminalConfiguration.Nrse); // high quality analog inputs (will be) on the S-series analog in board AddAnalogInputChannel("top", analogIn + "/ai0", AITerminalConfiguration.Differential); AddAnalogInputChannel("norm", analogIn + "/ai1", AITerminalConfiguration.Differential); AddAnalogInputChannel("magnetometer", analogIn + "/ai2", AITerminalConfiguration.Differential); AddAnalogInputChannel("gnd", analogIn + "/ai3", AITerminalConfiguration.Differential); AddAnalogInputChannel("battery", analogIn + "/ai4", AITerminalConfiguration.Differential); AddAnalogInputChannel("piMonitor", analogIn + "/ai5", AITerminalConfiguration.Differential); AddAnalogOutputChannel("phaseScramblerVoltage", daqBoard + "/ao0"); AddAnalogOutputChannel("b", daqBoard + "/ao1"); // rf rack control //AddAnalogInputChannel("rfPower", usbDAQ1 + "/ai0", AITerminalConfiguration.Rse); AddAnalogOutputChannel("rf1Attenuator", usbDAQ1 + "/ao0", 0, 5); AddAnalogOutputChannel("rf2Attenuator", usbDAQ1 + "/ao1", 0, 5); AddAnalogOutputChannel("rf1FM", usbDAQ2 + "/ao0", 0, 5); AddAnalogOutputChannel("rf2FM", usbDAQ2 + "/ao1", 0, 5); // E field control and monitoring AddAnalogInputChannel("cPlusMonitor", usbDAQ3 + "/ai1", AITerminalConfiguration.Differential); AddAnalogInputChannel("cMinusMonitor", usbDAQ3 + "/ai2", AITerminalConfiguration.Differential); AddAnalogOutputChannel("cPlus", usbDAQ3 + "/ao0", -5, 0); AddAnalogOutputChannel("cMinus", usbDAQ3 + "/ao1", 0, 5); // B field control AddAnalogOutputChannel("steppingBBias", usbDAQ4 + "/ao0", 0, 5); // FL control AddAnalogOutputChannel("flPZT", usbDAQ4 + "/ao1", 0, 5); // map the counter channels AddCounterChannel("phaseLockOscillator", counterBoard + "/ctr7"); AddCounterChannel("phaseLockReference", counterBoard + "/pfi10"); //AddCounterChannel("northLeakage", counterBoard +"/ctr0"); //AddCounterChannel("southLeakage", counterBoard +"/ctr1"); }
public PXIEDMHardwareNormal() { // add the boards Boards.Add("daq", "/PXI1Slot18"); Boards.Add("pg", "/PXI1Slot10"); Boards.Add("counter", "/PXI1Slot3"); Boards.Add("aoBoard", "/PXI1Slot4"); // this drives the rf attenuators Boards.Add("usbDAQ1", "/Dev2"); Boards.Add("analogIn", "/PXI1Slot2"); Boards.Add("usbDAQ2", "/dev1"); Boards.Add("usbDAQ3", "/dev4"); Boards.Add("usbDAQ4", "/dev3"); Boards.Add("tclBoard", "/PXI1Slot9"); string pgBoard = (string)Boards["pg"]; string daqBoard = (string)Boards["daq"]; string counterBoard = (string)Boards["counter"]; string aoBoard = (string)Boards["aoBoard"]; string usbDAQ1 = (string)Boards["usbDAQ1"]; string analogIn = (string)Boards["analogIn"]; string usbDAQ2 = (string)Boards["usbDAQ2"]; string usbDAQ3 = (string)Boards["usbDAQ3"]; string usbDAQ4 = (string)Boards["usbDAQ4"]; string tclBoard = (string)Boards["tclBoard"]; // add things to the info // the analog triggers Info.Add("analogTrigger0", (string)Boards["analogIn"] + "/PFI0"); Info.Add("analogTrigger1", (string)Boards["analogIn"] + "/PFI1"); Info.Add("sourceToDetect", 1.3); Info.Add("moleculeMass", 193.0); Info.Add("phaseLockControlMethod", "synth"); Info.Add("PGClockLine", pgBoard + "/PFI4"); //Mapped to PFI2 on 6533 connector Info.Add("PatternGeneratorBoard", pgBoard); Info.Add("PGType", "dedicated"); // rf counter switch control seq`` Info.Add("IodineFreqMon", new bool[] { false, false }); // IN 1 Info.Add("pumpAOMFreqMon", new bool[] { false, true }); // IN 2 Info.Add("FLModulationFreqMon", new bool[] { true, false }); // IN 3 Info.Add("PGTrigger", pgBoard + "/PFI5"); //Mapped to PFI7 on 6533 connector // YAG laser yag = new BrilliantLaser("ASRL2::INSTR"); // add the GPIB/RS232 instruments Instruments.Add("green", new HP8657ASynth("GPIB0::7::INSTR")); Instruments.Add("red", new HP3325BSynth("GPIB0::12::INSTR")); Instruments.Add("4861", new ICS4861A("GPIB0::4::INSTR")); Instruments.Add("bCurrentMeter", new HP34401A("GPIB0::22::INSTR")); Instruments.Add("rfCounter", new Agilent53131A("GPIB0::3::INSTR")); //Instruments.Add("rfCounter2", new Agilent53131A("GPIB0::5::INSTR")); Instruments.Add("rfPower", new HP438A("GPIB0::13::INSTR")); Instruments.Add("BfieldController", new SerialDAQ("ASRL12::INSTR")); Instruments.Add("rfCounter2", new SerialAgilent53131A("ASRL8::INSTR")); Instruments.Add("probePolControl", new SerialMotorControllerBCD("ASRL5::INSTR")); Instruments.Add("pumpPolControl", new SerialMotorControllerBCD("ASRL3::INSTR")); // map the digital channels // these channels are generally switched by the pattern generator // they're all in the lower half of the pg AddDigitalOutputChannel("valve", pgBoard, 0, 0); AddDigitalOutputChannel("flash", pgBoard, 0, 1); AddDigitalOutputChannel("q", pgBoard, 0, 2); AddDigitalOutputChannel("detector", pgBoard, 0, 3); AddDigitalOutputChannel("detectorprime", pgBoard, 1, 2); // this trigger is for switch scanning // see ModulatedAnalogShotGatherer.cs // for details. AddDigitalOutputChannel("rfSwitch", pgBoard, 0, 4); AddDigitalOutputChannel("fmSelect", pgBoard, 1, 0); // This line selects which fm voltage is // sent to the synth. AddDigitalOutputChannel("attenuatorSelect", pgBoard, 0, 5); // This line selects the attenuator voltage // sent to the voltage-controlled attenuator. AddDigitalOutputChannel("piFlip", pgBoard, 1, 1); AddDigitalOutputChannel("ttlSwitch", pgBoard, 1, 3); // This is the output that the pg // will switch if it's switch scanning. AddDigitalOutputChannel("scramblerEnable", pgBoard, 1, 4); //RF Counter Control (single pole 4 throw) //AddDigitalOutputChannel("rfCountSwBit1", pgBoard, 3, 5); //AddDigitalOutputChannel("rfCountSwBit2", pgBoard, 3, 6); // new rf amp blanking AddDigitalOutputChannel("rfAmpBlanking", pgBoard, 1, 5); // these channel are usually software switched - they should not be in // the lower half of the pattern generator AddDigitalOutputChannel("b", pgBoard, 2, 0); AddDigitalOutputChannel("notB", pgBoard, 2, 1); AddDigitalOutputChannel("db", pgBoard, 2, 2); AddDigitalOutputChannel("notDB", pgBoard, 2, 3); // AddDigitalOutputChannel("notEOnOff", pgBoard, 2, 4); // this line seems to be broken on our pg board // AddDigitalOutputChannel("eOnOff", pgBoard, 2, 5); // this and the above are not used now we have analog E control AddDigitalOutputChannel("targetStepper", pgBoard, 2, 5); AddDigitalOutputChannel("ePol", pgBoard, 2, 6); AddDigitalOutputChannel("notEPol", pgBoard, 2, 7); AddDigitalOutputChannel("eBleed", pgBoard, 3, 0); AddDigitalOutputChannel("piFlipEnable", pgBoard, 3, 1); AddDigitalOutputChannel("notPIFlipEnable", pgBoard, 3, 5); AddDigitalOutputChannel("pumpShutter", pgBoard, 3, 3); AddDigitalOutputChannel("probeShutter", pgBoard, 3, 4); AddDigitalOutputChannel("argonShutter", pgBoard, 3, 2); //I2 Lock Control AddDigitalOutputChannel("I2PropSwitch", pgBoard, 2, 4); AddDigitalOutputChannel("I2IntSwitch", pgBoard, 3, 6); AddDigitalOutputChannel("fibreAmpEnable", aoBoard, 0, 0); // Map the digital input channels AddDigitalInputChannel("fibreAmpMasterErr", aoBoard, 0, 1); AddDigitalInputChannel("fibreAmpSeedErr", aoBoard, 0, 2); AddDigitalInputChannel("fibreAmpBackFeflectErr", aoBoard, 0, 3); AddDigitalInputChannel("fibreAmpTempErr", aoBoard, 0, 4); AddDigitalInputChannel("fibreAmpPowerSupplyErr", aoBoard, 0, 5); // map the analog channels // These channels are on the daq board. Used mainly for diagnostic purposes. // On no account should they switch during the edm acquisition pattern. AddAnalogInputChannel("diodeLaserCurrent", daqBoard + "/ai0", AITerminalConfiguration.Differential); AddAnalogInputChannel("iodine", daqBoard + "/ai2", AITerminalConfiguration.Nrse); AddAnalogInputChannel("cavity", daqBoard + "/ai3", AITerminalConfiguration.Nrse); AddAnalogInputChannel("probePD", daqBoard + "/ai4", AITerminalConfiguration.Nrse); AddAnalogInputChannel("pumpPD", daqBoard + "/ai5", AITerminalConfiguration.Nrse); AddAnalogInputChannel("northLeakage", daqBoard + "/ai6", AITerminalConfiguration.Nrse); AddAnalogInputChannel("southLeakage", daqBoard + "/ai7", AITerminalConfiguration.Nrse); // Used ai13,11 & 12 over 6,7 & 8 for miniFluxgates, because ai8, 9 have an isolated ground. AddAnalogInputChannel("miniFlux1", daqBoard + "/ai13", AITerminalConfiguration.Nrse); AddAnalogInputChannel("miniFlux2", daqBoard + "/ai11", AITerminalConfiguration.Nrse); AddAnalogInputChannel("miniFlux3", daqBoard + "/ai12", AITerminalConfiguration.Nrse); AddAnalogInputChannel("piMonitor", daqBoard + "/ai10", AITerminalConfiguration.Nrse); //AddAnalogInputChannel("diodeLaserRefCavity", daqBoard + "/ai13", AITerminalConfiguration.Nrse); // Don't use ai10, cross talk with other channels on this line // high quality analog inputs (will be) on the S-series analog in board AddAnalogInputChannel("top", analogIn + "/ai0", AITerminalConfiguration.Differential); AddAnalogInputChannel("norm", analogIn + "/ai1", AITerminalConfiguration.Differential); AddAnalogInputChannel("magnetometer", analogIn + "/ai2", AITerminalConfiguration.Differential); AddAnalogInputChannel("gnd", analogIn + "/ai3", AITerminalConfiguration.Differential); AddAnalogInputChannel("battery", analogIn + "/ai4", AITerminalConfiguration.Differential); //AddAnalogInputChannel("piMonitor", analogIn + "/ai5", AITerminalConfiguration.Differential); //AddAnalogInputChannel("bFieldCurrentMonitor", analogIn + "/ai6", AITerminalConfiguration.Differential); AddAnalogInputChannel("reflectedrf1Amplitude", analogIn + "/ai5", AITerminalConfiguration.Differential); AddAnalogInputChannel("reflectedrf2Amplitude", analogIn + "/ai6", AITerminalConfiguration.Differential); AddAnalogInputChannel("rfCurrent", analogIn + "/ai7 ", AITerminalConfiguration.Differential); AddAnalogOutputChannel("phaseScramblerVoltage", aoBoard + "/ao0"); AddAnalogOutputChannel("b", aoBoard + "/ao1"); // rf rack control //AddAnalogInputChannel("rfPower", usbDAQ1 + "/ai0", AITerminalConfiguration.Rse); AddAnalogOutputChannel("rf1Attenuator", usbDAQ1 + "/ao0", 0, 5); AddAnalogOutputChannel("rf2Attenuator", usbDAQ1 + "/ao1", 0, 5); AddAnalogOutputChannel("rf1FM", usbDAQ2 + "/ao0", 0, 5); AddAnalogOutputChannel("rf2FM", usbDAQ2 + "/ao1", 0, 5); // E field control and monitoring AddAnalogInputChannel("cPlusMonitor", usbDAQ3 + "/ai1", AITerminalConfiguration.Differential); AddAnalogInputChannel("cMinusMonitor", usbDAQ3 + "/ai2", AITerminalConfiguration.Differential); AddAnalogOutputChannel("cPlus", usbDAQ3 + "/ao0", 0, 10); AddAnalogOutputChannel("cMinus", usbDAQ3 + "/ao1", 0, 10); // B field control //AddAnalogOutputChannel("steppingBBias", usbDAQ4 + "/ao0", 0, 5); // map the counter channels AddCounterChannel("phaseLockOscillator", counterBoard + "/ctr7"); AddCounterChannel("phaseLockReference", counterBoard + "/pfi10"); //AddCounterChannel("northLeakage", counterBoard + "/ctr0"); //AddCounterChannel("southLeakage", counterBoard + "/ctr1"); //TCL Lockable lasers //Info.Add("TCLLockableLasers", new string[][] { new string[] { "flPZT2" }, /*new string[] { "flPZT2Temp" },*/ new string[] { "fibreAOM", "flPZT2Temp" } }); Info.Add("TCLLockableLasers", new string[] { "flPZT2" }); //, new string[] { "flPZT2Temp" }, new string[] { "fibreAOM"} }); Info.Add("TCLPhotodiodes", new string[] { "transCavV", "master", "p1" }); // THE FIRST TWO MUST BE CAVITY AND MASTER PHOTODIODE!!!! Info.Add("TCL_Slave_Voltage_Limit_Upper", 10.0); //volts: Laser control Info.Add("TCL_Slave_Voltage_Limit_Lower", 0.0); //volts: Laser control Info.Add("TCL_Default_Gain", -1.1); //Info.Add("TCL_Default_ScanPoints", 250); Info.Add("TCL_Default_VoltageToLaser", 2.5); Info.Add("TCL_Default_VoltageToDependent", 1.0); // Some matching up for TCL Info.Add("flPZT2", "p1"); Info.Add("flPZT2Temp", "p1"); //Info.Add("fibreAOM", "p1"); Info.Add("TCLTrigger", tclBoard + "/PFI0"); Info.Add("TCL_MAX_INPUT_VOLTAGE", 10.0); AddAnalogInputChannel("transCavV", tclBoard + "/ai0", AITerminalConfiguration.Rse); AddAnalogInputChannel("master", tclBoard + "/ai1", AITerminalConfiguration.Rse); AddAnalogInputChannel("p1", tclBoard + "/ai2", AITerminalConfiguration.Rse); // Laser control //AddAnalogOutputChannel("flPZT", usbDAQ4 + "/ao1", 0, 5); AddAnalogOutputChannel("flPZT", aoBoard + "/ao7", 0, 10); AddAnalogOutputChannel("flPZT2", aoBoard + "/ao2", 0, 10); AddAnalogOutputChannel("fibreAmpPwr", aoBoard + "/ao3"); //AddAnalogOutputChannel("pumpAOM", aoBoard + "/ao4", 0, 10); AddAnalogOutputChannel("pumpAOM", usbDAQ4 + "/ao0", 0, 5); //AddAnalogOutputChannel("flPZT2Temp", aoBoard + "/ao5", 0, 4); //voltage must not exceed 4V for Koheras laser //AddAnalogOutputChannel("flPZT2Cur", aoBoard + "/ao6", 0, 5); //voltage must not exceed 5V for Koheras laser //AddAnalogOutputChannel("fibreAOM", usbDAQ4 + "/ao1", 0, 5); AddAnalogOutputChannel("rampfb", aoBoard + "/ao4", -10, 10); AddAnalogOutputChannel("I2LockBias", aoBoard + "/ao5", 0, 5); }