示例#1
0
        //Service start
        public static void Start(DynamoModel dynamoModel)
        {
            InstrumentationLogger.dynamoModel = dynamoModel;

            if (IsAnalyticsEnabled)
            {
                string appVersion = dynamoModel.AppVersion;

                var mc = new MeasurementConfiguration(ANALYTICS_PROPERTY,
                    "Dynamo", appVersion);
                mc.AnonymizeIp = true;

                sessionID = Guid.NewGuid().ToString();
                loggerImpl = new Log("Dynamo", userID, sessionID);
            
                AutoMeasurement.Start(mc);
                client = AutoMeasurement.Client;

                if (IS_VERBOSE_DIAGNOSTICS)
                    AutoMeasurement.DebugWriter = d => Debug.WriteLine(d);

                started = true;
            }


            // The following starts the heartbeat, do not remove this 
            // because of the unreferenced "heartbeat" variable.

// ReSharper disable UnusedVariable
            var heartbeat = Heartbeat.GetInstance(dynamoModel);
// ReSharper restore UnusedVariable

        }
示例#2
0
        //Service start
        public static void Start(DynamoModel dynamoModel)
        {
            InstrumentationLogger.dynamoModel = dynamoModel;

            if (IsAnalyticsEnabled)
            {
                string appVersion = dynamoModel.AppVersion;

                var mc = new MeasurementConfiguration(ANALYTICS_PROPERTY,
                                                      "Dynamo", appVersion);
                mc.AnonymizeIp = true;

                sessionID  = Guid.NewGuid().ToString();
                loggerImpl = new Log("Dynamo", userID, sessionID);

                AutoMeasurement.Start(mc);
                client = AutoMeasurement.Client;

                if (IS_VERBOSE_DIAGNOSTICS)
                {
                    AutoMeasurement.DebugWriter = d => Debug.WriteLine(d);
                }

                started = true;
            }


            // The following starts the heartbeat, do not remove this
            // because of the unreferenced "heartbeat" variable.

// ReSharper disable UnusedVariable
            var heartbeat = Heartbeat.GetInstance(dynamoModel);
// ReSharper restore UnusedVariable
        }
示例#3
0
        //Service start
        public static void Start(DynamoModel dynamoModel)
        {
            string appVersion = Process.GetCurrentProcess().ProcessName + "-"
                                + UpdateManager.UpdateManager.Instance.ProductVersion.ToString();


            CSharpAnalytics.MeasurementConfiguration mc = new MeasurementConfiguration(ANALYTICS_PROPERTY,
                                                                                       "Dynamo", appVersion);

            sessionID  = Guid.NewGuid().ToString();
            loggerImpl = new Log("Dynamo", userID, sessionID);


            CSharpAnalytics.AutoMeasurement.Start(mc);
            client = AutoMeasurement.Client;

            if (IS_VERBOSE_DIAGNOSTICS)
            {
                AutoMeasurement.DebugWriter = d => Debug.WriteLine(d);
            }

            started = true;

            // The following starts the heartbeat, do not remove this
            // because of the unreferenced "heartbeat" variable.

// ReSharper disable UnusedVariable
            var heartbeat = Heartbeat.GetInstance(dynamoModel);
// ReSharper restore UnusedVariable
        }
        public static void ConfigureMeasurement(NIScope scope, MeasurementConfiguration measurementConfig, string channelNames = "0")
        {
            switch (measurementConfig.ScopeTriggerType)
            {
            case ScopeTriggerType.DigitalEdge:
                scope.Trigger.ConfigureTriggerDigital(ScopeTriggerSource.FromString(measurementConfig.ScopeTriggerSource),
                                                      measurementConfig.TriggerEdge, PrecisionTimeSpan.Zero, PrecisionTimeSpan.Zero);
                break;

            case ScopeTriggerType.Immediate:
                scope.Trigger.ConfigureTriggerImmediate();
                break;

            case ScopeTriggerType.Software:
                scope.Trigger.ConfigureTriggerSoftware(PrecisionTimeSpan.Zero, PrecisionTimeSpan.Zero);
                break;

            default:
                throw new System.NotImplementedException("The functionality for the requested NI-SCOPE trigger type has not been implemented.");
            }

            scope.Acquisition.SampleRateMin     = measurementConfig.SampleRate_Hz;
            scope.Acquisition.NumberOfPointsMin = (long)Math.Round(scope.Acquisition.SampleRate * measurementConfig.MeasurementTime_s);

            scope.Timing.NumberOfRecordsToAcquire = 1;
        }
