#ifndef __PROPERTIES #define __PROPERTIES /*********************************** defines of properties for HV channels **********************************************/ /** * Defines of status word channel */ #define CHANNEL_VOLTAGE_LIMIT 0x8000 /** Hardware voltage limit exceeded */ #define CHANNEL_CURRENT_LIMIT 0x4000 /** Hardware current limit exceeded */ #define CHANNEL_TRIP 0x2000 /** Trip exceeded */ #define CHANNEL_EXTERNAL_INHIBIT 0x1000 /** External inhibit set */ #define CHANNEL_VOLTAGE_BOUNDS 0x0800 /** Voltage bounds exceeded */ #define CHANNEL_CURRENT_BOUNDS 0x0400 /** Current bounds exceeded */ #define CHANNEL_IS_CONTROL_VOLTAGE 0x0080 /** Channel is controlled by voltage */ #define CHANNEL_IS_CONTROL_CURRENT 0x0040 /** Channel is controlled by current */ #define CHANNEL_IS_EMERGENCY_OFF 0x0020 /** Channel was shut off by EmergencyOff */ #define CHANNEL_IS_RAMPING 0x0010 /** Channel is ramping*/ #define CHANNEL_IS_ON 0x0008 /** Channel is ON */ #define CHANNEL_INPUT_ERROR 0x0004 /** Input Error */ /** * Defines of control word channel */ #define CHANNEL_SET_EMERGENCY_OFF 0x0010 /** shut off the Channel immediately */ #define CHANNEL_SET_ON 0x0008 /** Set Channel ON */ /** * Defines of module status word */ #define MODULE_SET_VALUES_WRITING 0x8000 #define MODULE_TEMPERATURE_GOOD 0x4000 /** temperature of the module good */ #define MODULE_SUPPLY_GOOD 0x2000 /** power supply good */ #define MODULE_INTERRUPT_REQUEST_ACTIVE 0x0800 /** 1: any INT Request active */ #define MODULE_SAFETY_LOOP_GOOD 0x0400 /** Interlock Loop good */ #define MODULE_NO_RAMP 0x0200 /** no ramp in none channel */ #define MODULE_NO_SUM_ERROR 0x0100 /** not any error in the module */ #define MODULE_COMMAND_COMPLETE 0x0080 /** 0: commands not completed; */ #define MODULE_CRC_GOOD 0x0010 /** Flash Memory CRC ok */ /* The HV channel items */ typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 rsv1: 2; uw16 IERR: 1; //Input Error uw16 isON: 1; //is On uw16 isRAMP: 1; //is Ramp uw16 isEMCY: 1; //is Emcy off uw16 isCC: 1; //HW-I-Control (Regulation) uw16 isCV: 1; //WW-V Control (Regulation) uw16 rsv2: 2; //Stromschlauch obere Grenze überschritten uw16 isCBNDs: 1; //Spannungsschlauch untere Grenze unterschritten uw16 isVBNDs: 1; //Spannungsschlauch obere Grenze überschritten uw16 isEINH: 1; //Externes Hardware INHIBIT uw16 isTRIP: 1; //Trip uw16 isCLIM: 1; //HW-ILimit uw16 isVLIM: 1; //HW-VLimit } Bit; } TEdcpChStatus; typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 errCTRP: 1; //Current Trip uw16 sumErr: 1; uw16 rsv1: 7; uw16 IERR: 1; //Input Error uw16 ON: 1; //On uw16 isRAMP: 1; //is Ramp uw16 EMCY: 1; //Emcy off uw16 enaKil: 1; //enable Kill uw16 errCLIM: 1; //HW-ILimit uw16 errVLIM: 1; //HW-VLimit } Bit; } TDcpChStatus; typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 rsv1: 3; uw16 setON: 1; uw16 rsv2: 1; uw16 setEMCY: 1; uw16 rsv3: 10; } Bit; }TEdcpChControl; typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 res1: 2; uw16 EIERR: 1; //Event Eingabefehler uw16 EON2OFF: 1; //Event on to off uw16 EEOR: 1; //Event end of ramping uw16 EEMCY: 1; //Event Emergency off uw16 ECC: 1; //Event contolled by current uw16 ECV: 1; //Event contolled by voltage uw16 res3: 2; uw16 ECBNDs: 1; //Event Stromschlauch Grenze unterschritten uw16 EVBNDs: 1; //Event Spannungsschlauchgrenze überschritten uw16 EEINH: 1; //Event Externes Hardware INHIBIT uw16 ETRIP: 1; //Event Trip uw16 ECLIM: 1; //Event HW-ILimit uw16 EVLIM: 1; //Event HW-VLimit } Bit; }TEdcpChEventStatus; //Event Status typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 res1: 2; uw16 MEIERR: 1; //MaskEvent Eingabefehler uw16 MEON2OFF: 1; //MaskEvent on to off uw16 MEEOR: 1; //MaskEvent end of ramping uw16 res2: 1; uw16 MECC: 1; //MaskEvent contolled by current uw16 MECV: 1; //MaskEvent contolled by voltage uw16 res3: 2; uw16 MECBNDs: 1; //MaskEvent Stromschlauch Grenze unterschritten uw16 MEVBNDs: 1; //MaskEvent Spannungsschlauchgrenze überschritten uw16 MEEINH: 1; //MaskEvent Externes Hardware INHIBIT uw16 METRIP: 1; //MaskEvent Trip uw16 MECLIM: 1; //MaskEvent HW-ILimit uw16 MEVLIM: 1; //MaskEvent HW-VLimit } Bit; }TChEventMask; typedef struct { /* item Vset */ float Vset; // value of the set voltage float Vmeas; // value of the measured voltage float Vnominal; // value of nominal voltage float Vbnds; // value for the delta voltage from the set voltage float Iset; // value of the set or trip current (depending from the HV hardware) float Imeas; // value of the measured current float INominal; // value of nominal current float Ibnds; // value for the delta current from the set current TEdcpChStatus Status; //momentan Status TEdcpChControl Control; TEdcpChEventStatus EventStatus; //Ereignis Status TChEventMask EventMask; //Ereignis Maske union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 bRest1: 9; uw16 bIIERR: 1; // interrupt Eingabefehler uw16 bICBND: 1; // interrupt Stromschlauch Grenze unterschritten uw16 bIVBND: 1; // interrupt Spannungsschlauchgrenze überschritten uw16 bIEINH: 1; // interrupt Externes Hardware INHIBIT uw16 bICTRP: 1; // interrupt Current Trip uw16 bICLIM: 1; // interrupt hardware I limit uw16 bIVLIM: 1; // interrupt hardware V limit } Bit; }intStatus; //Interrupt Status union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 bRest1: 9; uw16 bMIIERR: 1; // mask interrupt input error uw16 bMICBND: 1; // mask interrupt current slot exceeded uw16 bMIVBND: 1; // mask interrupt voltage slot exceeded uw16 bMIEINH: 1; // mask interrupt externes Hardware INHIBIT uw16 bMICTRP: 1; // mask interrupt current trip uw16 bMICLIM: 1; // mask interrupt hardware I limit uw16 bMIVLIM: 1; // mask interrupt hardware V limit } Bit; }intMask; //Interrupt Maske } THV_Items; /*********************************** defines of properties for HV modules **********************************************/ /** * Defines of module control word */ #define MODULE_SAVE_SET_VALUES 0x8000 /** 1 = store all currently set values*/ #define MODULE_KILL_ENABLE 0x4000 /** 1 = set enable kill, 0 set disabel kill */ #define MODULE_ADJUSTMENT 0x1000 /** 1 = set fine adjustment on, 0 = set fine adjustment off */ #define MODULE_BIG_ENDIAN 0x0800 /** 1 = Big-Endian, 0 = Little-Endian */ #define MODULE_INTERRUPT_LEVEL2 0x0400 /** InterruptLevel 1..7; 0 => Interrupt disable */ #define MODULE_INTERRUPT_LEVEL1 0x0200 #define MODULE_INTERRUPT_LEVEL0 0x0100 #define MODULE_CLEAR_KILL 0x0040 /** set ClearKill*/ #define MODULE_BANK_SELECT2 0x0004 /** see defines VME Bank select*/ #define MODULE_BANK_SELECT1 0x0002 /** see defines VME Bank select*/ #define MODULE_BANK_SELECT0 0x0001 /** see defines VME Bank select*/ typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { // 0 1 uw16 isADJ: 1; uw16 rsv0: 1; uw16 isLVINS: 1; uw16 rsv1: 1; // uw16 ndSrvc: 1; // uw16 isHwVLIMgd: 1; uw16 isIERR: 1; // no Input Error Input Error uw16 isCMDcpl: 1; // Command not compl. Command complete uw16 isnoSERR: 1; // sum error no sum error over all error flags uw16 isnoRAMP: 1; // a voltage ramp is running no voltage ramp is running at least one of the channels uw16 isSFLPgd: 1; // open closed uw16 isEVNTact: 1; uw16 isMODgd: 1; // Module not good Module good uw16 isSPLYgd: 1; // one of the supples is wrong all supplies are in correct state uw16 isTMPgd: 1; // uw16 isKILLena: 1; // / store of all currently set values } Bit; } TEdcpMdStatus; typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 rsv1: 6; uw16 doCLEAR: 1; uw16 rsv2: 1; uw16 ILVL: 3; // VME Interupt Level uw16 setENDN: 1; // low endian big uw16 setADJ: 1; // nein Feinjustierung ja uw16 rsv3: 1; uw16 setKILENA: 1; // disable enable uw16 doSaveSetVal: 1; // / starte Aufzeichnung aller set values } Bit; } TEdcpMdControl; typedef union { uw16 Word; struct {uw8 High, Low; } Byte; struct { // 0 1 uw16 rsv1: 2; // uw16 ELVINS: 1; uw16 rsv2: 1; uw16 ESrvc: 1; uw16 EHwVLIMngd: 1; uw16 EIERR: 1; // no Input Error Input Error uw16 rsv3: 2; // uw16 ERAMP: 1; // a voltage ramp is running no voltage ramp is running at least one of the channels uw16 ESFLPngd: 1; // open closed uw16 res4: 1; uw16 EMODngd: 1; // Module not good Module good uw16 ESPLYngd: 1; // one of the supples is wrong all supplies are in correct state uw16 ETMPngd: 1; // uw16 res5: 1; // } Bit; } TEdcpMdEventStatus; typedef struct { TEdcpMdStatus Status; TEdcpMdControl Control; float VRampSpeed; float VIRampSpeed; float ErrStatBound; struct { float p24V; //Versorgungssp. +24V float p1215V; //Versorgungssp. +12V od. +15V float p5V; //Versorgungssp. +5V float n1215V; //Versorgungssp. -12V od. -15V float n5V; //Versorgungssp. -5V } Vcc; struct { float V; float I; } Limit; float Temp; //Modultemperatur aktuelle Messung } THV_Module; typedef union { uw32 LWord; struct {uw16 High, Low; } Word; struct {uw8 Data_4, DATA_3, DATA_2, DATA_1;} Byte; struct { uw32 DCAN: 1; uw32 RS232: 1; uw32 IEEE: 1; uw32 ETH: 1; uw32 AIF: 1; uw32 EHQN12:1; uw32 EHQPCI:1; uw32 res1: 9; // 0 1 uw32 rsv2: 5; uw32 FRAMP: 1; uw32 RELAY: 1; uw32 INHIBIT: 1; uw32 VLIM: 1; uw32 CLIM: 1; uw32 HVBpM: 1; // uw32 rsv3: 4; uw32 EDCP: 1; // DCP EDCP } Bit; } TEdcpModOption; /*********************************** defines of properties for HV groups **********************************************/ /** * Defines and structures of groups */ #define GROUP_TYPE_SET 0 #define GROUP_TYPE_STATUS 1 #define GROUP_TYPE_MONITORING 2 #define GROUP_TYPE_TIMEOUT 3 #define GROUP_ACTION_NOACTION 0 #define GROUP_ACTION_RAMPDOWN 1 #define GROUP_ACTION_SWITCHOFFGROUP 2 #define GROUP_ACTION_SWITCHOFFMODULE 3 #define GROUP_STATUS_ON 3 #define GROUP_STATUS_RAMP 4 #define GROUP_STATUS_CURRENTCONTROL 6 #define GROUP_STATUS_VOLTAGECONTROL 7 #define GROUP_STATUS_CURRENTBOUNDS 10 #define GROUP_STATUS_VOLTAGEBOUNDS 11 #define GROUP_STATUS_EXTERNALINHIBIT 12 #define GROUP_STATUS_TRIP 13 #define GROUP_STATUS_CURRENTLIMIT 14 #define GROUP_STATUS_VOLTAGELIMIT 15 #define GROUP_MONITOR_ON 3 #define GROUP_MONITOR_RAMP 4 #define GROUP_MONITOR_CONTROLLED_CURRENT 6 #define GROUP_MONITOR_CONTROLLED_VOLTAGE 7 #define GROUP_MONITOR_CURRENTBOUNDS 10 #define GROUP_MONITOR_VOLTAGEBOUNDS 11 #define GROUP_MONITOR_EXTERNALINHIBIT 12 #define GROUP_MONITOR_TRIP 13 #define GROUP_MONITOR_CURRENTLIMIT 14 #define GROUP_MONITOR_VOLTAGELIMIT 15 #define GROUP_CONTROL_SET_VOLTAGE 1 #define GROUP_CONTROL_SET_CURRENT 2 #define GROUP_CONTROL_SET_VOLTAGEBOUNDS 4 #define GROUP_CONTROL_SET_CURRENTBOUNDS 5 #define GROUP_CONTROL_SET_ON 10 #define GROUP_CONTROL_SET_EMERGENCYOFF 11 typedef struct { uw16 MmbrLst; union { uw16 Word; struct {uw8 High, Low; } Byte; struct { uw16 Master_Channel: 4; uw16 Check_Set_Monitor: 4; uw16 Mode: 1; uw16 reserve: 3; uw16 Action: 2; uw16 Type: 2; } Bit; } TypeMstr; } THV_Group; #endif