public static void Main(string[] args) { var manager = new SampleNodeManager(); // If the server domain name does not match localhost just replace it // e.g. with the IP address or name of the server machine. OpcServer server = new OpcServer("opc.tcp://localhost:4840/SampleServer", manager); //// NOTE: All HDA specific code will be found in the SampleNodeManager.cs. server.Start(); CreateHistoryEntries(manager); Console.Write("Server started - press any key to exit."); Console.ReadKey(true); server.Stop(); }
private static void CreateHistoryEntries(SampleNodeManager manager) { var random = new Random(); if (manager.PositionHistorian.History.IsEmpty()) { CreateHistoryEntries( manager.PositionHistorian, modifier => random.Next(-1000, 1000) / modifier); } manager.PositionHistorian.AutoUpdateHistory = true; if (manager.TemperatureHistorian.History.IsEmpty()) { CreateHistoryEntries( manager.TemperatureHistorian, modifier => (double)random.Next(-70, 150) / modifier); } manager.TemperatureHistorian.AutoUpdateHistory = true; }