示例#5
0
文件: Logger.cs 项目: whztt07/Dynamo
        //Service start
        public static void Start(DynamoModel dynamoModel)
        {
            string appVersion = Process.GetCurrentProcess().ProcessName + "-"
                                + UpdateManager.UpdateManager.Instance.ProductVersion.ToString();


            CSharpAnalytics.MeasurementConfiguration mc = new MeasurementConfiguration(ANALYTICS_PROPERTY,
                "Dynamo", appVersion);

            sessionID = Guid.NewGuid().ToString();
            loggerImpl = new Log("Dynamo", userID, sessionID);

            
            CSharpAnalytics.AutoMeasurement.Start(mc);
            client = AutoMeasurement.Client;

            if (IS_VERBOSE_DIAGNOSTICS)
            {
                AutoMeasurement.DebugWriter = d => Debug.WriteLine(d);
            }

            started = true;

            // The following starts the heartbeat, do not remove this 
            // because of the unreferenced "heartbeat" variable.

// ReSharper disable UnusedVariable
            var heartbeat = Heartbeat.GetInstance(dynamoModel);
// ReSharper restore UnusedVariable

        }
        public void ConfigureMeasurementTest()
        {
            NIScope testScope = new NIScope("SIM", false, false, "Simulate = 1");

            MeasurementConfiguration measConfig = MeasurementConfiguration.GetDefault();

            ConfigureMeasurement(testScope, measConfig, "0");

            //Validate basic property sets
            Assert.AreEqual(measConfig.SampleRate_Hz, testScope.Acquisition.SampleRateMin);
            Assert.AreEqual(measConfig.ScopeTriggerSource, testScope.Trigger.Source.ToString());
            Assert.AreEqual(measConfig.TriggerEdge, testScope.Trigger.EdgeTrigger.Slope);
            Assert.AreEqual(measConfig.ScopeTriggerType, testScope.Trigger.Type);

            //Validate that the measurement time is properly calculated by teh code
            Assert.AreEqual(measConfig.MeasurementTime_s, testScope.Acquisition.TimePerRecord.TotalSeconds, 1e-6);

            //Validate that various trigges are setup correctly
            measConfig.ScopeTriggerType = ScopeTriggerType.Immediate;
            ConfigureMeasurement(testScope, measConfig, "0");
            Assert.AreEqual(measConfig.ScopeTriggerType, testScope.Trigger.Type);

            measConfig.ScopeTriggerType = ScopeTriggerType.Software;
            ConfigureMeasurement(testScope, measConfig, "0");
            Assert.AreEqual(measConfig.ScopeTriggerType, testScope.Trigger.Type);

            testScope.Close();
        }
        public void MeasurementConfiguration_Constructor_With_Required_Parameters_Sets_Correct_Properties()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");

            Assert.AreEqual("UA-1234-5", configuration.AccountId);
            Assert.AreEqual("ApplicationName", configuration.ApplicationName);
            Assert.AreEqual("1.2.3.4", configuration.ApplicationVersion);
        }
        public void MeasurementConfiguration_Constructor_With_Required_Parameters_Sets_Correct_Defaults()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");

            Assert.IsTrue(configuration.AnonymizeIp);
            Assert.IsFalse(configuration.UseSsl);
            Assert.AreEqual(100.0, configuration.SampleRate);
        }
        public void MeasurementConfiguration_Constructor_With_Required_Parameters_Sets_Correct_Defaults()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");

            Assert.IsTrue(configuration.AnonymizeIp);
            Assert.IsFalse(configuration.UseSsl);
            Assert.AreEqual(100.0, configuration.SampleRate);
        }
        public void MeasurementConfiguration_Constructor_With_Required_Parameters_Sets_Correct_Properties()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");

            Assert.AreEqual("UA-1234-5", configuration.AccountId);
            Assert.AreEqual("ApplicationName", configuration.ApplicationName);
            Assert.AreEqual("1.2.3.4", configuration.ApplicationVersion);
        }
