Ejemplo n.º 1
0
        /// Connect to selected client

        /** Parameter "URL" must be either "DEVICE" or "SIMULATOR". No other inputs supported for now.
         * Simulator and device URLs hard-coded into controller. Support for other URLs can be added later.
         * <param name="URL">"SIMULATOR" or "DEVICE"</param>
         */
        public void connectClient(string URL)
        {
            // Physical device if selected
            if (URL == "DEVICE")
            {
                this.URL = DEVICE_URL;
            }
            // Simulator by default
            else
            {
                this.URL = SIMULATOR_URL;
            }

            // Try connecting to client
            try
            {
                simulatorParams = new Tut.MppOpcUaClientLib.MppClient.MppClientCtorParams(this.URL);
                client          = new Tut.MppOpcUaClientLib.MppClient(simulatorParams);
                startListener();
                assignUnits();

                //Handle exception if failed
            } catch (Exception e)
            {
                Console.WriteLine("------- ERROR CONNECTING--------");
                Console.WriteLine(e);
                Console.WriteLine("-------                 --------");
                throw;
            }
        }
Ejemplo n.º 2
0
 /// Constructor
 /// <param name="name">Name (code) of the device</param>
 /// <param name="client">Reference to MppClient object</param>
 /// <param name="listener">Reference to Listener object</param>
 public Heater(String name, ref Tut.MppOpcUaClientLib.MppClient client, ref Listener listener)
 {
     this.name     = name;
     isOn          = false;
     this.client   = client;
     this.listener = listener;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name (code) of the corresponding device. Example: V104</param>
 /// <param name="client">Reference to MppClient object</param>
 /// <param name="listener">Reference to Listener object</param>
 public FlowControlValve(String name, ref Tut.MppOpcUaClientLib.MppClient client, ref Listener listener)
 {
     this.name     = name;
     this.client   = client;
     this.listener = listener;
     //Some default values
     this.pValue      = 0;
     this.iValue      = 0;
     this.targetValue = 0;
     this.piThread    = new Thread(() => {});
 }
Ejemplo n.º 4
0
        /// Constructor

        /** Takes the main window as a parameter. Window is used to send update calls for GUI
         */
        public Controller(MainWindow window)
        {
            this.window        = window;
            client             = null;
            listener           = new Listener(window);
            URL                = SIMULATOR_URL;
            parameters         = null;
            ImpregnationThread = new Thread(() => {});
            BlackLiquorThread  = new Thread(() => {});
            WhiteLiquorThread  = new Thread(() => {});
            CookingThread      = new Thread(() => {});
            DischargeThread    = new Thread(() => {});
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name (code) of the corresponding device. Example: "P100"</param>
 /// <param name="client">Reference to MppClient object</param>
 public Pump(String name, ref Tut.MppOpcUaClientLib.MppClient client)
 {
     this.name   = name;
     this.client = client;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the corresponding device. Example: "V302"</param>
 /// <param name="client">Reference to MppClient object</param>
 public OnOffValve(String name, ref Tut.MppOpcUaClientLib.MppClient client)
 {
     this.name   = name;
     this.client = client;
 }