Changeset 12160 for trunk/FACT++/src


Ignore:
Timestamp:
10/02/11 13:28:28 (14 years ago)
Author:
tbretz
Message:
Added PixelMap.cc to fact_SOURCES
Location:
trunk/FACT++/src
Files:
5 edited

Legend:

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

    r12148 r12160  
    4444    fFile.AddColumn('C', "Errors",              4);
    4545    fFile.AddColumn('I', "SoftTrig");
    46     fFile.AddColumn('I', "PCTime",              2);
     46    fFile.AddColumn('I', "UnixTimeUTC",         2);
    4747    fFile.AddColumn('I', "BoardTime",           NBOARDS);
    4848    fFile.AddColumn('S', "StartCellData",       NPIX);
  • trunk/FACT++/src/PixelMap.h

    r12151 r12160  
    3131    int group() const { return pixel()>4; }
    3232    int hv() const    { return hv_channel+hv_board*32; }
     33
     34    operator bool() const { return index>=0; }
    3335};
    3436
     
    181183};
    182184
    183 //const PixelMapEntry PixelMap::empty = { 0, 0, 0, 0, 0, 0 };
    184 
    185185#endif
  • trunk/FACT++/src/feedback.cc

    r12067 r12160  
    301301                            // Kd = 0;
    302302
    303                             //                    -110 / -110 (-23 DAC / -0.51V)
    304                             // Reference voltage: -238 / -203
    305                             //                    -360 / -343 ( 23 DAC /  0.51V)
    306 
    307                             // 0.005 A/V
    308                             // 220 Amplitude / 1V
    309 
    310                             // Gain = 1V / 200 = 0.005
    311 
    312303                            // => Kp = 0.01 * gain     = 0.00005
    313304                            // => Ki = 0.8  * gain/20s = 0.00025
    314305                            // => Kd = 0.1  * gain/20s = 0.00003
    315306
    316                             //valarray<double> correction = - Kp*(PV[2] - PV[1]) + Ki * dT * (SP-PV[2]) - Kd/dT * (PV[2] - 2*PV[1] + PV[0]);
     307                            //valarray<double> correction =
     308                            // -      Kp * (PV[2] - PV[1])
     309                            // + dT * Ki * (SP    - PV[2])
     310                            // - Kd / dT * (PV[2] - 2*PV[1] + PV[0]);
     311                            //
     312                            // - (Kp+Kd/dT1) * (PV[2] - PV[1])
     313                            // + dT2 * Ki * (SP    - PV[2])
     314                            // + Kd / dT1 * (PV[1] - PV[0]);
     315                            //
     316                            // - Kp * (PV[2] - PV[1])
     317                            // + Ki * (SP    - PV[2])*dT
     318                            // - Kd * (PV[2] - PV[1])/dT
     319                            // + Kd * (PV[1] - PV[0])/dT;
     320                            //
    317321                            //valarray<double> correction =
    318322                            //    - Kp*(PV[2] - PV[1]) + Ki * T21 * (SP-PV[2]) - Kd*(PV[2]-PV[1])/T21 - Kd*(PV[0]-PV[1])/T01;
     
    324328                                );
    325329
     330                            /*
     331                             integral = 0
     332                             start:
     333                                 integral += (fSP - fPV[2])*dt
     334
     335                                 output = Kp*(fSP - fPV[2]) + Ki*integral - Kd*(fPV[2] - fPV[1])/dt
     336
     337                                 wait(dt)
     338
     339                                 goto start
     340                             */
     341
    326342                            vector<float> vec(2*BIAS::kNumChannels);
    327343                            for (int i=0; i<BIAS::kNumChannels; i++)
     
    337353                                Info("Sending correction to feedback.");
    338354
    339                                 dic_cmnd_service((char*)"BIAS_CONTROL/ADD_REFERENCE_VOLTAGES",
    340                                                  (void*)(vec.data()+416), 416*sizeof(float));
     355                                DimClient::sendCommandNB("BIAS_CONTROL/ADD_REFERENCE_VOLTAGES",
     356                                                         (void*)(vec.data()+416), 416*sizeof(float));
    341357
    342358                                /*
     
    607623            return 1;
    608624        }
     625
     626        //                    -110 / -110 (-23 DAC / -0.51V)
     627        // Reference voltage: -238 / -203
     628        //                    -360 / -343 ( 23 DAC /  0.51V)
     629
     630        // 0.005 A/V
     631        // 220 Amplitude / 1V
     632
     633        // Gain = 1V / 200 = 0.005
    609634
    610635        fGain = 5; // (BIAS)V / (DRS)V     ( 1V / 0.22V )
     
    676701void PrintHelp()
    677702{
     703    Main::PrintHelp<StateMachineFeedback>();
     704
    678705    /* Additional help text which is printed after the configuration
    679706     options goes here */
  • trunk/FACT++/src/tools.cc

    r11229 r12160  
    7373    return str.substr(start, end-start+1);
    7474}
     75
     76// --------------------------------------------------------------------------
     77//
     78//! This is a static helper to remove leading and trailing whitespaces.
     79//!
     80//! Usage example:
     81//!
     82//! \code
     83//!    string str = "     Dies ist ein test fuer einen ganz     langen Satz "
     84//!        "und ob er korrekt umgebrochen und formatiert wird. Alles "
     85//!        "nur ein simpler test aber trotzdem ganz wichtig.";
     86//!
     87//!    cout << setfill('-') << setw(40) << "+" << endl;
     88//!    while (1)
     89//!    {
     90//!        const string rc = Tools::Wrap(str, 40);
     91//!        if (rc.empty())
     92//!            break;
     93//!        cout << rc << endl;
     94//!    }
     95//! \endcode
     96//!
     97string Tools::Wrap(string &str, size_t width)
     98{
     99    const size_t pos = str.length()<width ? string::npos : str.find_last_of(' ', width);
     100    if (pos==string::npos)
     101    {
     102        const string rc = str;
     103        str = "";
     104        return rc;
     105    }
     106
     107    const size_t indent = str.find_first_not_of(' ');
     108
     109    const string rc = str.substr(0, pos);
     110    const size_t p2 = str.find_first_not_of(' ', pos+1);
     111
     112    str = str.substr(0, indent) + str.substr(p2==string::npos ? pos+1 : p2);
     113
     114    return rc;
     115}
  • trunk/FACT++/src/tools.h

    r11229 r12160  
     1#ifndef FACT_Tools
     2#define FACT_Tools
     3
    14#include <string>
    25
     
    69    std::string Form(const char *fmt, ...);
    710    std::string Trim(const std::string &str);
     11    std::string Wrap(std::string &str, size_t width=78);
    812}
     13
     14#endif
Note: See TracChangeset for help on using the changeset viewer.