Ignore:
Timestamp:
10/20/11 17:52:22 (13 years ago)
Author:
tbretz
Message:
Debuged temperature feedback.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/feedback.cc

    r12187 r12221  
    183183                return;
    184184
    185             const double diff = (25-avg)*0.057;
     185            avg /= num;
     186
     187
     188            const float diff = (avg-25)*0.057;
    186189
    187190            vector<float> vec(2*BIAS::kNumChannels);
     
    351354                            // Kd = 0;
    352355
    353                             //                    -110 / -110 (-23 DAC / -0.51V)
    354                             // Reference voltage: -238 / -203
    355                             //                    -360 / -343 ( 23 DAC /  0.51V)
    356 
    357                             // 0.005 A/V
    358                             // 220 Amplitude / 1V
    359 
    360                             // Gain = 1V / 200 = 0.005
    361 
    362356                            // => Kp = 0.01 * gain     = 0.00005
    363357                            // => Ki = 0.8  * gain/20s = 0.00025
    364358                            // => Kd = 0.1  * gain/20s = 0.00003
    365359
    366                             //valarray<double> correction = - Kp*(PV[2] - PV[1]) + Ki * dT * (SP-PV[2]) - Kd/dT * (PV[2] - 2*PV[1] + PV[0]);
     360                            //valarray<double> correction =
     361                            // -      Kp * (PV[2] - PV[1])
     362                            // + dT * Ki * (SP    - PV[2])
     363                            // - Kd / dT * (PV[2] - 2*PV[1] + PV[0]);
     364                            //
     365                            // - (Kp+Kd/dT1) * (PV[2] - PV[1])
     366                            // + dT2 * Ki * (SP    - PV[2])
     367                            // + Kd / dT1 * (PV[1] - PV[0]);
     368                            //
     369                            // - Kp * (PV[2] - PV[1])
     370                            // + Ki * (SP    - PV[2])*dT
     371                            // - Kd * (PV[2] - PV[1])/dT
     372                            // + Kd * (PV[1] - PV[0])/dT;
     373                            //
    367374                            //valarray<double> correction =
    368375                            //    - Kp*(PV[2] - PV[1]) + Ki * T21 * (SP-PV[2]) - Kd*(PV[2]-PV[1])/T21 - Kd*(PV[0]-PV[1])/T01;
     
    373380                                 +  fKd/T10*(fPV[1]-fPV[0])
    374381                                );
     382
     383                            /*
     384                             integral = 0
     385                             start:
     386                                 integral += (fSP - fPV[2])*dt
     387
     388                                 output = Kp*(fSP - fPV[2]) + Ki*integral - Kd*(fPV[2] - fPV[1])/dt
     389
     390                                 wait(dt)
     391
     392                                 goto start
     393                             */
    375394
    376395                            vector<float> vec(2*BIAS::kNumChannels);
     
    725744            return 1;
    726745        }
     746
     747        //                    -110 / -110 (-23 DAC / -0.51V)
     748        // Reference voltage: -238 / -203
     749        //                    -360 / -343 ( 23 DAC /  0.51V)
     750
     751        // 0.005 A/V
     752        // 220 Amplitude / 1V
     753
     754        // Gain = 1V / 200 = 0.005
    727755
    728756        fGain = 5; // (BIAS)V / (DRS)V     ( 1V / 0.22V )
     
    794822void PrintHelp()
    795823{
     824    Main::PrintHelp<StateMachineFeedback>();
     825
    796826    /* Additional help text which is printed after the configuration
    797827     options goes here */
Note: See TracChangeset for help on using the changeset viewer.