示例#11
0
        public void MeasurementUriBuilderTests_GetParameters_For_Configuration_Returns_Correct_Keys()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "AppName", "1.2.3.4");

            var keys = MeasurementUriBuilder.GetParameters(configuration).Select(k => k.Key).ToArray();

            CollectionAssert.AreEquivalent(new[] { "tid", "an", "av", "aip" }, keys);
        }
示例#12
0
        public Device(ILogger <Device> logger, IIoTDeviceService ioTDeviceService, IOptions <MeasurementConfiguration> config)
        {
            _logger           = logger;
            _iotDeviceService = ioTDeviceService;
            _config           = config.Value;

            _deviceState     = DeviceState.Listen;
            PropertyChanged += ChangeDeviceState;
        }
        public void MeasurementConfiguration_SampleRate_Property_Can_Be_Set()
        {
            var expected = 51.2;
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4") {
                SampleRate = expected
            };

            Assert.AreEqual(expected, configuration.SampleRate);
        }
        public void MeasurementConfiguration_SampleRate_Property_Can_Be_Set()
        {
            var expected      = 51.2;
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4")
            {
                SampleRate = expected
            };

            Assert.AreEqual(expected, configuration.SampleRate);
        }
        public void MeasurementConfiguration_FormatVersion_Formats_Version_Correctly()
        {
            var version = new PackageVersion {
                Major = 4, Minor = 3, Build = 2, Revision = 1
            };

            var actual = MeasurementConfiguration.FormatVersion(version);

            Assert.AreEqual("4.3.2.1", actual);
        }
