Changeset 10029 for trunk/Cosy


Ignore:
Timestamp:
10/21/10 16:15:22 (14 years ago)
Author:
tbretz
Message:
Added handling of the IndraDrive error codes.
Location:
trunk/Cosy/devdrv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosy/devdrv/dkc.cc

    r9443 r10029  
    3030    {
    3131    case 0: return "offline";
    32     case 0xa000:
    33     case 0xa001:
    34     case 0xa002:
    35     case 0xa003: return MString::Format("Communication phase %d", stat&0xf);
    36     case 0xa010: return "Drive HALT";
    37     case 0xa012: return "Control and power section ready for operation";
    38     case 0xa013: return "Ready for power on";
    39     case 0xa100: return "Drive in Torque mode";
    40     case 0xa101: return "Drive in Velocity mode";
    41     case 0xa102: return "Position control mode with encoder 1";
    42     case 0xa103: return "Position control mode with encoder 2";
    43     case 0xa104: return "Position control mode with encoder 1, lagless";
    44     case 0xa105: return "Position control mode with encoder 2, lagless";
    45     case 0xa106: return "Drive controlled interpolated positioning with encoder 1";
    46     case 0xa107: return "Drive controlled interpolated positioning with encoder 2";
    47     case 0xa108: return "Drive controlled interpolated positioning with encoder 1, lagless";
    48     case 0xa109: return "Drive controlled interpolated positioning with encoder 2, lagless";
     32    case 0xa000: case 0xa0000:
     33    case 0xa001: case 0xa0001:
     34    case 0xa002: case 0xa0002:
     35    case 0xa003: case 0xa0003: return MString::Format("Communication phase %d", stat&0xf);
     36    case 0xa010: case 0xa0010: return "Drive HALT";
     37    case 0xa012: case 0xa0012: return "Control and power section ready for operation";
     38    case 0xa013: case 0xa0013: return "Ready for power on";
     39    case 0xa100: case 0xa0100: return "Drive in Torque mode";
     40    case 0xa101: case 0xa0101: return "Drive in Velocity mode";
     41    case 0xa102: case 0xa0102: return "Position control mode with encoder 1";
     42    case 0xa103: case 0xa0103: return "Position control mode with encoder 2";
     43    case 0xa104: case 0xa0104: return "Position control mode with encoder 1, lagless";
     44    case 0xa105: case 0xa0105: return "Position control mode with encoder 2, lagless";
     45    case 0xa106: case 0xa0106: return "Drive controlled interpolated positioning with encoder 1";
     46    case 0xa107: case 0xa0107: return "Drive controlled interpolated positioning with encoder 2";
     47    case 0xa108: case 0xa0108: return "Drive controlled interpolated positioning with encoder 1, lagless";
     48    case 0xa109: case 0xa0109: return "Drive controlled interpolated positioning with encoder 2, lagless";
    4949    //case 0xa146: return "Drive controlled interpolated relative positioning with encoder 1";
    5050    //case 0xa147: return "Drive controlled interpolated relative positioning with encoder 2";
    5151    //case 0xa148: return "Drive controlled interpolated relative positioning lagless with encoder 1";
    5252    //case 0xa149: return "Drive controlled interpolated relative positioning lagless with encoder 2";
    53     case 0xa150: return "Drive controlled positioning with encoder 1";
    54     case 0xa151: return "Drive controlled positioning with encoder 1, lagless";
    55     case 0xa152: return "Drive controlled positioning with encoder 2";
    56     case 0xa153: return "Drive controlled positioning with encoder 2, lagless";
    57     case 0xa208: return "Jog mode positive";
    58     case 0xa218: return "Jog mode negative";
    59     case 0xa400: return "Automatic drive check and adjustment";
    60     case 0xa401: return "Drive decelerating to standstill";
    61     case 0xa800: return "Unknown operation mode";
     53    case 0xa150: case 0xa0150: return "Drive controlled positioning with encoder 1";
     54    case 0xa151: case 0xa0151: return "Drive controlled positioning with encoder 1, lagless";
     55    case 0xa152: case 0xa0152: return "Drive controlled positioning with encoder 2";
     56    case 0xa153: case 0xa0153: return "Drive controlled positioning with encoder 2, lagless";
     57    case 0xa208:               return "Jog mode positive";
     58    case 0xa218:               return "Jog mode negative";
     59    case 0xa400: case 0xa4000: return "Automatic drive check and adjustment";
     60    case 0xa401: case 0xa4001: return "Drive decelerating to standstill";
     61    case 0xa800: case 0xa0800: return "Unknown operation mode";
    6262    case 0xc217: return "Motor encoder reading error";
    6363    case 0xc218: return "Shaft encoder reading error";
     
    6565    case 0xc221: return "Shaft encoder initialization error";
    6666    case 0xc300: return "Command: set absolute measure";
    67     case 0xc400: return "Switching to parameter mode";
    68     case 0xc401: return "Drive active, switching mode not allowed";
    69     case 0xc500: return "Error reset";
    70     case 0xc600: return "Drive controlled homi*ng procedure ";
     67    case 0xc400: case 0xc0400: return "Switching to parameter mode";
     68    case 0xc401: case 0xc0401: return "Drive active, switching mode not allowed";
     69    case 0xc500: case 0xc0500: return "Error reset";
     70    case 0xc600: case 0xc0600: return "Drive controlled homing procedure";
    7171    case 0xe225: return "Motor overload";
    72     case 0xe249: return "Positioning command velocity exceeds limit bipolar";
     72    case 0xe249: case 0xe2049: return "Positioning command velocity exceeds limit bipolar";
    7373    case 0xe250: return "Drive overtemp warning";
    7474    case 0xe251: return "Motor overtemp warning";
     
    7676    case 0xe257: return "Continous current limit active";
    7777    case 0xe259: return "Command velocity limit active";
     78                 case 0xe8260: return "Torque limit active";
    7879    case 0xe264: return "Target position out of numerical range";
    7980    case 0xe829: return "Positive position limit exceeded";
     
    8485    case 0xe843: return "Positive end-switch activated";
    8586    case 0xe844: return "Negative end-switch activated";
    86     case 0xf218: return "Amplifier overtemp shutdown";
    87     case 0xf219: return "Motor overtemp shutdown";
     87    case 0xf218: case 0xf2018: return "Amplifier overtemp shutdown";
     88    case 0xf219: case 0xf2019: return "Motor overtemp shutdown";
    8889    case 0xf220: return "Bleeder overload shutdown";
    89     case 0xf221: return "Motor temperature surveillance defective";
     90    case 0xf221: case 0xf2021: return "Motor temperature surveillance defective";
     91                 case 0xf2022: return "Unit temperature surveillance defective";
    9092    case 0xf224: return "Maximum breaking time exceeded";
    91     case 0xf228: return "Excessive control deviation";
     93                 case 0xf2025: return "Drive not ready for power on";
     94    case 0xf228: case 0xf2028: return "Excessive control deviation";
    9295    case 0xf250: return "Overflow of target position preset memory";
    9396    case 0xf269: return "Error during release of the motor holding brake";
    9497    case 0xf276: return "Absolute encoder out of allowed window";
    95     case 0xf409: return "Bus error on Profibus interface";
     98                 case 0xf2174: return "Lost reference of motor encoder";
     99    case 0xf409: case 0xf4009: return "Bus error on Profibus interface";
    96100    case 0xf434: return "Emergency-Stop";
    97101    case 0xf629: return "Positive position limit exceeded";
     
    100104    case 0xf643: return "Positive end-switch activated";
    101105    case 0xf644: return "Negative end-switch activated";
    102     case 0xf870: return "24V DC error";
    103     case 0xf878: return "Velocity loop error";
     106                 case 0xf8069: return "15V DC error";
     107    case 0xf870: case 0xf8070: return "24V DC error";
     108    case 0xf878: case 0xf8078: return "Velocity loop error";
     109                 case 0xf8079: return "Velocity limit exceeded";
     110                 case 0xf2026: return "Undervoltage in power section";
    104111    }
    105112    return "unknown";
     
    108115TString Dkc::GetStatus(LWORD_t val) const
    109116{
    110     const Int_t errnum = val&0xffff;
    111     const Int_t errinf = val>>16;
     117    const Int_t errnum = val&0xff;
     118    const Int_t errinf = val>>8;
    112119
    113120    if (errnum!=0xff)
     
    120127    TString str;
    121128
    122     const Int_t type = errinf&0xf000;
     129    const Int_t type = (errinf&0xf0000)==0 ? ((errinf>>12)&0xf) : ((errinf>>16)&0xf);
    123130    switch (type)
    124131    {
    125     case 0xf000: str += "ERROR";   break;
    126     case 0xe000: str += "WARNING"; break;
    127     case 0xa000: str += "Status";  break;
    128     case 0xc000:
    129     case 0xd000: str += "Message"; break;
    130     default:     str += "Unknown"; break;
     132    case 0xf: str += "ERROR";   break;
     133    case 0xe: str += "WARNING"; break;
     134    case 0xa: str += "Status";  break;
     135    case 0xc:
     136    case 0xd: str += "Message"; break;
     137    default:  str += "Unknown"; break;
    131138    }
    132139
     
    135142    str += "): ";
    136143    str += EvalStatusDKC(errinf);
    137     str += (type==0xf000 || type==0xe000 ? "!" : ".");
     144    str += (type==0xf || type==0xe ? "!" : ".");
    138145
    139146    return str;
     
    142149Bool_t Dkc::PrintStatus(LWORD_t val) const
    143150{
    144     const Int_t errnum = val&0xffff;
    145     const Int_t errinf = val>>16;
     151    const Int_t errnum = val&0xff;
     152    const Int_t errinf = val>>8;
    146153
    147154    if (errnum!=0xff)
     
    151158
    152159    // errinf==0: DKC offline. This is a fatal error
    153     return errinf==0 ? kFALSE : (errinf&0xf000)!=0xf000;
     160    const Int_t type = (errinf&0xf0000)==0 ? ((errinf>>12)&0xf) : ((errinf>>16)&0xf);
     161    return errinf==0 ? kFALSE : (type&0xf)!=0xf;
    154162}
    155163
     
    356364    Arm();
    357365#endif
    358 
    359366    gLog << inf2 << "- " << GetNodeName() << ": Checking armed status." << endl;
    360367    RequestSDO(0x1000);
     
    529536    }
    530537
    531     if (fStatusPdo3!=data[0])
    532     {
    533         gLog << inf << MTime(-1) << ": " << GetNodeName() << " - PDO1 = ";
    534         const Bool_t ready = data[0]&0x01;
    535         const Bool_t fuse  = data[0]&0x02;
    536         const Bool_t emcy  = data[0]&0x04;
    537         const Bool_t vltg  = data[0]&0x08;
    538         const Bool_t mode  = data[0]&0x10;
    539         const Bool_t rf    = data[0]&0x20;
    540         const Bool_t brake = data[0]&0x40;
    541         const Bool_t power = data[0]&0x80;
    542         if (ready) gLog << "DKC-Ready ";
    543         if (fuse)  gLog << "FuseOk ";
    544         if (emcy)  gLog << "EmcyOk ";
    545         if (vltg)  gLog << "OvervoltOk ";
    546         if (mode)  gLog << "SwitchToManualMode ";
    547         if (rf)    gLog << "RF ";
    548         if (brake) gLog << "BrakeOpen ";
    549         if (power) gLog << "PowerOn ";
     538    const LWORD_t stat = data[0] | (data[1]<<8);
     539    if (fStatusPdo3!=stat)
     540    {
     541        gLog << inf << MTime(-1) << ": " << GetNodeName() << " - PDO2(0x" << hex << (int)stat << dec << ") = ";
     542        const Bool_t ready  = stat&0x001;
     543        const Bool_t fuse   = stat&0x002;
     544        const Bool_t emcy   = stat&0x004;
     545        const Bool_t vltg   = stat&0x008;
     546        const Bool_t mode   = stat&0x010;
     547        const Bool_t rf     = stat&0x020;
     548        const Bool_t brake  = stat&0x040;
     549        const Bool_t power  = stat&0x080;
     550        const Bool_t alarm  = stat&0x100;  // UPS Alarm      (FACT only)
     551        const Bool_t batt   = stat&0x200;  // UPS on battery (FACT only)
     552        const Bool_t charge = stat&0x400;  // UPS charging   (FACT only)
     553        if (ready)  gLog << "DKC-Ready ";
     554        if (fuse)   gLog << "FuseOk ";
     555        if (emcy)   gLog << "EmcyOk ";
     556        if (vltg)   gLog << "OvervoltOk ";
     557        if (mode)   gLog << "SwitchToManualMode ";
     558        if (rf)     gLog << "RF ";
     559        if (brake)  gLog << "BrakeOpen ";
     560        if (power)  gLog << "PowerOn ";
     561        if (alarm)  gLog << "UPS-PowerLoss ";
     562        if (batt)   gLog << "UPS-OnBattery ";
     563        if (charge) gLog << "UPS-Charging ";
    550564        gLog << endl;
    551565
    552         fStatusPdo3 = data[0];
     566        fStatusPdo3 = stat;
    553567    }
    554568}
     
    570584
    571585    // Check if the DKC changed its status message
    572     if (errnum==0xff && (errinf&0xf000)<=0xe000)
     586    const Int_t type = (errinf&0xf0000)==0 ? ((errinf>>12)&0xf) : ((errinf>>16)&0xf);
     587    if (errnum==0xff && (type&0xf)<=0xe)
    573588    {
    574589        CheckErrorDKC(errnum, errinf);
  • trunk/Cosy/devdrv/dkc.h

    r9443 r10029  
    3333    BYTE_t   fStatus;
    3434    LWORD_t  fStatusDKC;
    35     BYTE_t   fStatusPdo3;
     35    WORD_t   fStatusPdo3;
    3636
    3737    bool fHasChangedPos1;  //!
     
    5252    Bool_t  EvalStatus(UInt_t errnum, UInt_t errinf) const
    5353    {
    54         return PrintStatus(errnum|(errinf<<16));
     54        return PrintStatus(errnum|(errinf<<8));
    5555    }
    5656    TString GetStatus(LWORD_t val) const;
     
    5858    void CheckErrorDKC(UInt_t errnum, UInt_t errinf)
    5959    {
    60         CheckErrorDKC(errnum|(errinf<<16));
     60        CheckErrorDKC(errnum|(errinf<<8));
    6161    }
    6262
     
    107107
    108108    int IsPositioning() const { return fPosActive; }
    109     BYTE_t GetStatus() const { return fStatus; }
    110     BYTE_t GetStatusPdo3() const { return fStatusPdo3; }
     109    BYTE_t  GetStatus() const { return fStatus; }
     110    LWORD_t GetStatusPdo3() const { return fStatusPdo3; }
    111111
    112112    LWORDS_t GetPdoPos1() const { return fPdoPos1; }
     
    119119    LWORD_t  GetPosRes() const { return fPosRes; } // Velocity units (would be 100 for %)
    120120
    121     bool IsOperative() const { return fStatusPdo3==0xef; }
     121    bool IsOperative() const { return (fStatusPdo3&0xff)==0xef; }
    122122    bool IsRpmActive() const { return fRpmActive; }
    123123
Note: See TracChangeset for help on using the changeset viewer.