- Timestamp:
- 09/01/11 17:47:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/biasctrl.cc
r11931 r11937 881 881 } 882 882 883 void PrintLine (int b, int ch)883 void PrintLineA(int b, int ch) 884 884 { 885 885 Out() << setw(2) << b << "|"; … … 898 898 } 899 899 900 void Print ()901 { 902 Out() << dec << setprecision(2) << fixed ;900 void PrintA() 901 { 902 Out() << dec << setprecision(2) << fixed << setfill(' '); 903 903 for (int b=0; b<kNumBoards; b++) 904 904 { … … 909 909 } 910 910 911 PrintLine(b, 0); 912 PrintLine(b, 8); 913 PrintLine(b, 16); 914 PrintLine(b, 24); 911 PrintLineA(b, 0); 912 PrintLineA(b, 8); 913 PrintLineA(b, 16); 914 PrintLineA(b, 24); 915 } 916 } 917 918 void PrintLineV(int b, int ch) 919 { 920 Out() << setw(2) << b << "|"; 921 922 for (int c=ch; c<ch+4; c++) 923 { 924 const int id = c+kNumChannelsPerBoard*b; 925 Out() << " "; 926 Out() << setw(5) << fVolt[id]*90/4096. << '/'; 927 Out() << setw(5) << fVoltRef[id]*90/4096.; 928 } 929 Out() << endl; 930 } 931 932 void PrintV() 933 { 934 Out() << dec << setprecision(2) << fixed << setfill(' '); 935 for (int b=0; b<kNumBoards; b++) 936 { 937 if (!fPresent[b]) 938 { 939 Out() << setw(2) << b << "-" << endl; 940 continue; 941 } 942 943 PrintLineV(b, 0); 944 PrintLineV(b, 4); 945 PrintLineV(b, 8); 946 PrintLineV(b, 12); 947 PrintLineV(b, 16); 948 PrintLineV(b, 20); 949 PrintLineV(b, 24); 950 PrintLineV(b, 28); 951 } 952 } 953 954 void PrintLineGapd(int b, int ch) 955 { 956 Out() << setw(2) << b << "|"; 957 958 for (int c=ch; c<ch+8; c++) 959 { 960 const int id = c+kNumChannelsPerBoard*b; 961 Out() << " " << setw(5) << fVoltGapd[id]*90/4096.; 962 } 963 Out() << endl; 964 } 965 966 void PrintGapd() 967 { 968 Out() << dec << setprecision(2) << fixed << setfill(' '); 969 for (int b=0; b<kNumBoards; b++) 970 { 971 if (!fPresent[b]) 972 { 973 Out() << setw(2) << b << "-" << endl; 974 continue; 975 } 976 977 PrintLineGapd(b, 0); 978 PrintLineGapd(b, 8); 979 PrintLineGapd(b, 16); 980 PrintLineGapd(b, 24); 915 981 } 916 982 } … … 953 1019 kConnected, 954 1020 kRamping, 1021 kOverCurrent, 1022 kAtReference, 955 1023 kExpertMode // 'forward' declaration to be used in StateMachineBias 956 1024 }; … … 970 1038 return kRamping; 971 1039 972 return kConnected; 1040 for (int ch=0; ch<kNumChannels; ch++) 1041 if (fPresent[ch/kNumChannelsPerBoard] && fCurrent[ch]<0) 1042 return kOverCurrent; 1043 1044 for (int ch=0; ch<kNumChannels; ch++) 1045 if (fPresent[ch/kNumChannelsPerBoard] && fVolt[ch]!=fVoltRef[ch]) 1046 return kConnected; 1047 1048 return kAtReference; 973 1049 } 974 1050 }; … … 1231 1307 "USB connection to bias-power supply established."); 1232 1308 1309 T::AddStateName(ConnectionBias::kAtReference, "Referenced", 1310 "Internal reference voltage matches last sent voltage."); 1311 1312 T::AddStateName(ConnectionBias::kOverCurrent, "OverCurrent", 1313 "At least one channel is in over current state."); 1314 1233 1315 T::AddStateName(ConnectionBias::kExpertMode, "ExpertMode", 1234 1316 "Special (risky!) mode to directly send command to the bias-power supply."); … … 1244 1326 1245 1327 // Conenction commands 1246 T::AddEvent("DISCONNECT", ConnectionBias::kConnected )1328 T::AddEvent("DISCONNECT", ConnectionBias::kConnected, ConnectionBias::kAtReference) 1247 1329 (bind(&StateMachineBias::Disconnect, this)) 1248 1330 ("disconnect from ethernet"); 1249 1331 1250 T::AddEvent("RECONNECT", "O", ConnectionBias::kDisconnected, ConnectionBias::kConnected )1332 T::AddEvent("RECONNECT", "O", ConnectionBias::kDisconnected, ConnectionBias::kConnected, ConnectionBias::kAtReference) 1251 1333 (bind(&StateMachineBias::Reconnect, this, placeholders::_1)) 1252 1334 ("(Re)connect ethernet connection to FTM, a new address can be given" … … 1255 1337 1256 1338 1257 T::AddEvent("REQUEST_STATUS", ConnectionBias::kConnected, ConnectionBias::k Ramping)1339 T::AddEvent("REQUEST_STATUS", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1258 1340 (Wrapper(bind(&ConnectionBias::ReadAllChannels, &fBias, false))) 1259 1341 ("Asynchronously request the status (current) of all channels."); 1260 1342 1261 T::AddEvent("RESET_OVER_CURRENT_STATUS", ConnectionBias::k Connected)1343 T::AddEvent("RESET_OVER_CURRENT_STATUS", ConnectionBias::kOverCurrent) 1262 1344 (Wrapper(bind(&ConnectionBias::OverCurrentReset, &fBias))) 1263 1345 ("NOT YET TESTED"); … … 1265 1347 1266 1348 1267 T::AddEvent("SET_GLOBAL_VOLTAGE", "F:1", ConnectionBias::kConnected, ConnectionBias::k Ramping)1349 T::AddEvent("SET_GLOBAL_VOLTAGE", "F:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1268 1350 (bind(&StateMachineBias::SetGlobalVolt, this, placeholders::_1)) 1269 1351 ("Set all channels to a new reference voltage. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"); 1270 1352 1271 T::AddEvent("SET_GLOBAL_DAC", "S:1", ConnectionBias::kConnected, ConnectionBias::k Ramping)1353 T::AddEvent("SET_GLOBAL_DAC", "S:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1272 1354 (bind(&StateMachineBias::SetGlobalDac, this, placeholders::_1)) 1273 1355 ("Set all channels to a new DAC reference. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)"); 1274 1356 1275 T::AddEvent("SET_CHANNEL_VOLTAGE", "S:1;F:1", ConnectionBias::kConnected, ConnectionBias::k Ramping)1357 T::AddEvent("SET_CHANNEL_VOLTAGE", "S:1;F:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1276 1358 (bind(&StateMachineBias::SetChannelVolt, this, placeholders::_1)) 1277 1359 ("Set a single channel a new reference voltage. Starts ramping if necessary."); 1278 1360 1279 T::AddEvent("SET_CHANNEL_DAC", "S:1;S:1", ConnectionBias::kConnected, ConnectionBias::k Ramping)1361 T::AddEvent("SET_CHANNEL_DAC", "S:1;S:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1280 1362 (bind(&StateMachineBias::SetChannelDac, this, placeholders::_1)) 1281 1363 ("Set a single channel a new DAC reference value. Starts ramping if necessary."); 1282 1364 1283 T::AddEvent("SET_GAPD_REFERENCE_VOLTAGE", ConnectionBias::kConnected, ConnectionBias::k Ramping)1365 T::AddEvent("SET_GAPD_REFERENCE_VOLTAGE", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1284 1366 (Wrapper(bind(&ConnectionBias::SetGapdVoltage, &fBias))) 1285 1367 ("Set all channels to their G-APD reference voltage. Starts ramping if necessary."); 1286 1368 1287 T::AddEvent("SET_ZERO_VOLTAGE", ConnectionBias::kConnected, ConnectionBias::k Ramping)1369 T::AddEvent("SET_ZERO_VOLTAGE", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1288 1370 (Wrapper(bind(&ConnectionBias::SetZero, &fBias))) 1289 1371 ("Set all channels to a zero reference voltage. Starts ramping if necessary."); … … 1291 1373 1292 1374 1293 T::AddEvent("STOP", ConnectionBias::kConnected, ConnectionBias::kRamping )1375 T::AddEvent("STOP", ConnectionBias::kConnected, ConnectionBias::kRamping, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent) 1294 1376 (Wrapper(bind(&ConnectionBias::RampStop, &fBias))) 1295 1377 (""); 1296 1378 1297 T::AddEvent("START", ConnectionBias::kConnected )1379 T::AddEvent("START", ConnectionBias::kConnected, ConnectionBias::kOverCurrent) 1298 1380 (Wrapper(bind(&ConnectionBias::RampStart, &fBias))) 1299 1381 (""); … … 1301 1383 1302 1384 1303 T::AddEvent("PRINT", ConnectionBias::kConnected, ConnectionBias::kExpertMode, ConnectionBias::kRamping) 1304 (Wrapper(bind(&ConnectionBias::Print, &fBias))) 1385 T::AddEvent("PRINT_CURRENTS") 1386 (Wrapper(bind(&ConnectionBias::PrintA, &fBias))) 1387 (""); 1388 T::AddEvent("PRINT_VOLTAGES") 1389 (Wrapper(bind(&ConnectionBias::PrintV, &fBias))) 1390 (""); 1391 T::AddEvent("PRINT_GAPD_REFERENCE_VOLTAGES") 1392 (Wrapper(bind(&ConnectionBias::PrintGapd, &fBias))) 1305 1393 (""); 1306 1394 … … 1436 1524 ("ramp-step", var<uint16_t>(), "") 1437 1525 ; 1526 // FIXME: Update interval 1527 // FIXME: Synchronization interval 1528 // FIXME: Make sure ramping / request and commands are not sent at the same time. 1529 // FIXME: Add limit of 75V 1438 1530 1439 1531 conf.AddOptions(control);
Note:
See TracChangeset
for help on using the changeset viewer.