private void DrawWaveFromDB(string inid, string outid) { try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; DASP.Domain.Entitys.TBTestDataEntity inentity = testDataManager.Get(Guid.Parse(inid)); DASP.Domain.Entitys.TBTestDataEntity outentity = testDataManager.Get(Guid.Parse(outid)); DASP.Domain.Entitys.TBTestParameterEntity inparaentity = testParameterManager.Get(Guid.Parse(inid)); DASP.Domain.Entitys.TBTestParameterEntity outparaentity = testParameterManager.Get(Guid.Parse(outid)); inlist = DASP.Tools.SerializerUtils.SerializeToObject(inentity.Data) as List <float>; outlist = DASP.Tools.SerializerUtils.SerializeToObject(outentity.Data) as List <float>; float ingain = inparaentity.Gain; float incv = Convert.ToSingle(inparaentity.CV); //this.CalCv.Text = Convert.ToString(cv); //this.WavePtNum.Text = "1024"; this.txt4.Text = Convert.ToString(inparaentity.SF); this.txt2.Text = Convert.ToString(outparaentity.SF); this.txt1.Text = Convert.ToString(inlist.Count); // nWavePtNum = paraentity. for (int i = 0; i < inlist.Count; i++) { inlist[i] = inlist[i] * ingain / incv; } for (int i = 0; i < outlist.Count; i++) { outlist[i] = outlist[i] * outparaentity.Gain / Convert.ToSingle(outparaentity.CV); } IList <int> scape = new List <int>(); IList <DataBase> dbex = new List <DataBase>(); IList <IList <float>[]> datalsts = new List <IList <float>[]>(); IList <float>[] waveData = new IList <float> [1]; //波形图只有一组绘制数据 waveData[0] = inlist; // new List<float>(); //初始化第一组数据 datalsts.Add(waveData); waveData = new IList <float> [1];//波形图只有一组绘制数据 waveData[0] = outlist; datalsts.Add(waveData); scape.Add(50); scape.Add(50); DataBase db = new DataBase(1000f / Convert.ToSingle(inparaentity.SF), "ms", 1f, inparaentity.EU, "输入信号波形全图"); dbex.Add(db); db = new DataBase(1000f / Convert.ToSingle(outparaentity.SF), "ms", 1f, outparaentity.EU, "输出信号波形全图"); dbex.Add(db); this.mcadLine1.DrawParts = 2; this.mcadLine1.BmSpan = 30; this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts, scape, dbex); this.mcadLine1.Focus(); } catch (Exception ex) { } //this.pointsperpage.SelectedIndex = 5; //this.mcadLine1.Focus(); }
void EditTestFrm_Load(object sender, EventArgs e) { //居中显示 this.Left = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2; this.Top = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2; testDataManager = Utility.SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParamManager = Utility.SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; fanPositionManager = Utility.SpringUtils.Context.GetObject("FanPositionManager") as ITBFanPositionManager; BindData(); }
/// 根据试验标识读试验波形数据 /// </summary> /// <param name="Fname"></param> private void GetWavData(string serialid) { IList <int> scape = new List <int>(); IList <DataBase> dbex = new List <DataBase>(); List <float>[] waveData = new List <float> [1]; //波形图只有一组绘制数据 List <float>[] SprectData = new List <float> [1]; //自谱分析结果数据 waveData[0] = null; // new List<float>(); //初始化第一组数据 SprectData[0] = null; float gain = 1f; try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; DASP.Domain.Entitys.TBTestDataEntity entity = testDataManager.Get(Guid.Parse(serialid));//"f2d72bcb-88b2-4f93-af7a-0b10834848d9")); DASP.Domain.Entitys.TBTestParameterEntity paraentity = testParameterManager.Get(Guid.Parse(serialid)); // byte[] bufferData = DASP.Tools.SerializerUtils.SerializeFromObject(entity.Data) as byte[]; waveData[0] = DASP.Tools.SerializerUtils.SerializeToObject(entity.Data) as List <float>; gain = paraentity.Gain; float sf = Convert.ToSingle(paraentity.SF); float cv = Convert.ToSingle(paraentity.CV); // nWavePtNum = paraentity. //for (int i = 0; i < waveData[0].Count; i++) //{ // waveData[0][i] = waveData[0][i] ; //} datalsts.Add(waveData); //datalsts.Add(waveData); SprectData[0] = GetSprectData(waveData[0]); datalsts.Add(SprectData); scape.Add(30); scape.Add(70); DataBase db = new DataBase(1 / sf, "s", 1f, "N"); dbex.Add(db); db = new DataBase(sf / spepara.nFftPtNum, "Hz", 1f, "N"); dbex.Add(db); this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts, scape, dbex); //this.mcadLine1.SetDrawDataAll(datalsts); this.mcadLine1.Focus(); } catch { } //datalsts.Add(waveData); //datalsts.Add(waveData); //this.mcadLine1.drawall = true; //this.mcadLine1.SetDrawDataAll( datalsts); }
void TestDataManagerFrm_Load(object sender, EventArgs e) { UI.CommonModule.DataGridViewActionButtonColumn actionColumn = new UI.CommonModule.DataGridViewActionButtonColumn(); actionColumn.Name = "ColAction"; actionColumn.DataPropertyName = "DataId"; actionColumn.MinimumWidth = 120; dgvDataSource.Columns.Add(actionColumn); this.ucToolBar.OnAddClick += new EventHandler(ucToolBar_OnAddClick); testDataManager = Utility.SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; LoadData(); }
private List <float> GetWaveDataFromDB(string serialid, out float sf) { List <float> list = null; sf = 1f; try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; DASP.Domain.Entitys.TBTestDataEntity entity = testDataManager.Get(Guid.Parse(serialid));//"f2d72bcb-88b2-4f93-af7a-0b10834848d9")); DASP.Domain.Entitys.TBTestParameterEntity paraentity = testParameterManager.Get(Guid.Parse(serialid)); // byte[] bufferData = DASP.Tools.SerializerUtils.SerializeFromObject(entity.Data) as byte[]; list = DASP.Tools.SerializerUtils.SerializeToObject(entity.Data) as List <float>; float gain = paraentity.Gain; float cv = Convert.ToSingle(paraentity.CV); sf = Convert.ToSingle(paraentity.SF); // nWavePtNum = paraentity. for (int i = 0; i < list.Count; i++) { list[i] = list[i] * gain / cv; } // IList<int> scape = new List<int>(); // IList<DataBase> dbex = new List<DataBase>(); // IList<IList<float>[]> datalsts = new List<IList<float>[]>(); // IList<float>[] waveData = new IList<float>[2];//波形图只有一组绘制数据 // waveData[0] = list;// new List<float>(); //初始化第一组数据 // // this.mcadLine1.DrawParts = 2; // waveData[1] = list; // this.mcadLine1.BmSpan = 30; // datalsts.Add(waveData); // // datalsts.Add(waveData); // scape.Add(40); // // scape.Add(60); // DataBase db = new DataBase(1 / sf, "s", 1f, "N"); // dbex.Add(db); //// dbex.Add(db); // //this.mcadLine1.drawall = true; // this.mcadLine1.SetDrawDataAll(datalsts, scape, dbex); // this.mcadLine1.Focus(); } catch (Exception ex) { } return(list); }
/// <summary> /// 参数设置时的界面 /// </summary> /// <param name="serialid"></param> private void DrawWaveFromDB(string serialid) { try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; DASP.Domain.Entitys.TBTestDataEntity entity = testDataManager.Get(Guid.Parse(serialid));//"f2d72bcb-88b2-4f93-af7a-0b10834848d9")); DASP.Domain.Entitys.TBTestParameterEntity paraentity = testParameterManager.Get(Guid.Parse(serialid)); // byte[] bufferData = DASP.Tools.SerializerUtils.SerializeFromObject(entity.Data) as byte[]; List <float> list = DASP.Tools.SerializerUtils.SerializeToObject(entity.Data) as List <float>; float gain = paraentity.Gain; float cv = Convert.ToSingle(paraentity.CV); this.CalCv.Text = Convert.ToString(cv); this.WavePtNum.Text = "1024"; this.WaveSf.Text = Convert.ToString(paraentity.SF); indata = list; // nWavePtNum = paraentity. for (int i = 0; i < list.Count; i++) { list[i] = list[i] * gain / cv; } IList <IList <float>[]> datalsts = new List <IList <float>[]>(); IList <DataBase> dbex = new List <DataBase>(); DataBase db = new DataBase(1000f / Convert.ToSingle(paraentity.SF), "ms", 1f, paraentity.EU, "波形图全程预览"); IList <float>[] waveData = new IList <float> [1]; //波形图只有一组绘制数据 waveData[0] = list; // new List<float>(); //初始化第一组数据 this.mcadLine1.DrawParts = 2; this.mcadLine1.BmSpan = 30; datalsts.Add(waveData); dbex.Add(db); this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts, dbex); this.mcadLine1.Focus(); } catch (Exception ex) { } //this.pointsperpage.SelectedIndex = 5; //this.mcadLine1.Focus(); }
/// <summary> /// 根据试验标识读试验波形数据 /// </summary> /// <param name="Fname"></param> private void GetWavData(string serialid) { List <float>[] waveData = new List <float> [1]; //波形图只有一组绘制数据 List <float>[] SprectData = new List <float> [1]; //自谱分析结果数据 waveData[0] = null; // new List<float>(); //初始化第一组数据 SprectData[0] = null; float gain = 1f; try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; DASP.Domain.Entitys.TBTestDataEntity entity = testDataManager.Get(Guid.Parse(serialid));//"f2d72bcb-88b2-4f93-af7a-0b10834848d9")); DASP.Domain.Entitys.TBTestParameterEntity paraentity = testParameterManager.Get(Guid.Parse(serialid)); // byte[] bufferData = DASP.Tools.SerializerUtils.SerializeFromObject(entity.Data) as byte[]; waveData[0] = DASP.Tools.SerializerUtils.SerializeToObject(entity.Data) as List <float>; gain = paraentity.Gain; float cv = Convert.ToSingle(paraentity.CV); // nWavePtNum = paraentity. for (int i = 0; i < waveData[0].Count; i++) { waveData[0][i] = waveData[0][i] * gain / cv; } datalsts.Add(waveData); SprectData[0] = GetSprectData(waveData[0]); datalsts.Add(SprectData); this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts); } catch { } //datalsts.Add(waveData); //datalsts.Add(waveData); //this.mcadLine1.drawall = true; //this.mcadLine1.SetDrawDataAll( datalsts); }
/// <summary> /// 从数据库中读取观测记录 /// </summary> /// <param name="serialid"></param> private void DrawWaveFromDB(string serialid) { try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; DASP.Domain.Entitys.TBTestDataEntity entity = testDataManager.Get(Guid.Parse(serialid));//"f2d72bcb-88b2-4f93-af7a-0b10834848d9")); DASP.Domain.Entitys.TBTestParameterEntity paraentity = testParameterManager.Get(Guid.Parse(serialid)); // byte[] bufferData = DASP.Tools.SerializerUtils.SerializeFromObject(entity.Data) as byte[]; List <float> list = DASP.Tools.SerializerUtils.SerializeToObject(entity.Data) as List <float>; float gain = paraentity.Gain; float cv = Convert.ToSingle(paraentity.CV); float sf = Convert.ToSingle(paraentity.SF); WavePoints.Text = Convert.ToString(list.Count); FreqSampling.Text = Convert.ToString(sf); Gain.Text = Convert.ToString(paraentity.Gain); Cv.Text = Convert.ToString(paraentity.CV); zUnit.Text = paraentity.EU; // nWavePtNum = paraentity. for (int i = 0; i < list.Count; i++) { list[i] = list[i] * gain / cv; } IList <int> scape = new List <int>(); IList <DataBase> dbex = new List <DataBase>(); IList <IList <float>[]> datalsts = new List <IList <float>[]>(); IList <float>[] waveData = new IList <float> [1]; //波形图只有一组绘制数据 waveData[0] = list; // new List<float>(); //初始化第一组数据 // this.mcadLine1.DrawParts = 2; this.mcadLine1.BmSpan = 30; datalsts.Add(waveData); datalsts.Add(waveData); scape.Add(35); scape.Add(65); DataBase db = new DataBase(1000f / sf, "ms", 1f, paraentity.EU, "波形图全程预览"); dbex.Add(db); db = new DataBase(1000f / sf, "ms", 1f, paraentity.EU, "时域图 "); dbex.Add(db); //this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts, scape, dbex); switch (this.pointsperpage.SelectedIndex) { case 0: this.mcadLine1.SetDrawAera(1, 0, 128); break; case 1: this.mcadLine1.SetDrawAera(1, 0, 256); break; case 2: this.mcadLine1.SetDrawAera(1, 0, 512); break; case 3: this.mcadLine1.SetDrawAera(1, 0, 1024); break; case 4: this.mcadLine1.SetDrawAera(1, 0, 2048); break; case 5: this.mcadLine1.SetDrawAera(1, 0, 4096); break; case 6: this.mcadLine1.SetDrawAera(1, 0, 8192); break; default: //this.mcadLine1.PageNumberOfValue = -1; break; } this.mcadLine1.Focus(); this.mcadLine1.Focus(); } catch (Exception ex) { } //this.pointsperpage.SelectedIndex = 5; //this.mcadLine1.Focus(); }
/// <summary> /// 根据参数设置界面得到的输入数据绘制自谱图像 /// </summary> /// <param name="Fname"></param> private void GetSpectData(List <float> indata, string serialid) { IList <int> scape = new List <int>(); IList <DataBase> dbex = new List <DataBase>(); List <float>[] waveData = new List <float> [1]; //波形图只有一组绘制数据 List <float>[] SprectData = new List <float> [1]; //自谱分析结果数据 waveData[0] = indata; SprectData[0] = null; float gain = 1f; try { testDataManager = SpringUtils.Context.GetObject("TestDataManager") as ITBTestDataManager; testParameterManager = SpringUtils.Context.GetObject("TestParameterManager") as ITBTestParameterManager; // DASP.Domain.Entitys.TBTestDataEntity entity = testDataManager.Get(Guid.Parse(serialid));//"f2d72bcb-88b2-4f93-af7a-0b10834848d9")); DASP.Domain.Entitys.TBTestParameterEntity paraentity = testParameterManager.Get(Guid.Parse(serialid)); gain = paraentity.Gain; float sf = Convert.ToSingle(paraentity.SF); float cv = Convert.ToSingle(paraentity.CV); //for (int i = 0; i < waveData[0].Count; i++) //{ // waveData[0][i] = waveData[0][i] ; //} datalsts.Add(waveData); //datalsts.Add(waveData); SprectData[0] = GetSprectData(waveData[0]); datalsts.Add(SprectData); scape.Add(30); scape.Add(70); /// <summary> /// 频谱类型 0 单峰值 1 有效值 2 功率谱 3PSD /// </summary> DataBase db = new DataBase(1000f / sf, "ms", 1f, paraentity.EU); dbex.Add(db); switch (spepara.nSpectrumType) { case 0: db = new DataBase(sf / spepara.nFftPtNum, "Hz", 1f, "(N)", "单峰值"); break; case 1: db = new DataBase(sf / spepara.nFftPtNum, "Hz", 1f, "(N)", "有效值"); break; case 2: db = new DataBase(sf / spepara.nFftPtNum, "Hz", 1f, "(N)", "功率谱"); break; case 3: db = new DataBase(sf / spepara.nFftPtNum, "Hz", 1f, "(N)", "PSD"); break; default: db = new DataBase(sf / spepara.nFftPtNum, "Hz", 1f, "(N)", " "); break; } dbex.Add(db); this.mcadLine1.drawall = true; this.mcadLine1.SetDrawDataAll(datalsts, scape, dbex); //this.mcadLine1.SetDrawDataAll(datalsts); this.mcadLine1.Focus(); } catch { } //datalsts.Add(waveData); //datalsts.Add(waveData); //this.mcadLine1.drawall = true; //this.mcadLine1.SetDrawDataAll( datalsts); }