示例#1
0
        private bool FindDevice(string model, out string resourceName)
        {
            resourceName = null;
            switch (model)
            {
            case "NI PXIe-5830":
                model = "NI PXIe-3621";
                break;

            case "NI PXIe-5831":
                model = "NI PXIe-3622";
                break;
            }
            using (var mis = new ModularInstrumentsSystem(typeof(NIRfsg)))
            {
                for (int i = 0; i < mis.DeviceCollection.Count; i++)
                {
                    if (mis.DeviceCollection[i].Model.Equals(model))
                    {
                        resourceName = mis.DeviceCollection[i].Name;
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#2
0
        private void LoadRfsgDeviceNames()
        {
            ModularInstrumentsSystem modularInstrumentsSystem = new ModularInstrumentsSystem("NI-Rfsg");

            foreach (DeviceInfo device in modularInstrumentsSystem.DeviceCollection)
            {
                resourceNameComboBox.Items.Add(device.Name);
            }
            if (modularInstrumentsSystem.DeviceCollection.Count > 0)
            {
                resourceNameComboBox.SelectedIndex = 0;
            }
        }
        private void LoadDeviceNames()
        {
            ModularInstrumentsSystem rfsgSystem = new ModularInstrumentsSystem("NI-Rfsg");
            foreach (DeviceInfo device in rfsgSystem.DeviceCollection)
                rfsgNameComboBox.Items.Add(device.Name);
            if (rfsgSystem.DeviceCollection.Count > 0)
                rfsgNameComboBox.SelectedIndex = 0;

            ModularInstrumentsSystem rfmxSystem = new ModularInstrumentsSystem("NI-Rfsa");
            foreach (DeviceInfo device in rfmxSystem.DeviceCollection)
                rfsaNameComboBox.Items.Add(device.Name);
            if (rfsgSystem.DeviceCollection.Count > 0)
                rfsaNameComboBox.SelectedIndex = 0;
        }
示例#4
0
        public void StartAcquisition(string channelName, double sampleRate, double referencePosition,
                                     double range, int numberOfPoints, int numberOfRecords)
        {
            try
            {
                scopeDevices = new ModularInstrumentsSystem("NI-Scope");
                scopeName    = scopeDevices.DeviceCollection[0].Name;
                scopeSession = new NIScope(scopeName, false, true);
                scopeSession.DriverOperation.Warning += new EventHandler <ScopeWarningEventArgs>(DriverOperation_Warning);

                scopeSession.Channels[channelName].InputImpedance = 50;

                double offset = 0.0;
                ScopeVerticalCoupling coupling = ScopeVerticalCoupling.DC;
                double probeAttenuation        = 1.0;
                scopeSession.Channels[channelName].Configure(range, offset, coupling, probeAttenuation, true);

//                scopeSession.Channels[channelName]

                bool enforceRealtime = true;

                scopeSession.Timing.ConfigureTiming
                    (sampleRate, numberOfPoints, referencePosition, numberOfRecords, enforceRealtime);

                double               triggerLevel    = 1.6;
                ScopeTriggerSlope    triggerSlope    = ScopeTriggerSlope.Positive;
                ScopeTriggerCoupling triggerCoupling = ScopeTriggerCoupling.DC;
                PrecisionTimeSpan    triggerHoldoff  = PrecisionTimeSpan.Zero;
                PrecisionTimeSpan    triggerDelay    = PrecisionTimeSpan.Zero;
                ScopeTriggerSource   triggerSource   = ScopeTriggerSource.External;

                scopeSession.Trigger.EdgeTrigger.Configure
                    (triggerSource, triggerLevel, triggerSlope, triggerCoupling, triggerHoldoff, triggerDelay);

                recordLength     = scopeSession.Acquisition.RecordLength;
                sampleRate       = scopeSession.Acquisition.SampleRate;
                this.channelName = channelName;

                scopeSession.Measurement.Initiate();


                timeout = new PrecisionTimeSpan(5.0);
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }
示例#5
0
        public override Task <SystemIdentity> Identify(Empty request, ServerCallContext context)
        {
            var identity = new SystemIdentity()
            {
                MachineName = Environment.MachineName,
                OSVersion   = Environment.OSVersion.ToString()
            };

            using (ModularInstrumentsSystem sys = new ModularInstrumentsSystem())
            {
                foreach (DeviceInfo device in sys.DeviceCollection)
                {
                    identity.InstrumentIdentities.Add(new InstrumentIdentity()
                    {
                        Model        = device.Model,
                        Name         = device.Name,
                        SerialNumber = device.SerialNumber,
                        SlotNumber   = device.SlotNumber
                    });
                }
            }
            return(Task.FromResult(identity));
        }