예제 #1
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();
            }
        }
예제 #2
0
        private void makeDSCSequence(EFMExperimentSettingsDSC setts)
        {
            /*The procedure for a DSC run, i.e. getting the specific heat as a function of temperature for a given constant field is as follows
             * 1. Set the desired magnetic field
             * 2. Got to the starting temperature
             * 3. Wait for half a minute to make sure the stabilization criterion is not met (if the system has been completely stable it takes a few data cycles to realize a change is happening)
             * 4. Wait for stabilization
             * 5. Open separate data file
             * 6. Start the temperature ramp
             * 7. Finish experiment (close data file)
             * */


            //1. Set the required field
            SetFieldTask setField = new SetFieldTask();

            setField.field     = setts.H;
            setField.rampRate  = 0.1;//T/s
            setField.fieldCtrl = fieldCtrl;
            taskList.Add(setField);

            //2. set the starting temperature
            double Tmin   = setts.Tmin;
            double Tmax   = setts.Tmax;
            double Tstart = Tmin;

            if (setts.Tramp < 0)
            {
                Tstart = setts.Tmax;
            }
            SetTemperatureTask setT = new SetTemperatureTask();

            setT.Tset     = Tstart;
            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. open separate data file
            SeparateDatafileTask opTask = new SeparateDatafileTask();

            opTask.filename           = "dsc_Tstart_" + Tmin.ToString() + "_Tend_" + Tmax.ToString() + "_Tramp_" + setts.Tramp.ToString() + "_Happ_" + setts.H.ToString();
            experimentReadingsUpdate += opTask.readingsUpdate;
            opTask.filePath           = datasaveCtrl;
            opTask.header             = header;
            taskList.Add(opTask);

            //6. start the ramp
            SetTemperatureRampTask tRamp = new SetTemperatureRampTask();

            tRamp.Tmin         = Tmin;
            tRamp.Tmax         = Tmax;
            tRamp.Tramp        = setts.Tramp;
            tRamp.tempRampCtrl = rampCtrl;
            taskList.Add(tRamp);

            //7. finish the experiment, i.e. close the file
            ExperimentFinishedTask expF = new ExperimentFinishedTask();

            taskList.Add(expF);

            //set the descriptor text of this experiment
            experimentDescriptor = "DSC_Tmin_" + Tmin.ToString() + "_Tmax_" + Tmax.ToString() + "_Tramp_" + setts.Tramp.ToString() + "_H_" + setts.H.ToString();
        }