Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CVar              nVar1 = frmMain.staComm.GetVarByStaNameVarName(sListStaName[0], "I_W");
            CVar              nVar2 = frmMain.staComm.GetVarByStaNameVarName(sListStaName[1], "I_W");
            CVar              nVar3 = frmMain.staComm.GetVarByStaNameVarName(sListStaName[2], "I_W");
            CStation          Sta1  = frmMain.staComm.GetStaByStaName(sListStaName[0]);
            CProtcolModbusTCP STCP1 = (CProtcolModbusTCP)Sta1;
            CStation          Sta2  = frmMain.staComm.GetStaByStaName(sListStaName[1]);
            CProtcolModbusTCP STCP2 = (CProtcolModbusTCP)Sta2;
            CStation          Sta3  = frmMain.staComm.GetStaByStaName(sListStaName[2]);
            CProtcolModbusTCP STCP3 = (CProtcolModbusTCP)Sta3;

            double iValue1 = nVar1.GetDoubleValue() + Convert.ToDouble(textBox1.Text);
            int    fSend1  = (int)Math.Round(iValue1 / nVar1.RatioValue);

            STCP1.SendAODO(nVar1.ByteAddr, (int)fSend1, 6);

            double iValue2 = nVar2.GetDoubleValue() + Convert.ToDouble(textBox2.Text);
            int    fSend2  = (int)Math.Round(iValue2 / nVar2.RatioValue);

            STCP2.SendAODO(nVar3.ByteAddr, (int)fSend2, 6);

            double iValue3 = nVar3.GetDoubleValue() + Convert.ToDouble(textBox3.Text);
            int    fSend3  = (int)Math.Round(iValue3 / nVar3.RatioValue);

            STCP3.SendAODO(nVar3.ByteAddr, (int)fSend3, 6);
        }
Пример #2
0
 public void UpdateReal(DateTime DT_S, DateTime DT_E)
 {
     try
     {
         if (cVar == null)
         {
             return;
         }
         int iLen = (int)((TimeSpan)(DT_E - DT_S)).TotalSeconds;
         int k    = 1;
         for (int i = 1; i < iLen; i++)
         {
             DateTime DT_N = DT_S.AddSeconds(i);
             double   time = new XDate(DT_N);
             //Debug.WriteLine(time.ToString());
             ListPT.Add(time, cVar.GetDoubleValue(DT_N));
         }
     }
     catch (Exception ex)
     { }
 }