示例#16
0
        public void MeasurementUriBuilderTests_GetParameters_For_Configuration_Returns_No_Aip_Value_When_False()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "AppName", "1.2.3.4")
            {
                AnonymizeIp = false
            };

            var keys = MeasurementUriBuilder.GetParameters(configuration).Select(k => k.Key).ToArray();

            CollectionAssert.DoesNotContain(keys, "aip");
        }
        public static void ConfigureMeasurement(NIDCPower supplyHandle, MeasurementConfiguration measConfig, string channelNames = "")
        {
            //On demand mode does not allow for multiple records to be acquired, so we need to validate the configuration given to this function.

            if (measConfig.MeasureWhenMode == DCPowerMeasurementWhen.OnDemand &&
                measConfig.MeasurementMode == MeasurementModeConfiguration.Record)
            {
                throw new ArgumentException("On Demand measurements can only be configured for a single measurement mode",
                                            "MeasurementMode, MeasureWhenMode");
            }

            supplyHandle.Measurement.Configuration.MeasureWhen          = measConfig.MeasureWhenMode;
            supplyHandle.Measurement.Configuration.IsRecordLengthFinite = true;

            if (measConfig.MeasureWhenMode == DCPowerMeasurementWhen.OnMeasureTrigger)
            {
                supplyHandle.Triggers.MeasureTrigger.DigitalEdge.Configure(
                    DCPowerDigitalEdgeMeasureTriggerInputTerminal.FromString(measConfig.MeasurementTriggerTerminal), DCPowerTriggerEdge.Rising);
            }

            supplyHandle.Outputs[channelNames].Measurement.Sense = measConfig.SenseMode;

            int    recordLength;
            double apertureTime;

            /*Single Point: Acquire a single measurement averaged over the duration of the Measurement Time
             * Record: Acquire samples at the maximum sampling rate of the supply for the total duration of Measurement Time. */
            switch (measConfig.MeasurementMode)
            {
            case MeasurementModeConfiguration.Record:
                //Set the aperture time to the minimum value and read it back. This sets the "sample rate".
                //Then, we calculate how many records we need to acquire at that sample rate to get the requested measurement time.
                supplyHandle.Outputs[channelNames].Measurement.ApertureTime = 0;
                double minApertureTime = supplyHandle.Outputs[channelNames].Measurement.ApertureTime;     //dt (Seconds per Sample)
                recordLength = (int)Math.Ceiling(measConfig.MeasurementTime_s / minApertureTime) + 1;     // (Time_s)/(dt S/s) = #of samples
                apertureTime = minApertureTime;
                break;

            case MeasurementModeConfiguration.SinglePoint:
            default:
                //Acquire a single record that is the average measurement over Measurement Time
                apertureTime = measConfig.MeasurementTime_s;
                recordLength = 1;
                break;
            }

            supplyHandle.Outputs[channelNames].Measurement.ApertureTimeUnits = DCPowerMeasureApertureTimeUnits.Seconds;
            supplyHandle.Outputs[channelNames].Measurement.ApertureTime      = apertureTime;
            supplyHandle.Outputs[channelNames].Measurement.RecordLength      = recordLength;
        }
        static void Main()
        {
            NIScope myScope = new NIScope("5154", false, false);

            ScopeConfiguration       scopeConfig = GetDefaultScopeConfiguration();
            MeasurementConfiguration measConfig  = GetDefaultMeasurementConfiguration();

            ConfigureScope(myScope, scopeConfig, "0");
            ConfigureMeasurement(myScope, measConfig, "0");

            MeasurementResults myResults = MeasureChannel(myScope, "0");

            Console.WriteLine(myResults.AverageValue_V);
            Console.ReadKey();
            myScope.Close();
        }
示例#19
0
        /// <summary>
        /// Initialize a new HMC5883L device connected through I2C
        /// </summary>
        /// <param name="i2cDevice">The I2C device used for communication.</param>
        /// <param name="gain">Gain Setting</param>
        /// <param name="measuringMode">The Mode of Measuring</param>
        /// <param name="outputRate">Typical Data Output Rate (Hz)</param>
        /// <param name="samplesAmount">Number of samples averaged per measurement output</param>
        /// <param name="measurementConfig">Measurement configuration</param>
        public Hmc5883l(
            I2cDevice i2cDevice,
            Gain gain = Gain.Gain1090,
            MeasuringMode measuringMode = MeasuringMode.Continuous,
            OutputRate outputRate       = OutputRate.Rate15,
            SamplesAmount samplesAmount = SamplesAmount.One,
            MeasurementConfiguration measurementConfig = MeasurementConfiguration.Normal)
        {
            _i2cDevice         = i2cDevice ?? throw new ArgumentNullException(nameof(i2cDevice));
            _gain              = (byte)gain;
            _measuringMode     = (byte)measuringMode;
            _outputRate        = (byte)outputRate;
            _samplesAmount     = (byte)samplesAmount;
            _measurementConfig = (byte)measurementConfig;

            Initialize();
        }
示例#20
0
        public Qmc5883(II2cBus i2cBus, byte address = 0x0D,
                       Gain gain = Gain.Gain1090,
                       MeasuringMode measuringMode = MeasuringMode.Continuous,
                       OutputRate outputRate       = OutputRate.Rate15,
                       SamplesAmount samplesAmount = SamplesAmount.One,
                       MeasurementConfiguration measurementConfig = MeasurementConfiguration.Normal)
        {
            i2cPeripheral = new I2cPeripheral(i2cBus, address);

            base.gain              = (byte)gain;
            base.measuringMode     = (byte)measuringMode;
            base.outputRate        = (byte)outputRate;
            sampleAmount           = (byte)samplesAmount;
            base.measurementConfig = (byte)measurementConfig;

            Initialize();
        }
