public Form1() { InitializeComponent(); aiThing = new AIThing(); //aiThing.InitAIThing(@"d:\111"); aiThing.InitAIThing(@"D:\123", @"D:\123\config.txt"); }
private void AddThings() { //If you don't want dynamic load things, please comment out the line below //var loader = new DynamicThingsLoader(this); //------------------------------Pipeline------------------------------// MyHub.Pipeline.AddMiddleware(new ResourceInfoMidware()); MyHub.Pipeline.AddMiddleware(new NavigationMidware()); //------------------------------Nancy HTTP通信模块------------------------------// var nancyCM = new NancyCommunicationModule(new Uri("http://*****:*****@".\ConfigFile\PVs.json"); //------------------------------模拟采集卡------------------------------// var fakeAI = new FakeAIThing(); MyHub.TryAddThing(fakeAI, "/", "fakeCard", 16); //------------------------------NI采集卡------------------------------// var niNonSync = new AIThing(); niNonSync.basicAI = new NIAI(); niNonSync.DataFileFactory = new HDF5DataFileFactory(); MyHub.TryAddThing(niNonSync, @"/", "Card0", new { ConfigFilePath = @".\ConfigFile\niNonSync.json", DataFileParentDirectory = @"D:\Data\ni\Card0" }); ////------------------------------自动 Arm 采集卡与发布上传事件------------------------------// //var aiManagement = new AIManagementThing(); //MyHub.TryAddThing(aiManagement, @"/", "aimanagement", @".\ConfigFile\AIManagement.json"); ////------------------------------上传文件的------------------------------// //var uploader = new DataUpLoadThing(); //MyHub.TryAddThing(uploader, @"/", "uploader", new string[] { // @".\ConfigFile\DataUploadConfig.json", // @".\ConfigFile\DataUpload.csv" // }); ////------------------------------上传炮号提供者------------------------------// //var dic = new DicServerThing(); //MyHub.TryAddThing(dic, "/", "dicServer", @".\ConfigFile\Dic.json"); //------------------------------文件数据服务------------------------------// var dataServer = new DataServerThing(@".\ConfigFile\BasePath.json"); dataServer.dataFileFactoty = new HDF5DataFileFactory(); MyHub.TryAddThing(dataServer, "/", "dataServer"); //------------------------------Mds数据服务------------------------------// var mdsServer = new MdsPlusReaderThing(); MyHub.TryAddThing(mdsServer, "/", "mdsServer", @".\ConfigFile\mdsServer.json"); }
private void AddThings() { #region Nancy,ViewCopy以及Dic配置 //nancy HTTP var nancyCM = new NancyCommunicationModule(new Uri("http://*****:*****@"D:\Run\ConfigFile\DAQFamilyBucket\Dic.txt"); //Epcis EPCISThing epcis = new EPCISThing(); MyHub.TryAddThing(epcis, "/", "epcis", @"D:\Run\ConfigFile\DAQFamilyBucket\PVs.txt"); #endregion //注意,下面加了多少个卡,在左边: //解决方案资源管理器 -> CFET2App -> Views -> ViewSelector.json 中的 childpath 字段中 //就要加对应多少个卡,且名字和卡名要一样,否则网页上不能显示 //另外,卡名需要以Card开头,否则页面看不到波形 //说明在 NI 采集卡中,不同卡是类似的 #region NI采集卡,若使用NI请展开 //------------------------------NI采集卡,每增加一个采集卡要增加以下4行代码------------------------------// //这个niNonSync每张卡要不一样 var niNonSync = new AIThing(); //这个除了niNonSync不一样其余都一样 niNonSync.basicAI = new NIAI(); niNonSync.DataFileFactory = new HDF5DataFileFactory(); //这个括号里面的不一样 MyHub.TryAddThing(niNonSync, //上面的niNonSync @"/", //Thing挂载路径,都一样,不要改!!! "Card0", //卡名,也就是在网页上看到的卡名称 //下面引号中的要改,前面的是配置文件路径,后面的是采集数据保存到本地的路径 new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\niNonSync.txt", DataFileParentDirectory = @"D:\Data\ni\Card0" }); //var niMaster = new AIThing(); //niMaster.basicAI = new NIAI(); //niMaster.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(niMaster, // @"/", // "Card1", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\niMaster.txt", DataFileParentDirectory = @"D:\Data\ni\Card1" }); //var niSlave = new AIThing(); //niSlave.basicAI = new NIAI(); //niSlave.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(niSlave, // @"/", // "Card2", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\niSlave.txt", DataFileParentDirectory = @"D:\Data\ni\Card2" }); #endregion #region JY采集卡,若使用JY请展开 ////------------------------------JY采集卡,格式和NI一样------------------------------// //var jyNonSync = new AIThing(); //jyNonSync.basicAI = new JYAI(); //jyNonSync.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(jyNonSync, // @"/", // "CardA", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\jyNonSync.txt", DataFileParentDirectory = @"D:\Data\jy\CardA" }); //var jyMaster = new AIThing(); //jyMaster.basicAI = new JYAI(); //jyMaster.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(jyMaster, // @"/", // "CardB", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\jyMaster.txt", DataFileParentDirectory = @"D:\Data\jy\CardB" }); //var jySlave = new AIThing(); //jySlave.basicAI = new JYAI(); //jySlave.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(jySlave, // @"/", // "CardC", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\jySlave.txt", DataFileParentDirectory = @"D:\Data\jy\CardC" }); #endregion #region NIScope采集卡,若使用NIScope请展开 //------------------------------NIScope采集卡,每增加一个采集卡要增加以下4行代码------------------------------// //var scopeNonSync = new AIThing(); //scopeNonSync.basicAI = new NIScopeAI(); //scopeNonSync.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(scopeNonSync, // @"/", // "Cards0", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\scopeNonSync.txt", DataFileParentDirectory = @"D:\Data\ni\Cards0" }); //var scopeSlave = new AIThing(); //scopeSlave.basicAI = new NIScopeAI(); //scopeSlave.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(scopeSlave, // @"/", // "Cards2", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\scopeSlave.txt", DataFileParentDirectory = @"D:\Data\ni\Cards2" }); //var scopeMaster = new AIThing(); //scopeMaster.basicAI = new NIScopeAI(); //scopeMaster.DataFileFactory = new HDF5DataFileFactory(); //MyHub.TryAddThing(scopeMaster, // @"/", // "Cards1", // new { ConfigFilePath = @"D:\Run\ConfigFile\DAQFamilyBucket\scopeMaster.txt", DataFileParentDirectory = @"D:\Data\ni\Cards1" }); #endregion //------------------------------自动 Arm 采集卡与发布上传事件的,只有一个这个------------------------------// var aiManagement = new AIManagementThing(); //监控EPCIS //MyHub.TryAddThing(aiManagement, @"/", "aimanagement", @"D:\Run\ConfigFile\DAQFamilyBucket\AIManagement.json"); //不监控EPCIS MyHub.TryAddThing(aiManagement, @"/", "aimanagement", @"D:\Run\ConfigFile\DAQFamilyBucket\AIManagementNoEPCIS.json"); //------------------------------上传文件的,只有一个这个------------------------------// var uploader = new DataUpLoadThing(); //前面的别改,后面的.txt路径是配置文件的完整路径 MyHub.TryAddThing(uploader, @"/", "uploader", new string[] { @"D:\Run\ConfigFile\DAQFamilyBucket\DataUploadConfig.json", @"D:\Run\ConfigFile\DAQFamilyBucket\DataUpload.csv" }); //------------------------------上传MDS的,只有一个这个------------------------------// //var mdsthing = new Jtext103.CFET2.Things.MDSUpload.MdsThing(); ////如果是 Master 用这行,注释掉下面 Slave,注意都不带后缀(因为有两个,一个.json一个.csv) //MyHub.TryAddThing(mdsthing, @"/", "mds", new string[]{ // @"D:\Run\ConfigFile\DAQFamilyBucket\MdsUploadMaster.json", // @"D:\Run\ConfigFile\DAQFamilyBucket\MdsUpload.csv" } // ); ////如果是 Slave 用这行,同时一定要将 AIManagementThing 注释掉!!! //MyHub.TryAddThing(mdsthing, @"/", "mds", new string[]{ // @"D:\Run\ConfigFile\DAQFamilyBucket\MdsUploadSlave.json", // @"D:\Run\ConfigFile\DAQFamilyBucket\MdsUpload.csv" } // ); //说明: //一键注释:选中代码并按 Ctrl+K Ctrl+C //一键解除注释:选中代码并按 Ctrl+K Ctrl+U //退程序不要点右上角的 X !输入 exit 回车退出 }