public void SendAllPoints() { Stats.Clear(); long points; StopReading = false; var settings = new HistorianServerDatabaseConfig("PPA", @"C:\Program Files\openHistorian\Archive\", true); using (HistorianServer server = new HistorianServer(settings)) { Thread.Sleep(1000); for (int x = 1; x < 30; x++) { StartReader(); Thread.Sleep(1000); if (x == 1) Thread.Sleep(5000); Interlocked.Exchange(ref Stats.PointsReturned, 0); Thread.Sleep(1000); long v = Interlocked.Read(ref Stats.PointsReturned); Console.WriteLine("Clients: " + x.ToString() + " points " + v.ToString()); } StopReading = true; Thread.Sleep(2000); } Thread.Sleep(2000); }
public void Test1() { Logger.Console.Verbose = VerboseLevel.All; var netStream = new NetworkStreamSimulator(); var dbcfg = new HistorianServerDatabaseConfig("DB", @"C:\Archive", true); var server = new HistorianServer(dbcfg); var auth = new SecureStreamServer<SocketUserPermissions>(); auth.SetDefaultUser(true, new SocketUserPermissions() { CanRead = true, CanWrite = true, IsAdmin = true }); var netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host); ThreadPool.QueueUserWorkItem(ProcessClient, netServer); var client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), true); var db = client.GetDatabase("DB"); client.Dispose(); server.Dispose(); }
private void BtnStart_Click(object sender, EventArgs e) { GSF.Globals.MemoryPool.SetMaximumBufferSize(long.Parse(TxtMaxMB.Text) * 1024 * 1024); var settings = new HistorianServerDatabaseConfig(txtDbName.Text, TxtArchivePath.Text, true); m_server = new HistorianServer(settings, int.Parse(TxtLocalPort.Text)); BtnStart.Enabled = false; AllocConsole(); Logger.Console.Verbose = VerboseLevel.High; }
public void Start(string[] paths) { m_database = "PPA"; var settings = new HistorianServerDatabaseConfig(m_database, null, false); settings.ImportPaths.AddRange(paths); m_localServer = new HistorianServer(settings); var query = new HistorianQuery(SnapClient.Connect(m_localServer.Host)); m_updateFramework.Start(query); m_updateFramework.Mode = ExecutionMode.Manual; m_updateFramework.Enabled = true; }
private void btnOpenFile_Click(object sender, EventArgs e) { using (OpenFileDialog dlgOpen = new OpenFileDialog()) { dlgOpen.Filter = "openHistorian 2.0 file|*.d2"; if (dlgOpen.ShowDialog() == DialogResult.OK) { var db = new HistorianServerDatabaseConfig("", "", false); db.ImportPaths.AddRange(dlgOpen.FileNames); m_archiveFile = new HistorianServer(db); } } BuildListOfAllPoints(); }
public void TestReadData() { var key = new HistorianKey(); var value = new HistorianValue(); var settings = new HistorianServerDatabaseConfig("DB", @"c:\temp\Scada\", true); using (HistorianServer server = new HistorianServer(settings, 12345)) { using (var client = new HistorianClient("127.0.0.1", 12345)) using (var database = client.GetDatabase<HistorianKey, HistorianValue>("DB")) { var stream = database.Read(0, 1000); while (stream.Read(key, value)) Console.WriteLine(key.Timestamp); } } }
public void TestReadData() { using (var server = new HistorianServer(new HistorianServerDatabaseConfig("DB", @"c:\temp\Scada\", false), 1234)) { using (var client = SnapClient.Connect(server.Host)) { var database = client.GetDatabase<HistorianKey, HistorianValue>("DB"); var stream = database.Read(10, 800 - 1); HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); while (stream.Read(key, value)) { Console.WriteLine(key.Timestamp); } } } }
public void CreateAllDatabases() { Logger.Console.Verbose = VerboseLevel.All; Array.ForEach(Directory.GetFiles(@"c:\temp\Scada\", "*.d2", SearchOption.AllDirectories), File.Delete); Array.ForEach(Directory.GetFiles(@"c:\temp\Synchrophasor\", "*.d2", SearchOption.AllDirectories), File.Delete); var config1 = new HistorianServerDatabaseConfig("Scada", @"c:\temp\Scada\", true); var config2 = new HistorianServerDatabaseConfig("Synchrophasor", @"c:\temp\Synchrophasor\", true); HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); using (HistorianServer server = new HistorianServer()) { server.AddDatabase(config1); server.AddDatabase(config2); using (var client = SnapClient.Connect(server.Host)) { var database = client.GetDatabase<HistorianKey, HistorianValue>("Scada"); for (ulong x = 0; x < 10000; x++) { key.Timestamp = x; database.Write(key, value); } database.HardCommit(); database = client.GetDatabase<HistorianKey, HistorianValue>("Synchrophasor"); for (ulong x = 0; x < 10000; x++) { key.Timestamp = x; database.Write(key, value); } database.HardCommit(); } } }
public void TestReadData() { var config1 = new HistorianServerDatabaseConfig("Scada", @"c:\temp\Scada\", true); var config2 = new HistorianServerDatabaseConfig("Synchrophasor", @"c:\temp\Synchrophasor\", true); using (HistorianServer server = new HistorianServer()) { server.AddDatabase(config1); server.AddDatabase(config2); using (var client = SnapClient.Connect(server.Host)) { var database = client.GetDatabase<HistorianKey,HistorianValue>("Scada"); TreeStream<HistorianKey, HistorianValue> stream = database.Read(0, 100); stream.Dispose(); database = client.GetDatabase<HistorianKey, HistorianValue>("Synchrophasor"); stream = database.Read(0, 100); stream.Dispose(); } } }
public void CreateScadaDatabase() { Logger.Console.Verbose = VerboseLevel.All; Array.ForEach(Directory.GetFiles(@"c:\temp\Scada\", "*.d2", SearchOption.AllDirectories), File.Delete); var key = new HistorianKey(); var value = new HistorianValue(); var settings = new HistorianServerDatabaseConfig("DB", @"c:\temp\Scada\", true); using (var server = new HistorianServer(settings)) using (var client = SnapClient.Connect(server.Host)) { var database = client.GetDatabase<HistorianKey, HistorianValue>("db"); for (ulong x = 0; x < 1000; x++) { key.Timestamp = x; database.Write(key, value); } database.HardCommit(); } }
public void TestRemoteAdapter() { HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); var settings = new HistorianServerDatabaseConfig("PPA", @"c:\temp\historian\", true); using (HistorianServer server = new HistorianServer(settings)) using (var client = SnapClient.Connect(server.Host)) { using (HistorianInputQueue queue = new HistorianInputQueue(() => client.GetDatabase<HistorianKey, HistorianValue>(string.Empty))) { for (uint x = 0; x < 100000; x++) { key.PointID = x; queue.Enqueue(key, value); } Thread.Sleep(100); } Thread.Sleep(100); } //Thread.Sleep(100); }
public void CreateScadaDatabase() { Array.ForEach(Directory.GetFiles(@"c:\temp\Scada\", "*.d2", SearchOption.AllDirectories), File.Delete); var key = new HistorianKey(); var value = new HistorianValue(); var settings = new HistorianServerDatabaseConfig("DB", @"c:\temp\Scada\", true); using (var server = new HistorianServer(settings, 12345)) { using (var client = new HistorianClient("127.0.0.1", 12345)) using (var database = client.GetDatabase<HistorianKey, HistorianValue>("DB")) { for (ulong x = 0; x < 1000; x++) { key.Timestamp = x; database.Write(key, value); } database.HardCommit(); System.Threading.Thread.Sleep(1200); } } }
public static void ReadAllPoints() { Stopwatch sw = new Stopwatch(); int pointCount = 0; var settings = new HistorianServerDatabaseConfig("PPA", @"C:\Program Files\openHistorian\Archive\", true); using (HistorianServer server = new HistorianServer(settings)) { DateTime start = DateTime.FromBinary(Convert.ToDateTime("2/1/2014").Date.Ticks + Convert.ToDateTime("6:00:00PM").TimeOfDay.Ticks).ToUniversalTime(); using (var client = new HistorianClient("127.0.0.1", 12345)) using (var database = client.GetDatabase<HistorianKey, HistorianValue>(String.Empty)) { HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); sw.Start(); var scan = database.Read((ulong)start.Ticks, ulong.MaxValue); while (scan.Read(key, value) && pointCount < 10000000) pointCount++; sw.Stop(); //sw.Start(); //using (var frameReader = database.GetPointStream(DateTime.MinValue, DateTime.MaxValue)) //{ // while (frameReader.Read()) // ; //} //sw.Stop(); } } Console.WriteLine(pointCount); Console.WriteLine(sw.Elapsed.TotalSeconds.ToString()); Console.WriteLine((pointCount / sw.Elapsed.TotalSeconds / 1000000).ToString()); }
public HistorianIArchive(HistorianServer server, string databaseName) { m_server = server; m_client = SnapClient.Connect(m_server.Host); m_clientDatabase = m_client.GetDatabase<HistorianKey, HistorianValue>(databaseName); }
/// <summary> /// Attempts to connect to this <see cref="LocalOutputAdapter"/>. /// </summary> protected override void AttemptConnection() { // Open archive files Dictionary<string, string> settings = m_dataChannel.ParseKeyValuePairs(); string setting; int port; if (!settings.TryGetValue("port", out setting) || !int.TryParse(setting, out port)) port = DefaultPort; m_server = new HistorianServer(m_archiveInfo, port); m_archive = m_server[InstanceName]; // Initialization of services needs to occur after files are open m_dataServices.Initialize(); m_replicationProviders.Initialize(); OnConnected(); }
/// <summary> /// Attempts to disconnect from this <see cref="LocalOutputAdapter"/>. /// </summary> protected override void AttemptDisconnection() { m_archive = null; m_server.Dispose(); m_server = null; OnDisconnected(); m_archivedMeasurements = 0; }
public static void TestReadPoints2() { int pointCount = 0; HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); var settings = new HistorianServerDatabaseConfig("PPA", @"C:\Program Files\openHistorian\Archive\", true); using (HistorianServer server = new HistorianServer(settings)) { Stopwatch sw = new Stopwatch(); sw.Start(); using (var client = new HistorianClient("127.0.0.1", 12345)) using (var database = client.GetDatabase<HistorianKey, HistorianValue>(String.Empty)) { var stream = database.Read(0, (ulong)DateTime.MaxValue.Ticks, new ulong[] { 65, 953, 5562 }); while (stream.Read(key, value)) pointCount++; } sw.Stop(); //MessageBox.Show(sw.Elapsed.TotalSeconds.ToString()); } }
public void TestWriteServer() { HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); Logger.Console.Verbose = VerboseLevel.All; Logger.FileWriter.SetPath(@"C:\Temp\", VerboseLevel.All); var netStream = new NetworkStreamSimulator(); var dbcfg = new HistorianServerDatabaseConfig("DB", @"C:\Temp\Scada", true); var server = new HistorianServer(dbcfg); var auth = new SecureStreamServer<SocketUserPermissions>(); auth.SetDefaultUser(true, new SocketUserPermissions() { CanRead = true, CanWrite = true, IsAdmin = true }); var netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host); ThreadPool.QueueUserWorkItem(ProcessClient, netServer); var client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), false); var db = client.GetDatabase<HistorianKey, HistorianValue>("DB"); for (uint x = 0; x < 1000; x++) { key.Timestamp = x; db.Write(key, value); break; } client.Dispose(); server.Dispose(); }
public HistorianIArchive(HistorianServer server, string databaseName) { m_server = server; m_client = SnapClient.Connect(m_server.Host); m_clientDatabase = m_client.GetDatabase <HistorianKey, HistorianValue>(databaseName); }
public HistorianHost() { Directory.GetFiles(@"G:\HistorianData\", "*.d2").ToList().ForEach(File.Delete); var settings = new HistorianServerDatabaseConfig("DB", @"G:\HistorianData\", true); m_server = new HistorianServer(settings); }
public void TestReadData() { HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); var settings = new HistorianServerDatabaseConfig("PPA", @"c:\temp\Scada\", true); using (HistorianServer server = new HistorianServer(settings)) { double count = 0; DebugStopwatch sw = new DebugStopwatch(); double time = sw.TimeEvent(() => { count = 0; using (HistorianClient client = new HistorianClient("127.0.0.1", 12345)) using (ClientDatabaseBase<HistorianKey, HistorianValue> database = client.GetDatabase<HistorianKey, HistorianValue>(String.Empty)) { //IHistorianDatabase<HistorianKey, HistorianValue> database = server.GetDefaultDatabase();//.GetDatabase(); //TreeStream<HistorianKey, HistorianValue> stream = reader.Read(0, ulong.MaxValue, new ulong[] { 2 }); TreeStream<HistorianKey, HistorianValue> stream = database.Read(0, ulong.MaxValue); while (stream.Read(key,value)) { count++; } } }); Console.WriteLine((count / 1000000 / time).ToString() + " Million PPS"); } //Console.WriteLine("KeyMethodsBase calls"); //for (int x = 0; x < 23; x++) //{ // Console.WriteLine(TreeKeyMethodsBase<HistorianKey>.CallMethods[x] + "\t" + ((TreeKeyMethodsBase<HistorianKey>.Method)(x)).ToString()); //} //Console.WriteLine("ValueMethodsBase calls"); //for (int x = 0; x < 5; x++) //{ // Console.WriteLine(TreeValueMethodsBase<HistorianValue>.CallMethods[x] + "\t" + ((TreeValueMethodsBase<HistorianValue>.Method)(x)).ToString()); //} //for (int x = 0; x < 15; x++) //{ // Console.WriteLine(BinaryStreamBase.CallMethods[x] + "\t" + ((BinaryStreamBase.Method)(x)).ToString()); //} }