示例#21
0
        /// <summary>
        /// Initialize a new HMC5883L device connected through I2C
        /// </summary>
        /// <param name="sensor">I2C Device, like UnixI2cDevice or Windows10I2cDevice</param>
        /// <param name="gain">Gain Setting</param>
        /// <param name="measuringMode">The Mode of Measuring</param>
        /// <param name="outputRate">Typical Data Output Rate (Hz)</param>
        /// <param name="samplesAmount">Number of samples averaged per measurement output</param>
        /// <param name="measurementConfig">Measurement configuration</param>
        public Hmc5883l(
            I2cDevice sensor,
            Gain gain = Gain.Gain1090,
            MeasuringMode measuringMode = MeasuringMode.Continuous,
            OutputRate outputRate       = OutputRate.Rate15,
            SamplesAmount samplesAmount = SamplesAmount.One,
            MeasurementConfiguration measurementConfig = MeasurementConfiguration.Normal)
        {
            _sensor            = sensor;
            _gain              = (byte)gain;
            _measuringMode     = (byte)measuringMode;
            _outputRate        = (byte)outputRate;
            _samplesAmount     = (byte)samplesAmount;
            _measurementConfig = (byte)measurementConfig;

            Initialize();
        }
        static void Main()
        {
            string    channelNames = "0";
            NIDCPower dcPower      = new NIDCPower("4139", channelNames, false);

            // Configure instrument settings
            SupplyConfiguration supplyConfig = SupplyConfiguration.GetDefault();

            supplyConfig.OutputFunction = DCPowerSourceOutputFunction.DCVoltage;
            supplyConfig.VoltageLevel_V = 3;
            supplyConfig.CurrentLevel_A = 1;

            ConfigureSupply(dcPower, supplyConfig, channelNames);

            // Configure measurement related parameters
            MeasurementConfiguration measConfig = new MeasurementConfiguration
            {
                MeasureWhenMode = DCPowerMeasurementWhen.AutomaticallyAfterSourceComplete,
                SenseMode       = DCPowerMeasurementSense.Remote,
                // A MeasurementMode of "Record" acquires multiple smaples over the requested measurement
                // time at the supply's maximum sampling rate. "Single Point" will take a single measurement
                // over that duration and average the power and current results.
                MeasurementMode            = MeasurementModeConfiguration.Record,
                MeasurementTime_s          = 2e-3,
                MeasurementTriggerTerminal = "PXI_Trig0"
            };

            ConfigureMeasurement(dcPower, measConfig, channelNames);

            TurnSupplyOnOrOff(dcPower, SupplyPowerMode.PowerOn, channelNames);

            MeasurementResults results = MeasureSupplyIV(dcPower, channelNames);

            // Calculate the average of the acquired results
            results = Utilities.CalculateAverageIV(results);

            Console.WriteLine($"The average voltage measured was {results.Voltage_V[0]} with a current of {results.Current_A[0]}");
            Console.WriteLine("Press any key to turn off the supply and exit the program.");

            Console.ReadKey();

            TurnSupplyOnOrOff(dcPower, SupplyPowerMode.PowerOff, channelNames);

            CloseSupply(dcPower, channelNames);
        }
        /// <summary>
        /// Initialize CSharpAnalytics by restoring the session state and starting the background sender and tracking
        /// the application lifecycle start event.
        /// </summary>
        /// <param name="configuration">Configuration to use, must at a minimum specify your Google Analytics ID and app name.</param>
        /// <param name="launchArgs">Launch arguments from your Application OnLaunched to determine how the app was launched.</param>
        /// <param name="uploadInterval">How often to upload to the server. Lower times = more traffic but realtime. Defaults to 5 seconds.</param>
        /// <example>var analyticsTask = AutoMeasurement.StartAsync(new MeasurementConfiguration("UA-123123123-1", "MyApp", "1.0.0.0"));</example>
        public static async Task StartAsync(MeasurementConfiguration configuration, IActivatedEventArgs launchArgs, TimeSpan? uploadInterval = null)
        {
            if (!isStarted)
            {
                isStarted = true;
                lastUploadInterval = uploadInterval ?? TimeSpan.FromSeconds(5);
                systemUserAgent = await WindowsStoreSystemInformation.GetSystemUserAgent();
                await StartRequesterAsync();

                var sessionState = await LoadSessionState();
                sessionManager = new SessionManager(sessionState, configuration.SampleRate);
                if (delayedOptOut != null) SetOptOut(delayedOptOut.Value);

                Client.Configure(configuration, sessionManager, new WindowsStoreEnvironment(), Add);
                HookEvents();
            }

            Client.TrackEvent("Start", ApplicationLifecycleEvent, launchArgs.Kind.ToString());
        }
        /// <summary>
        /// Initialize CSharpAnalytics by restoring the session state and starting the background sender.
        /// </summary>
        /// <param name="configuration">Configuration to use, must at a minimum specify your Google Analytics ID and app name.</param>
        /// <param name="uploadInterval">How often to upload to the server. Lower times = more traffic but realtime. Defaults to 5 seconds.</param>
        /// <example>var analyticsTask = AutoMeasurement.Start(new MeasurementConfiguration("UA-123123123-1", "MyApp", "1.0.0.0"));</example>
        public static async Task Start(MeasurementConfiguration configuration, TimeSpan? uploadInterval = null)
        {
            if (!isStarted)
            {
                isStarted = true;
                lastUploadInterval = uploadInterval ?? TimeSpan.FromSeconds(5);
                systemUserAgent = WinFormsSystemInformation.GetSystemUserAgent();

                var sessionState = await LoadSessionState();
                sessionManager = new SessionManager(sessionState, configuration.SampleRate);
                await StartRequesterAsync();

                if (delayedOptOut != null) SetOptOut(delayedOptOut.Value);

                Client.Configure(configuration, sessionManager, new WinFormsEnvironment(), Add);
            }

            client.TrackEvent("Start", ApplicationLifecycleEvent, "Launch");
        }
