Exemple #1
0
 /// <summary>
 /// 写电阻、电容、电抗表格到excel文件
 /// </summary>
 /// <returns>写入的行数</returns>
 private int WriteDataToExcel()
 {
     try
     {
         int             startRow    = 2;
         int             startColumn = 1;
         RLC.Resistance  R           = RLC.Resistance.GetInstance();
         RLC.Capacitance C           = RLC.Capacitance.GetInstance();
         RLC.Inductance  L           = RLC.Inductance.GetInstance();
         if (R.dt != null && R.dt.Rows.Count > 0)
         {
             int optRows = WriteDataTable(R, startRow, startColumn);
             startRow = startRow + optRows + 5;
         }
         if (C.dt != null && C.dt.Rows.Count > 0)
         {
             int optRows = WriteDataTable(C, startRow, startColumn);
             startRow = startRow + optRows + 5;
         }
         if (L.dt != null && L.dt.Rows.Count > 0)
         {
             int optRows = WriteDataTable(L, startRow, startColumn);
             startRow = startRow + optRows + 5;
         }
         return(startRow - 2);
     }
     catch (Exception e)
     {
         throw new Exception("写数据到excel出错:" + e.Message, e);
     }
 }
 /// <summary>
 /// 得到电阻实例
 /// </summary>
 /// <param name="i_phase_voltage">相电压</param>
 /// <param name="d_three_phase_power">三相功率</param>
 /// <param name="cocontactor">接触器</param>
 /// <param name="wireSize">导线大小</param>
 /// <param name="RNumber">单相电阻管数量</param>
 /// <returns></returns>
 public static Resistance GetInstance()
 {
     lock (_lock)
     {
         if (resistance == null)
         {
             resistance = new Resistance();
         }
         return(resistance);
     }
 }