public static int AscanVideoIFActive(uint sessionIndex, GateType gateNum, AscanIFActive active) { int error_code = 0; for (int i = 0; i < batchSessionsInfo.Count; i++) { if (batchSessionsInfo[i].sessionIndex == sessionIndex) { error_code = SetAscanVideoDAQ.IFActive(sessionIndex, (uint)batchSessionsInfo[i].port, active); if (error_code != 0) { break; } } } return(error_code); }
public static int EnvlopDecayFactor(uint sessionIndex, uint value) { int error_code = 0; for (int i = 0; i < batchSessionsInfo.Count; i++) { if (batchSessionsInfo[i].sessionIndex == sessionIndex) { error_code = SetAscanVideoDAQ.EnvlopDecayFactor(sessionIndex, (uint)batchSessionsInfo[i].port, value); if (error_code != 0) { break; } } } return(error_code); }
public static bool WaveMode(uint sessionIndex, AscanWaveDectionMode waveMode) { bool isSetPre = false; for (int i = 0; i < batchSessionsInfo.Count; i++) { if (batchSessionsInfo[i].sessionIndex == sessionIndex) { isSetPre = SetAscanVideoDAQ.WaveMode(sessionIndex, (uint)batchSessionsInfo[i].port, waveMode); if (isSetPre) { break; } } } return(isSetPre); }
public static int Range(uint sessionIndex, double range) { int error_code = 0; for (int i = 0; i < batchSessionsInfo.Count; i++) { if (batchSessionsInfo[i].sessionIndex == sessionIndex) { error_code = SetAscanVideoDAQ.Range(sessionIndex, (uint)batchSessionsInfo[i].port, range); if (error_code != 0) { break; } } } return(error_code); }
public static int Delay(uint sessionIndex, double delay) { int error_code = 0; for (int i = 0; i < batchSessionsInfo.Count; i++) { uint seIndex = (uint)batchSessionsInfo[i].sessionIndex; //if (batchSessionsInfo[i].sessionIndex == sessionIndex) { error_code = SetAscanVideoDAQ.Delay(seIndex, (uint)batchSessionsInfo[i].port, delay); if (error_code != 0) { break; } } } return(error_code); }
/**Set wave mode to Positive、Negative、Full Wave acocording to tofMode.*/ public static bool WaveMode(uint ascanNum, uint ascanPort, AscanWaveDectionMode waveMode) { int error_code; int gateTotNum = 4; GateType gateNum; int gateI = (int)GateType.I; int gateA = (int)GateType.A; int gateB = (int)GateType.B; int gateC = (int)GateType.C; bool isSetPre = true; TofMode[] tofMode = new TofMode[gateTotNum]; TofMode tofModeFlank = TofMode.Flank; for (int i = 0; i < gateTotNum; i++) { gateNum = (GateType)i; error_code = GetGateDAQ.TofMode(SelectAscan.sessionIndex, SelectAscan.port, gateNum, ref tofMode[i]); if (error_code != 0) { return(isSetPre); } } if (waveMode == AscanWaveDectionMode.SemiPositve || waveMode == AscanWaveDectionMode.SemiNegtive || waveMode == AscanWaveDectionMode.Full) { if (tofMode[gateI] > tofModeFlank || tofMode[gateA] > tofModeFlank || tofMode[gateB] > tofModeFlank || tofMode[gateC] > tofModeFlank) //Tof Mode are Zero Before or Zero After { MessageShow.show("Tof Mode = Zero Before or Zero After, need to set Receiver->RF!", "Tof Mode = Zero Before or Zero After,必须设置Receiver->RF!"); return(isSetPre); } } error_code = SetAscanVideoDAQ.DetectionWaveMode(ascanNum, ascanPort, waveMode); if (error_code != 0) { return(isSetPre); } return(isSetPre = false); }
//使得筛选的通道和当前显示通道所有参数变得一样 public static int Param(uint sessionIndex, uint selPort) { int error_code = 0; bool isSetPre = false; double delay = 0; double range = 0; double gain = 0; uint envlopDecay = 0; AscanWaveDectionMode waveMode = AscanWaveDectionMode.SemiPositve; RecieverType type = RecieverType.Pc; AscanEnvelopActive envelopActive = AscanEnvelopActive.OFF; int gateTol = 4; TofMode tofMode = TofMode.Flank; TofMode[] tofModeArr = new TofMode[gateTol]; GateAlarmLogic[] gateAlarmLogic = new GateAlarmLogic[gateTol]; GateAlarmActive[] gateAlarmActive = new GateAlarmActive[gateTol]; double[] gateDelay = new double[gateTol]; double[] gateWidth = new double[gateTol]; double[] threshold = new double[gateTol]; SuppressCounterActive[] scActive = new SuppressCounterActive[gateTol]; uint[] scCount = new uint[gateTol]; IFActive ifActive = IFActive.OFF; AscanIFActive ascanIfActive = AscanIFActive.OFF; //取得当前通道的所有参数 error_code = GetAsacnVideoDAQ.Delay(sessionIndex, selPort, ref delay); error_code |= GetAsacnVideoDAQ.Range(sessionIndex, selPort, ref range); error_code |= GetAsacnVideoDAQ.Range(sessionIndex, selPort, ref range); error_code |= GetRecieverDAQ.AnalogGain(sessionIndex, selPort, ref gain); error_code |= GetAsacnVideoDAQ.EnvlopDecayFactor(sessionIndex, selPort, ref envlopDecay); error_code |= GetAsacnVideoDAQ.DetectionWaveMode(sessionIndex, selPort, ref waveMode); error_code |= GetPulserTransmitDAQ.RecieverMode(sessionIndex, selPort, ref type); error_code |= GetAsacnVideoDAQ.EnvlopActive(sessionIndex, selPort, ref envelopActive); error_code |= GetGateDAQ.IFActive(sessionIndex, selPort, GateType.I, ref ifActive); error_code |= GetAsacnVideoDAQ.IFActive(sessionIndex, selPort, ref ascanIfActive); for (int i = 0; i < gateTol; i++) { GateType gateIndex = (GateType)i; error_code |= GetGateDAQ.TofMode(sessionIndex, selPort, gateIndex, ref tofModeArr[i]); error_code |= GetGateDAQ.AlarmLogic(sessionIndex, selPort, gateIndex, ref gateAlarmLogic[i]); error_code |= GetGateDAQ.AlarmActive(sessionIndex, selPort, gateIndex, ref gateAlarmActive[i]); error_code |= GetGateDAQ.Delay(sessionIndex, selPort, gateIndex, ref gateDelay[i]); error_code |= GetGateDAQ.Width(sessionIndex, selPort, gateIndex, ref gateWidth[i]); error_code |= GetGateDAQ.Threshold(sessionIndex, selPort, gateIndex, ref threshold[i]); error_code |= GetGateDAQ.ScActive(sessionIndex, selPort, gateIndex, ref scActive[i]); error_code |= GetGateDAQ.ScCounter(sessionIndex, selPort, gateIndex, ref scCount[i]); } if (error_code != 0) { return(error_code); } //赋值 for (int i = 0; i < batchSessionsInfo.Count; i++) { uint port = (uint)batchSessionsInfo[i].port; uint seIndex = (uint)batchSessionsInfo[i].sessionIndex; //第二种情况||batchSessionsInfo[i].sessionIndex != sessionIndex //if (batchSessionsInfo[i].sessionIndex == sessionIndex && port != selPort )//以selPort号为依据配置同一块板卡的其他虚拟通道的参数 { error_code = SetAscanVideoDAQ.Delay(seIndex, port, delay); error_code |= SetAscanVideoDAQ.Range(seIndex, port, range); error_code |= SetReceiverDAQ.AnalogGain(seIndex, port, gain); error_code |= SetAscanVideoDAQ.EnvlopDecayFactor(seIndex, port, envlopDecay); isSetPre = SetAscanVideoDAQ.WaveMode(seIndex, port, waveMode); error_code |= SetPulserTransmitDAQ.RecieverMode(seIndex, port, type); error_code |= SetAscanVideoDAQ.EnvlopActive(seIndex, port, envelopActive); for (int j = 0; j < gateTol; j++) { GateType gateIndex = (GateType)j; isSetPre |= SetGateDAQ.setTofMode(seIndex, port, gateIndex, tofModeArr[j]); error_code |= SetGateDAQ.AlarmLogic(seIndex, port, gateIndex, gateAlarmLogic[j]); error_code |= SetGateDAQ.AlarmActive(seIndex, port, gateIndex, gateAlarmActive[j]); error_code |= SetGateDAQ.Delay(seIndex, port, gateIndex, gateDelay[j]); error_code |= SetGateDAQ.Width(seIndex, port, gateIndex, gateWidth[j]); error_code |= SetGateDAQ.Threshold(seIndex, port, gateIndex, threshold[j]); error_code |= SetGateDAQ.ScActive(seIndex, port, gateIndex, scActive[j]); error_code |= SetGateDAQ.ScCounter(seIndex, port, gateIndex, scCount[j]); if (error_code != 0) { return(error_code); } } error_code |= GetGateDAQ.TofMode(seIndex, port, GateType.I, ref tofMode); if (ifActive == IFActive.ON && ascanIfActive == AscanIFActive.ON) { if (tofMode != TofMode.Flank) { MessageShow.show("Warning:" + seIndex + port + "The TOF Mode GateI must select Flank mode!", "警告:" + sessionIndex + port + "门模式门I未选择Flank模式!"); return(error_code = -1); } else { error_code |= SetGateDAQ.iFActive(seIndex, port, GateType.I, IFActive.ON); error_code |= SetAscanVideoDAQ.IFActive(seIndex, port, AscanIFActive.ON); } } else { error_code |= SetGateDAQ.iFActive(seIndex, port, GateType.I, IFActive.OFF); error_code |= SetAscanVideoDAQ.IFActive(seIndex, port, AscanIFActive.OFF); } if (error_code != 0) { return(error_code); } } } return(error_code); }
/* * private void FormGatePosition_Paint(object sender, PaintEventArgs e) * { * e.Graphics.DrawLine(new Pen(SystemColors.GradientActiveCaption, 3), 1, 0, 1, this.Height); * } */ private void checkBoxIF_Click(object sender, EventArgs e) { if ((int)gateNum == 0) { int error_code = 0; TofMode tofMode = TofMode.Flank; List <TofMode> list = new List <TofMode>(); list.Clear(); if (checkBoxIF.Checked) { if (SetBatchDAQ.isOn) { error_code = SetBatchDAQ.getTOfMode(SelectAscan.sessionIndex, GateType.I, list); for (int i = 0; i < list.Count; i++) { if (list[i] != TofMode.Flank) { MessageShow.show("Warning:The TOF Mode GateI must select Flank mode!", "警告:门模式门I未选择Flank模式!"); checkBoxIF.Checked = false; return; } } error_code |= SetBatchDAQ.GateIFActive(SelectAscan.sessionIndex, GateType.I, IFActive.ON); error_code |= SetBatchDAQ.AscanVideoIFActive(SelectAscan.sessionIndex, GateType.I, AscanIFActive.ON); if (error_code != 0) { return; } } else { error_code = GetGateDAQ.TofMode(SelectAscan.sessionIndex, SelectAscan.port, GateType.I, ref tofMode); if (tofMode != TofMode.Flank) { MessageShow.show("Warning:The TOF Mode GateI must select Flank mode!", "警告:门模式门I未选择Flank模式!"); checkBoxIF.Checked = false; return; } error_code |= SetGateDAQ.iFActive(SelectAscan.sessionIndex, SelectAscan.port, GateType.I, IFActive.ON); error_code |= SetAscanVideoDAQ.IFActive(SelectAscan.sessionIndex, SelectAscan.port, AscanIFActive.ON); if (error_code != 0) { return; } } } else { if (SetBatchDAQ.isOn) { error_code = SetGateDAQ.iFActive(SelectAscan.sessionIndex, SelectAscan.port, GateType.I, IFActive.OFF); error_code |= SetAscanVideoDAQ.IFActive(SelectAscan.sessionIndex, SelectAscan.port, AscanIFActive.OFF); } { error_code = SetGateDAQ.iFActive(SelectAscan.sessionIndex, SelectAscan.port, GateType.I, IFActive.OFF); error_code |= SetAscanVideoDAQ.IFActive(SelectAscan.sessionIndex, SelectAscan.port, AscanIFActive.OFF); } if (error_code != 0) { return; } FormList.MDIChild.drawGateIWhenIfStartDisabled(); } } if ((int)gateNum == 1) { MessageShow.show("Warning:The Gate must select GateI!", "警告:门模式未选择门I!"); checkBoxIF.Checked = false; return; } if ((int)gateNum == 2) { MessageShow.show("Warning:The Gate must select GateI!", "警告:门模式未选择门I!"); checkBoxIF.Checked = false; return; } if ((int)gateNum == 3) { MessageShow.show("Warning:The Gate must select GateI!", "警告:门模式未选择门I!"); checkBoxIF.Checked = false; return; } }