Commit 40aab67500064243e9f3dcddfedbdef82d2c3808
1 parent
b383042b0b
Exists in
master
add pt100 sensor in VAL_TYPE
Showing 1 changed file with 12 additions and 3 deletions Side-by-side Diff
instruments/T7Pro.py
| ... | ... | @@ -4,11 +4,12 @@ |
| 4 | 4 | |
| 5 | 5 | #============================================================================== |
| 6 | 6 | |
| 7 | -ALL_VAL_TYPE = ['RES'] | |
| 7 | +ALL_VAL_TYPE = ['RES', 'TEMP PT100 K', 'TEMP PT100 C'] | |
| 8 | 8 | ALL_CHANNELS = ['1', '2', '3', '4'] |
| 9 | 9 | |
| 10 | 10 | ADRESS = "192.168.0.25" |
| 11 | 11 | CONF_CHANNELS = [["AIN0", "AIN10"], ["AIN2", "AIN11"], ["AIN4", "AIN12"], ["AIN6", "AIN13"]] |
| 12 | +VISHAY_CHANNELS = [1000., 1000., 1079., 10000.] | |
| 12 | 13 | |
| 13 | 14 | #============================================================================== |
| 14 | 15 | |
| ... | ... | @@ -66,8 +67,16 @@ |
| 66 | 67 | def getValue(self): |
| 67 | 68 | strMes = '' |
| 68 | 69 | for ch in self.channels: |
| 69 | - raw = self.read(CONF_CHANNELS[ALL_CHANNELS.index(ch)]) | |
| 70 | - strMes = strMes + str(100.*raw[0]/raw[1]) + ';' | |
| 70 | + if self.vtypes[self.channels.index(ch)] == 'RES': | |
| 71 | + raw = self.read(CONF_CHANNELS[ALL_CHANNELS.index(ch)]) | |
| 72 | + strMes = strMes + str(VISHAY_CHANNELS[ALL_CHANNELS.index(ch)]*raw[0]/raw[1]) + ';' | |
| 73 | + elif self.vtypes[self.channels.index(ch)] == 'TEMP PT100 K': | |
| 74 | + raw = self.read(CONF_CHANNELS[ALL_CHANNELS.index(ch)]) | |
| 75 | + strMes = strMes + str(((VISHAY_CHANNELS[ALL_CHANNELS.index(ch)]*raw[0]/raw[1])/100.-1)/0.003850+273.15) + ';' | |
| 76 | + elif self.vtypes[self.channels.index(ch)] == 'TEMP PT100 C': | |
| 77 | + raw = self.read(CONF_CHANNELS[ALL_CHANNELS.index(ch)]) | |
| 78 | + strMes = strMes + str(((VISHAY_CHANNELS[ALL_CHANNELS.index(ch)]*raw[0]/raw[1])/100.-1)/0.003850) + ';' | |
| 79 | + | |
| 71 | 80 | strMes = strMes[0:-1] + '\n' |
| 72 | 81 | return(strMes) |
| 73 | 82 |