public void InitiateSystemInterfacesAndExecution()
        {
            if (_isOnlyConnectingAndLoggingWeight == false)
            {
                ConfigurePowerSupplyComPort();
                InitPowerSupply();
            }
            else
            {
                _handlerRs232PowerSupply = null;
            }

            ConfigureWeightScaleComPort();
            InitWeightScale();
        }
        private void InitPowerSupply()
        {
            _logger.Information($"Initiate connection to power supply for Silo");

            Color color = Color.Green;

            if (_isPowerSupplyTestMode)
            {
                _psSerialConnection = new SerialConnectionPsTest();
                color = Color.DarkOrange;
            }
            else
            {
                _psSerialConnection = new SerialConnection();
            }


            try
            {
                _handlerRs232PowerSupply = new HandlerRs232PowerSupply(_psSerialConnection);
                _handlerRs232PowerSupply.OpenConnection(_powerSupplyConfig.ComPort, _powerSupplyConfig.BaudRate, _powerSupplyConfig.Parity,
                                                        _powerSupplyConfig.StopBits, _powerSupplyConfig.DataBits, _powerSupplyConfig.Handshake,
                                                        _powerSupplyConfig.NewLine, _powerSupplyConfig.ReadMode);

                _logger.Information($"Opened port to Silo");

                _handlerRs232PowerSupply.OnDataRead += ReadVoltageSetting;

                UpdateLabel(label_powerSupply, $"Silo tilkobling, {_powerSupplyConfig.ComPort}", color);
            }
            catch (Exception e)
            {
                _handlerRs232PowerSupply = null;
                _logger.Error($"Exception InitPowerSupply: {e.Message}");
            }
        }