Changeset 10029 for trunk/Cosy
- Timestamp:
- 10/21/10 16:15:22 (14 years ago)
- Location:
- trunk/Cosy/devdrv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosy/devdrv/dkc.cc
r9443 r10029 30 30 { 31 31 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"; 49 49 //case 0xa146: return "Drive controlled interpolated relative positioning with encoder 1"; 50 50 //case 0xa147: return "Drive controlled interpolated relative positioning with encoder 2"; 51 51 //case 0xa148: return "Drive controlled interpolated relative positioning lagless with encoder 1"; 52 52 //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"; 62 62 case 0xc217: return "Motor encoder reading error"; 63 63 case 0xc218: return "Shaft encoder reading error"; … … 65 65 case 0xc221: return "Shaft encoder initialization error"; 66 66 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"; 71 71 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"; 73 73 case 0xe250: return "Drive overtemp warning"; 74 74 case 0xe251: return "Motor overtemp warning"; … … 76 76 case 0xe257: return "Continous current limit active"; 77 77 case 0xe259: return "Command velocity limit active"; 78 case 0xe8260: return "Torque limit active"; 78 79 case 0xe264: return "Target position out of numerical range"; 79 80 case 0xe829: return "Positive position limit exceeded"; … … 84 85 case 0xe843: return "Positive end-switch activated"; 85 86 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"; 88 89 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"; 90 92 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"; 92 95 case 0xf250: return "Overflow of target position preset memory"; 93 96 case 0xf269: return "Error during release of the motor holding brake"; 94 97 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"; 96 100 case 0xf434: return "Emergency-Stop"; 97 101 case 0xf629: return "Positive position limit exceeded"; … … 100 104 case 0xf643: return "Positive end-switch activated"; 101 105 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"; 104 111 } 105 112 return "unknown"; … … 108 115 TString Dkc::GetStatus(LWORD_t val) const 109 116 { 110 const Int_t errnum = val&0xff ff;111 const Int_t errinf = val>> 16;117 const Int_t errnum = val&0xff; 118 const Int_t errinf = val>>8; 112 119 113 120 if (errnum!=0xff) … … 120 127 TString str; 121 128 122 const Int_t type = errinf&0xf000;129 const Int_t type = (errinf&0xf0000)==0 ? ((errinf>>12)&0xf) : ((errinf>>16)&0xf); 123 130 switch (type) 124 131 { 125 case 0xf 000: str += "ERROR"; break;126 case 0xe 000: str += "WARNING"; break;127 case 0xa 000: str += "Status"; break;128 case 0xc 000:129 case 0xd 000: str += "Message"; break;130 default: 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; 131 138 } 132 139 … … 135 142 str += "): "; 136 143 str += EvalStatusDKC(errinf); 137 str += (type==0xf 000 || type==0xe000? "!" : ".");144 str += (type==0xf || type==0xe ? "!" : "."); 138 145 139 146 return str; … … 142 149 Bool_t Dkc::PrintStatus(LWORD_t val) const 143 150 { 144 const Int_t errnum = val&0xff ff;145 const Int_t errinf = val>> 16;151 const Int_t errnum = val&0xff; 152 const Int_t errinf = val>>8; 146 153 147 154 if (errnum!=0xff) … … 151 158 152 159 // 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; 154 162 } 155 163 … … 356 364 Arm(); 357 365 #endif 358 359 366 gLog << inf2 << "- " << GetNodeName() << ": Checking armed status." << endl; 360 367 RequestSDO(0x1000); … … 529 536 } 530 537 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 "; 550 564 gLog << endl; 551 565 552 fStatusPdo3 = data[0];566 fStatusPdo3 = stat; 553 567 } 554 568 } … … 570 584 571 585 // 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) 573 588 { 574 589 CheckErrorDKC(errnum, errinf); -
trunk/Cosy/devdrv/dkc.h
r9443 r10029 33 33 BYTE_t fStatus; 34 34 LWORD_t fStatusDKC; 35 BYTE_t fStatusPdo3;35 WORD_t fStatusPdo3; 36 36 37 37 bool fHasChangedPos1; //! … … 52 52 Bool_t EvalStatus(UInt_t errnum, UInt_t errinf) const 53 53 { 54 return PrintStatus(errnum|(errinf<< 16));54 return PrintStatus(errnum|(errinf<<8)); 55 55 } 56 56 TString GetStatus(LWORD_t val) const; … … 58 58 void CheckErrorDKC(UInt_t errnum, UInt_t errinf) 59 59 { 60 CheckErrorDKC(errnum|(errinf<< 16));60 CheckErrorDKC(errnum|(errinf<<8)); 61 61 } 62 62 … … 107 107 108 108 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; } 111 111 112 112 LWORDS_t GetPdoPos1() const { return fPdoPos1; } … … 119 119 LWORD_t GetPosRes() const { return fPosRes; } // Velocity units (would be 100 for %) 120 120 121 bool IsOperative() const { return fStatusPdo3==0xef; }121 bool IsOperative() const { return (fStatusPdo3&0xff)==0xef; } 122 122 bool IsRpmActive() const { return fRpmActive; } 123 123
Note:
See TracChangeset
for help on using the changeset viewer.