示例#25
0
        public Qmc5883(string i2cBus, byte address = 0x0D,
                       Gain gain = Gain.Gain1090,
                       MeasuringMode measuringMode = MeasuringMode.Continuous,
                       OutputRate outputRate       = OutputRate.Rate15,
                       SamplesAmount samplesAmount = SamplesAmount.One,
                       MeasurementConfiguration measurementConfig = MeasurementConfiguration.Normal)
        {
            var settings   = new I2cConnectionSettings(address, 100_000); //The slave's address and the bus speed.
            var controller = I2cController.FromName(i2cBus);

            i2cPeripheral = controller.GetDevice(settings);
            //i2cPeripheral = new I2cPeripheral(i2cBus, address);

            base.gain              = (byte)gain;
            base.measuringMode     = (byte)measuringMode;
            base.outputRate        = (byte)outputRate;
            sampleAmount           = (byte)samplesAmount;
            base.measurementConfig = (byte)measurementConfig;

            Initialize();
        }
        /// <summary>
        /// This example illustrates how to use the NI-DCPower APIs to configure the SMU and measure the results.
        /// </summary>
        static void Main()
        {
            string    channelNames = "0";
            NIDCPower dcPower      = new NIDCPower("4139", channelNames, false);

            // Configure instrument settings
            SupplyConfiguration supplyConfig = SupplyConfiguration.GetDefault();

            supplyConfig.OutputFunction = DCPowerSourceOutputFunction.DCVoltage;
            supplyConfig.VoltageLevel_V = 3;
            supplyConfig.CurrentLevel_A = 0.001;
            supplyConfig.VoltageLimit_V = 3;
            supplyConfig.CurrentLimit_A = 0.001;

            ConfigureSupply(dcPower, supplyConfig, channelNames);

            // Configure measurement related parameters
            MeasurementConfiguration measConfig = MeasurementConfiguration.GetDefault();

            measConfig.MeasureWhenMode   = DCPowerMeasurementWhen.AutomaticallyAfterSourceComplete;
            measConfig.MeasurementTime_s = 2e-3;

            ConfigureMeasurement(dcPower, measConfig, channelNames);

            TurnSupplyOnOrOff(dcPower, SupplyPowerMode.PowerOn, channelNames);

            MeasurementResults results = MeasureSupplyIV(dcPower, channelNames);

            // Calculate the average of the acquired results
            results = Utilities.CalculateAverageIV(results);

            Console.WriteLine($"The average voltage measured was {results.Voltage_V[0]} with a current of {results.Current_A[0]}");
            Console.WriteLine("Press any key to turn off the supply and exit the program.");

            Console.ReadKey();

            TurnSupplyOnOrOff(dcPower, SupplyPowerMode.PowerOff, channelNames);

            CloseSupply(dcPower);
        }
        static void Main()
        {
            string    channelNames = "0";
            NIDCPower dcPower      = new NIDCPower("4139", channelNames, false);

            SupplyConfiguration supplyConfig = new SupplyConfiguration();

            supplyConfig.SetDefaults();

            supplyConfig.OutputFunction        = DCPowerSourceOutputFunction.DCVoltage;
            supplyConfig.VoltageLevel_V        = 3;
            supplyConfig.CurrentLevel_A        = 1;
            supplyConfig.TransientResponseMode = DCPowerSourceTransientResponse.Fast;

            ConfigureSupply(dcPower, supplyConfig, channelNames);

            MeasurementConfiguration measConfig = new MeasurementConfiguration
            {
                MeasureWhenMode            = DCPowerMeasurementWhen.AutomaticallyAfterSourceComplete,
                SenseMode                  = DCPowerMeasurementSense.Remote,
                MeasurementMode            = MeasurementConfiguration.MeasurementModeConfiguration.SinglePoint,
                MeasurementTime_s          = 2e-3,
                MeasurementTriggerTerminal = "PXI_Trig0"
            };

            ConfigureMeasurement(dcPower, measConfig, channelNames);

            TurnSupplyOnOrOff(dcPower, SupplyPowerMode.PowerOn, channelNames);

            MeasurementResults results = MeasureSupplyIV(dcPower, channelNames);

            results = Utilities.CalculateAverageIV(results, 3);

            TurnSupplyOnOrOff(dcPower, SupplyPowerMode.PowerOff, channelNames);

            CloseSupply(dcPower, channelNames);
        }
 public static void Start(MeasurementConfiguration measurementConfiguration, string launchKind = "",
     TimeSpan? uploadInterval = null)
 {
     Instance.Start(measurementConfiguration, launchKind, uploadInterval);
 }
 public void MeasurementConfiguration_SampleRate_Property_Throws_ArgumentOutOfRangeException_If_Above_100()
 {
     var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");
     Assert.ThrowsException<ArgumentOutOfRangeException>(() => configuration.SampleRate = 100.01);
 }
        public void MeasurementConfiguration_SampleRate_Property_Throws_ArgumentOutOfRangeException_If_Below_0()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");

            configuration.SampleRate = -0.01;
        }
 public void CustomVariable_Constructor_Throws_ArgumentOutOfRange_If_Enum_Undefined()
 {
     var configuration = new MeasurementConfiguration("NO-1234-5", "ApplicationName", "1.2.3.4");
 }
 public void MeasurementConfiguration_Constructor_Throws_ArgumentException_If_AccountID_Does_Not_Have_Two_Numeric_Parts()
 {
     var configuration = new MeasurementConfiguration("UA-1234", "ApplicationName", "1.2.3.4");
 }
        public void MeasurementConfiguration_SampleRate_Property_Throws_ArgumentOutOfRangeException_If_Above_100()
        {
            var configuration = new MeasurementConfiguration("UA-1234-5", "ApplicationName", "1.2.3.4");

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => configuration.SampleRate = 100.01);
        }