Example #1
0
        private void cmdAddDeltaSExperiment_Click(object sender, EventArgs e)
        {
            EFMExperimentSettingsDeltaS setts = new EFMExperimentSettingsDeltaS((double)nudTminDeltaS.Value, (double)nudTmaxDeltaS.Value, (double)nudTstepDeltaS.Value, (double)nudTResetDeltaS.Value, chkResetDeltaS.Checked,
                                                                                (double)nudHminDeltaS.Value, (double)nudHmaxDeltaS.Value, (double)nudFieldStepDeltaS.Value, (double)nudFieldRampRate.Value, (double)nudStabilization.Value);

            EFMExperimentDeltaS exp = new EFMExperimentDeltaS(setts, stabCtrl, rampCtrl, fieldCtrl, pidCtrl, pathCtrl, this, header);

            control.addExperiment(exp);
        }
Example #2
0
        private void makeDeltaSSequence(EFMExperimentSettingsDeltaS setts)
        {
            //first make arrays with the set temperatures and the set fields, respectively
            int nT = (int)Math.Ceiling((setts.Tmax - setts.Tmin) / setts.Tstep) + 1;

            int nH = (int)Math.Ceiling((setts.Hmax - setts.Hmin) / setts.Hstep) + 1;

            double[] Tset = new double[nT];
            double[] Hset = new double[nH];

            Tset[0] = setts.Tmin;
            for (int i = 1; i < Tset.Length; i++)
            {
                Tset[i] = Tset[i - 1] + setts.Tstep;
            }

            Hset[0] = setts.Hmin;
            for (int i = 1; i < Hset.Length; i++)
            {
                Hset[i] = Hset[i - 1] + setts.Hstep;
            }


            /**
             * The experiment logic is a follows
             * 1. Set the starting field
             * 2. If reset is on the go to the reset temperature
             * 3. Wait 10 seconds
             * 4. Wait for stabilization
             * 5. Goto the next set temperature
             * 6. Wait 10 seconds
             * 7. Wait for stabilization
             * 8. Open new data file
             * 9. Change field according to the settings
             * 10. Wait 10 seconds
             * 11. Wait for stabilization
             * 12. Stop data stream to new file (sub-experiment is done)
             * */

            //loop over each configuration in order to add the experiments
            for (int i = 0; i < Tset.Length; i++)
            {
                for (int j = 1; j < Hset.Length; j++)
                {
                    //1. Set the initial field (always the zero'th member of the field array)
                    SetFieldTask setField = new SetFieldTask();

                    setField.field     = Hset[0];
                    setField.rampRate  = 0.1;//T/s
                    setField.fieldCtrl = fieldCtrl;
                    taskList.Add(setField);

                    if (setts.doReset)
                    {
                        //2. In case of resetting then go to the reset temperature and stabilize
                        SetTemperatureTask setT = new SetTemperatureTask();
                        setT.Tset     = setts.Treset;
                        setT.tempCtrl = pidCtrl;
                        taskList.Add(setT);

                        //3. Wait for a little time
                        WaitTimeTask wt = new WaitTimeTask();
                        wt.waitTime = 10;//seconds
                        taskList.Add(wt);

                        //4. wait for stabilization
                        WaitStabilizeTask wtS = new WaitStabilizeTask();
                        wtS.criterion = setts.stabilizeCriterium;
                        wtS.stabCtrl  = stabCtrl;
                        taskList.Add(wtS);
                    }

                    //5. set next temperature
                    SetTemperatureTask setT_next = new SetTemperatureTask();
                    setT_next.Tset     = Tset[i];
                    setT_next.tempCtrl = pidCtrl;
                    taskList.Add(setT_next);

                    //6. Wait for a little time
                    WaitTimeTask wt_next = new WaitTimeTask();
                    wt_next.waitTime = 10;//seconds
                    taskList.Add(wt_next);

                    //7. wait for stabilization
                    WaitStabilizeTask wtS_next = new WaitStabilizeTask();
                    wtS_next.criterion = setts.stabilizeCriterium;
                    wtS_next.stabCtrl  = stabCtrl;
                    taskList.Add(wtS_next);

                    //8. open separate data file
                    SeparateDatafileTask opTask = new SeparateDatafileTask();
                    opTask.filename           = "deltaS_Tset_" + Tset[i].ToString() + "_Hset_" + Hset[j].ToString();
                    experimentReadingsUpdate += opTask.readingsUpdate;
                    opTask.filePath           = datasaveCtrl;
                    opTask.header             = header;
                    taskList.Add(opTask);

                    //9. Change the field according to the current data point
                    SetFieldTask setField_next = new SetFieldTask();
                    setField_next.field     = Hset[j];
                    setField_next.rampRate  = setts.Hrate;//T/s
                    setField_next.fieldCtrl = fieldCtrl;
                    taskList.Add(setField_next);

                    //10. Wait for a little time
                    WaitTimeTask wt_aft_exp = new WaitTimeTask();
                    wt_aft_exp.waitTime = 10;//seconds
                    taskList.Add(wt_aft_exp);

                    //11. wait for stabilization
                    WaitStabilizeTask wtS_aft_exp = new WaitStabilizeTask();
                    wtS_aft_exp.criterion = setts.stabilizeCriterium;
                    wtS_aft_exp.stabCtrl  = stabCtrl;
                    taskList.Add(wtS_aft_exp);

                    //12. Stop the data stream. Add the output task once more. It's start() method will then be called and this taken as a signal to stop outputting data.
                    taskList.Add(opTask);
                }
            }
            //turn off the field at the very end
            SetFieldTask setField_end = new SetFieldTask();

            setField_end.field     = Hset[0];
            setField_end.rampRate  = setts.Hrate;//T/s
            setField_end.fieldCtrl = fieldCtrl;
            taskList.Add(setField_end);

            //add experiment finished task
            ExperimentFinishedTask expF = new ExperimentFinishedTask();

            taskList.Add(expF);
            //set the descriptor text of this experiment
            experimentDescriptor = "deltaS_Tmin_" + setts.Tmin.ToString() + "_Tmax_" + setts.Tmax.ToString() + "_Hmin_" + setts.Hmin.ToString() + "_Hmax_" + setts.Hmax.ToString();
            if (setts.doReset)
            {
                experimentDescriptor += "_Treset_" + setts.Treset.ToString();
            }
        }
Example #3
0
 public EFMExperimentDeltaS(EFMExperimentSettingsDeltaS setts, StabilityCtrl sCtrl, SetTemperatureRampCtrl rCtrl, SetFieldControl fCtrl, PIDControl_Tset pCtrl, DatasaveFilePath datCtrl, ExperimentStatusUpdate stCtrl, string[] header_)
     : base(sCtrl, rCtrl, fCtrl, pCtrl, datCtrl, stCtrl, header_)
 {
     taskList = new List <ExperimentTask>();
     makeDeltaSSequence(setts);
 }