/// <summary> /// Funtion that sends the channel configuration for the given channel to <see cref="CAEN_x730.SetChannelConfig(int, ChannelParams)"/>. /// </summary> /// <param name="Channel">The channel number to set the configuration.</param> /// <param name="channelParams">An instance of <see cref="ChannelParams"/> containing the channel configuration.</param> public static void SetChannelConfig(int Channel, ChannelParams channelParams) { if (CAEN_x730.ActiveChannels.Count() == 0) { CAEN_x730.SetChannelConfig(Channel, channelParams,true); return; } else { waveformTimer.Enabled = false; int activeChannel = CAEN_x730.ActiveChannels.First(); CAEN_x730.StopAcquisition(activeChannel); CAEN_x730.SetChannelConfig(Channel, channelParams,true); CAEN_x730.StartAcquisition(Channel); waveformTimer.Enabled = true; } trace.Value.TraceEvent(TraceEventType.Information, 0, "Channel config was send to the device"); }
/// <summary> /// Function that returns the current configuration of a specific channel. /// </summary> /// <param name="channel">The number of the channel to get the configuration.</param> /// <returns>An instance of <see cref="ChannelParams"/> holding the current channel configuration.</returns> public static ChannelParams GetChannelConfig(int channel) { ChannelParams channelParams = new ChannelParams(); channelParams.DCoffset = dgtzParams.DCoffset[channel]; channelParams.InputRange = inputRange[channel]; channelParams.InputSignalDecayTime = dgtzParams.DPPParams.M[channel]; channelParams.TrapezoidFlatTopTime = dgtzParams.DPPParams.m[channel]; channelParams.TrapezoidRiseTime = dgtzParams.DPPParams.k[channel]; channelParams.TrapezoidPeakingDelay = dgtzParams.DPPParams.ftd[channel]; channelParams.TriggerFilterSmoothingFactor = dgtzParams.DPPParams.a[channel]; channelParams.InputSignalRiseTime = dgtzParams.DPPParams.b[channel]; channelParams.TriggerThreshold = dgtzParams.DPPParams.thr[channel]; channelParams.NumSamplesBaselineMean = dgtzParams.DPPParams.nsbl[channel]; channelParams.NumSamplesPeakMean = dgtzParams.DPPParams.nspk[channel]; channelParams.PeakHoldOff = dgtzParams.DPPParams.pkho[channel]; channelParams.BaseLineHoldOff = dgtzParams.DPPParams.blho[channel]; channelParams.TriggerHoldOff = dgtzParams.DPPParams.trgho[channel]; channelParams.DigitalGain = dgtzParams.DPPParams.dgain[channel]; channelParams.EnergyNormalizationFactor = dgtzParams.DPPParams.enf[channel]; channelParams.InputSignalDecimation = dgtzParams.DPPParams.decimation[channel]; return channelParams; }
/// <summary> /// Function that sets the configuration of a single channel based on an instance of <see cref="ChannelParams"/>. /// </summary> /// <param name="channel">The number of the channel to configure.</param> /// <param name="channelParams">The instance of <see cref="ChannelParams"/> holding the channel configuration.</param> /// <param name="SendToDevice">Determines whether <see cref="SendConfig"/> is called.</param> public static void SetChannelConfig(int channel, ChannelParams channelParams, bool SendToDevice) { if (channelParams.DCoffset != null) dgtzParams.DCoffset[channel] = (int)channelParams.DCoffset; if (channelParams.InputRange != 0) inputRange[channel] = (int)channelParams.InputRange; if (channelParams.InputSignalDecayTime != null) dgtzParams.DPPParams.M[channel] = (int)channelParams.InputSignalDecayTime; if (channelParams.TrapezoidFlatTopTime != null) dgtzParams.DPPParams.m[channel] = (int)channelParams.TrapezoidFlatTopTime; if (channelParams.TrapezoidRiseTime != null) dgtzParams.DPPParams.k[channel] = (int)channelParams.TrapezoidRiseTime; if (channelParams.TrapezoidPeakingDelay != null) dgtzParams.DPPParams.ftd[channel] = (int)channelParams.TrapezoidPeakingDelay; if (channelParams.TriggerFilterSmoothingFactor != null) dgtzParams.DPPParams.a[channel] = (int)channelParams.TriggerFilterSmoothingFactor; if (channelParams.InputSignalRiseTime != null) dgtzParams.DPPParams.b[channel] = (int)channelParams.InputSignalRiseTime; if (channelParams.TriggerThreshold != null) dgtzParams.DPPParams.thr[channel] = (int)channelParams.TriggerThreshold; if (channelParams.NumSamplesBaselineMean != null) dgtzParams.DPPParams.nsbl[channel] = (int)channelParams.NumSamplesBaselineMean; if (channelParams.NumSamplesPeakMean != null) dgtzParams.DPPParams.nspk[channel] = (int)channelParams.NumSamplesPeakMean; if (channelParams.PeakHoldOff != null) dgtzParams.DPPParams.pkho[channel] = (int)channelParams.PeakHoldOff; if (channelParams.BaseLineHoldOff != null) dgtzParams.DPPParams.blho[channel] = (int)channelParams.BaseLineHoldOff; if (channelParams.TriggerHoldOff != null) dgtzParams.DPPParams.trgho[channel] = (int)channelParams.TriggerHoldOff; if (channelParams.DigitalGain != null) dgtzParams.DPPParams.dgain[channel] = (int)channelParams.DigitalGain; if (channelParams.EnergyNormalizationFactor != null) dgtzParams.DPPParams.enf[channel] = (float)channelParams.EnergyNormalizationFactor; if (channelParams.InputSignalDecimation != null) dgtzParams.DPPParams.decimation[channel] = (int)channelParams.InputSignalDecimation; if (SendToDevice == true) SendConfig(); }