예제 #1
0
        public DifferentialPulse DPV(ScanDatabase _database)
        {
            DifferentialPulse differentialPulse = new DifferentialPulse
            {
                EquilibrationTime = (float)_database.EquilTime,
                BeginPotential    = (float)_database.StartingPotential,
                EndPotential      = (float)_database.EndingPotential,
                StepPotential     = (float)_database.PotentialStep,
                PulsePotential    = (float)_database.PotentialPulse,
                PulseTime         = (float)_database.TimePulse,
                Scanrate          = (float)_database.ScanRate
            };

            differentialPulse.Technique = 1;
            return(differentialPulse);
        }
        //Sets the scan parameters
        public async Task <Method> RunScan()
        {
            //Grabs the most recent database to get the required parameters
            List <ScanDatabase> allDb = await App.Database.GetScanDatabasesAsync();

            ScanDatabase _database = await App.Database.GetScanAsync(allDb.Count);

            //Gets an instance of ScanParams
            ScanParams instance = new ScanParams();

            switch (_database.VoltamType)           //Switch which invokes the correct type of scan
            {
            case "Alternating Current Voltammetry": //Sets an alternating current voltammetric scan
                using (ACVoltammetry acVoltammetry = instance.ACV(_database))
                {
                    acVoltammetry.SmoothLevel = 0;
                    acVoltammetry.Ranging.StartCurrentRange   = new CurrentRange(CurrentRanges.cr10uA);     //Sets the range that the potentiostat will use to detect the current
                    acVoltammetry.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100uA);
                    acVoltammetry.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100nA);

                    return(acVoltammetry);
                }

            case "Cyclic Voltammetry":       //Sets a cyclic voltammetric scan
                using (CyclicVoltammetry cVoltammetry = instance.CV(_database))
                {
                    cVoltammetry.SmoothLevel = 0;
                    cVoltammetry.Ranging.StartCurrentRange   = new CurrentRange(CurrentRanges.cr10uA);     //Sets the range that the potentiostat will use to detect the current
                    cVoltammetry.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100uA);
                    cVoltammetry.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100nA);

                    return(cVoltammetry);
                }

            case "Differential Pulse Voltammetry":       //Sets a differential pulse voltammetric scan
                using (DifferentialPulse differentialPulse = instance.DPV(_database))
                {
                    differentialPulse.SmoothLevel = 0;
                    differentialPulse.Ranging.StartCurrentRange   = new CurrentRange(CurrentRanges.cr1uA);     //Sets the range that the potentiostat will use to detect the current
                    differentialPulse.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr1uA);
                    differentialPulse.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr10nA);

                    return(differentialPulse);
                }

            case "Linear Voltammetry":       //Sets a linear voltammetric scan
                using (LinearSweep linSweep = instance.LinSweep(_database))
                {
                    linSweep.SmoothLevel = 0;
                    linSweep.Ranging.StartCurrentRange   = new CurrentRange(CurrentRanges.cr10uA);     //Sets the range that the potentiostat will use to detect the current
                    linSweep.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100uA);
                    linSweep.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100nA);

                    return(linSweep);
                }

            case "Square Wave Voltammetry":       //Sets a square wave voltammetric scan
                using (SquareWave squareWave = instance.SWV(_database))
                {
                    squareWave.SmoothLevel = 0;
                    squareWave.Ranging.StartCurrentRange   = new CurrentRange(CurrentRanges.cr10uA);     //Sets the range that the potentiostat will use to detect the current
                    squareWave.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100uA);
                    squareWave.Ranging.MaximumCurrentRange = new CurrentRange(CurrentRanges.cr100nA);

                    return(squareWave);
                }

            default:
                //Add code to notify user that something has gone wrong and needs to be fixed

                return(null);
            }
        }