Esempio n. 1
0
 public override void ConfigChannel(object chObject)
 {
     DSAInfo.ChannelConfig ch = (DSAInfo.ChannelConfig)chObject;
     if (ch.EnableCh)
     {
         if (aiTask.Channels.Exists(x => x.ChannelID == ch.ChNum))
         {
             aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).RangeHigh  = double.Parse(ch.Range);
             aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).RangeLow   = double.Parse(ch.Range) * (-1);
             aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).Coupling   = (Coupling)Enum.Parse(typeof(Coupling), ch.Coupling);
             aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).Terminal   = (AITerminal)Enum.Parse(typeof(AITerminal), ch.Terminal);
             aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).EnableIEPE = ch.EnableIEPE;
         }
         else
         {
             aiTask.AddChannel(
                 ch.ChNum,
                 double.Parse(ch.Range) * (-1),
                 double.Parse(ch.Range),
                 (Coupling)Enum.Parse(typeof(Coupling), ch.Coupling),
                 (AITerminal)Enum.Parse(typeof(AITerminal), ch.Terminal),
                 ch.EnableIEPE
                 );
         }
     }
     else
     {
         aiTask.RemoveChannel(ch.ChNum);
     }
 }
Esempio n. 2
0
        public override BindingList <object> GetChannelMap()
        {
            BindingList <object> list = new BindingList <object>();

            for (int i = 0; i < DSAInformation.MaxChannels; i++)
            {
                DSAInfo.ChannelConfig ch = new DSAInfo.ChannelConfig();
                ch.ConfigureLUT("Range", DSAInformation.Ranges);
                ch.ConfigureLUT("Terminal", DSAInformation.Terminals);
                ch.ConfigureLUT("Coupling", DSAInformation.Couplings);

                ch.EnableCh = false;
                ch.ChNum    = i;
                ch.Range    = DSAInformation.Ranges[0];
                ch.Terminal = DSAInformation.Terminals[0];
                ch.Coupling = DSAInformation.Couplings[0];

                list.Add(ch);
            }
            return(list);
        }