• General
  • Api Documentation

    Show / Hide Table of Contents
    • Quick Start Page
    • Test Cells
    • Add AI Reference
    • AI Examples
    • Changelog

    AI Examples

    C# Example for a Combined Frequency Sweep Measurement

    The following example written in C# shows how to create a combined frequency sweep measurement where the most common settings are applied.

        using System;
        using OmicronLab.MaterialAnalyzer.AutomationInterface;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Enumerations;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces.MeasurementModes.Sweep.FrequencySweep;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces.MeasurementModes.Sweep.FrequencySweep.Settings;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces.TestCells;
    
        public void OverallCombinedExample()
        {
            /*
            * This is an example for a combined FDS and PDC frequency sweep measurement covering the following topics:
            * 1. Setting up a measurement including pre-measurement checks.
            * 2. Setting up a Reference Measurement including pre-measurement checks.
            * 3. Reading out some basic results.
            */
    
            // Initializing a Device - This is done easily by creating a Spectano100 Object.
            // Be sure that the device is online before perfoming measurements or start recording.
            SpectanoDevice device = new Spectano100();
            var isDeviceOnline = device.IsOnlineDelayed(8000);
    
            // Next step is to create a frequency sweep measurement.
            FrequencySweepMeasurement measurement = device.Sweep.CreateFrequencySweepMeasurement();
    
            // Next the the frequency sweep settings will be configured using the Compinde (FDS & PDC) mode.
            double startFrequency = 1e3; // Hz
            double stopFrequency = 1e-3; // Hz
            double pdcSwitchFrequency = 100e-3; // Hz
            int fdsPointsPerDecade = 3;
            int pdcPointsPerDecade = 3;
            CombinedFrequencySweepSettings frequencySweepSettings = measurement.FrequencySweepSettings.ConfigureCombinedFrequencyRange(startFrequency, stopFrequency, pdcSwitchFrequency, pdcPointsPerDecade, fdsPointsPerDecade);
    
            // Set up measurement settings
            measurement.MeasurementSettings.FdsOutputVoltage = 1; // V
            measurement.MeasurementSettings.PdcOutputVoltage = 1; // V
    
            // Configure disk test cell and the related test cell sample.
            double diameter = 30E-3; // m
            double guardGap = 20E-6; // m
            DiskElectrodesWithGuardRing cell = measurement.TestCell.ConfigureDiskElectrodeWithGuardRingTestCell(diameter, guardGap);
    
            measurement.TestCellSample.SampleThickness = 1e-3; // m
    
            // Set up pre-measurement settings for the measurement.
            measurement.PreMeasurement.CheckNoiseAndConnectivityProblems = true;
            measurement.PreMeasurement.EnableCurrentThreshold = true;
            measurement.PreMeasurement.DelayCurrentThreshold = 100E-12; // A
            measurement.PreMeasurement.EnableDelayTime = false;
    
            // Next step is to configure common measurement settings of the ReferenceMeasurement.
            measurement.ReferenceMeasurements.MeasurementSettings.FdsOutputVoltage = 1; // V
            measurement.ReferenceMeasurements.MeasurementSettings.PdcOutputVoltage = 1; // V
            measurement.ReferenceMeasurements.MeasurementSettings.DepolarizationTime = 20; // s
            measurement.ReferenceMeasurements.MeasurementSettings.NoiseSuppression = NoiseSuppression.Standard;
    
            // Configure the Reference1 Measurement.
            measurement.ReferenceMeasurements.ReferenceMeasurement1.TestCellSampleReference.SampleThickness = 3E-3; // m
    
            // PreMeasurement Settings for the Reference Measurement.
            measurement.ReferenceMeasurements.PreMeasurement.DelayTime = 0; // s
            measurement.ReferenceMeasurements.PreMeasurement.CheckNoiseAndConnectivityProblems = true;
            measurement.ReferenceMeasurements.PreMeasurement.EnableCurrentThreshold = true;
            measurement.ReferenceMeasurements.PreMeasurement.DelayCurrentThreshold = 200E-12; // A
    
            // Execute the Reference Measurement 1. We will only use one reference Measurement.
            var state = measurement.ReferenceMeasurements.ReferenceMeasurement1.ExecuteMeasurement();
            if (state != ExecutionState.Ok)
            {
                // Error Happened
                Console.WriteLine("Error happed during execution!");
            }
    
            // Execute measurement.
            state = measurement.ExecuteMeasurement();
            if (state != ExecutionState.Ok)
            {
                // Error Happened
                Console.WriteLine("Error happed during execution!");
            }
    
            // Evaluating the Results.
            var tanDeltaMeasured = measurement.Results.TangentDelta;
            var frequenciesMeasured = measurement.Results.FrequencyPoints;
            for (int i = 0; i > tanDeltaMeasured.Length; i++)
            {
                Console.WriteLine($"Measured tangent delta: {tanDeltaMeasured[i]} @ {frequenciesMeasured[i]} Hz");
            }
    
            // Attention: Corrected values are only avaiable if at least one reference measurement has been performed!
            var tanDeltaCorrected = measurement.CorrectedResults.TangentDelta;
            var frequenciesCorrected = measurement.CorrectedResults.FrequencyPoints;
            for (int i = 0; i > tanDeltaMeasured.Length; i++)
            {
                Console.WriteLine($"Corrected tangent delta: {tanDeltaCorrected[i]} @ {frequenciesCorrected[i]} Hz");
            }
    
            // don't forget to shut down the device.
            device.ShutDown(false);
        }
    

    C# Example for a Continuous Wave Recorder

    This example written in C# shows how to create a recorder and applying most common settings for running in "Continuous Wave" mode.

        using System;
        using System.Threading;
        using MaterialAnalyzer.Tests.Common;
        using Microsoft.VisualStudio.TestTools.UnitTesting;
        using OmicronLab.MaterialAnalyzer.AutomationInterface;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Enumerations;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces.MeasurementModes.Sweep.FrequencySweep;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces.MeasurementModes.Sweep.FrequencySweep.Settings;
        using OmicronLab.MaterialAnalyzer.AutomationInterface.Interfaces.TestCells;
    
        public void ContinuousWaveRecorderExample()
        {
            /*
            * This is an example for starting a continuous wave recorder covering the following topics:
            * 1. Setting up a recorder.
            * 2. Applying test cell settings.
            * 3. Applying continuous wave settings and starting the recorder.
            * 4. Reading out recorder results.
            * 5. Stop recording
            */
    
            var recordingStopped = false;
            var newResultsAvailableCount = 0;
    
            // Initializing a Device - This is done easily by creating a Spectano100 Object.
            // Be sure that the device is online before performing measurements or start recording.
            var device = new Spectano100();
            var rec = device.Recording.CreateRecorder();
            var isDeviceOnline = device.IsOnlineDelayed(8000);
    
            // Configuring test cell relevant settings
            rec.TestCell.ConfigureOtherTestCell();
            rec.TestCellSample.VacuumCapacitance = 2;
    
            // Subscribe to "FdsResultAvailable" event to get access to the recorder data
            rec.FdsResultAvailable += res =>
                {
                    Console.WriteLine($"Measured Tangent Delta {res.TangentDelta} @ {res.Frequency}Hz");
                    newResultsAvailableCount++;
                    if (newResultsAvailableCount > 10 && !recordingStopped)
                    {
                        recordingStopped = true;
                        rec.StopRecording(); // Stop recorder after some time
                    }
                };
    
            // Apply continuous wave settings (frequency = 10Hz and amplitude = 1V) and start recording
            rec.ApplyContinuousWaveSettings(10, 1);
    
            // Wait some time while recorder is running
            while (rec.IsRunning)
            {
                Console.WriteLine("Recorder is still running ...");
                Thread.Sleep(500);
            }
    
            // Don't forget to shut down the device.
            device.ShutDown(false);
        }
    
    Back to top Generated by DocFX