OPC UA 客户端 连接 服务器返回的 EndpointUrl 为什么会变成opc:tcp://0.0.0.0:4840

ChenMooMo 2017-01-16 02:23:27
客户端传过去的 Url 为 opc.tcp://190.160.9.219:4840 处理完后得到的 endpoint.EndpointUrl=opc.tcp://0.0.0.0:4840,为什么会这样呢?
...全文
1619 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jwh2004 2017-01-18
  • 打赏
  • 举报
回复
没用过你这个,这是什么dll,OPC中国上的吗还是哪里的
ChenMooMo 2017-01-16
  • 打赏
  • 举报
回复
求大神帮忙解答,
ChenMooMo 2017-01-16
  • 打赏
  • 举报
回复
代码:
public void Connect(string Url)
        {
            try
            {
                // Create the configuration.     
                ApplicationConfiguration configuration = Helpers.CreateClientConfiguration();

                // Create the endpoint description.
                EndpointDescription endpointDescription = Helpers.CreateEndpointDescription(Url);

                // Create the endpoint configuration (use the application configuration to provide default values).
                EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(configuration);

                // The default timeout for a requests sent using the channel.
                endpointConfiguration.OperationTimeout = 300000;

                // Use the pure binary encoding on the wire.
                endpointConfiguration.UseBinaryEncoding = true;

                // Create the endpoint.
                ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration);

                // Create the binding factory.
                BindingFactory bindingFactory = BindingFactory.Create(configuration);

                // Update endpoint description using the discovery endpoint.
                if (endpoint.UpdateBeforeConnect)
                {
                    endpoint.UpdateFromServer(bindingFactory);
                    endpointDescription = endpoint.Description;
                    endpointConfiguration = endpoint.Configuration;
                }

                //endpoint.EndpointUrl = new Uri("opc.tcp://190.160.9.219:4840");

                X509Certificate2 clientCertificate = configuration.SecurityConfiguration.ApplicationCertificate.Find();

                // Set up a callback to handle certificate validation errors.
                configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);

                // Initialize the channel which will be created with the server.
                SessionChannel channel = SessionChannel.Create(
                    configuration,
                    endpointDescription,
                    endpointConfiguration,
                    bindingFactory,
                    clientCertificate,
                    null);

                // Wrap the channel with the session object.
                // This call will fail if the server does not trust the client certificate.
                m_Session = new Session(channel, configuration, endpoint);
                m_Session.ReturnDiagnostics = DiagnosticsMasks.All;

                // Register keep alive callback.
                m_Session.KeepAlive += new KeepAliveEventHandler(Session_KeepAlive);

                UserIdentity identity = new UserIdentity();

                // Create the session. This actually connects to the server.
                // Passing null for the user identity will create an anonymous session.
                m_Session.Open("ClientUA_1", identity);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
ChenMooMo 2017-01-16
  • 打赏
  • 举报
回复
代码:

public void Connect(string Url)
        {
            try
            {
                // Create the configuration.     
                ApplicationConfiguration configuration = Helpers.CreateClientConfiguration();

                // Create the endpoint description.
                EndpointDescription endpointDescription = Helpers.CreateEndpointDescription(Url);

                // Create the endpoint configuration (use the application configuration to provide default values).
                EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(configuration);

                // The default timeout for a requests sent using the channel.
                endpointConfiguration.OperationTimeout = 300000;

                // Use the pure binary encoding on the wire.
                endpointConfiguration.UseBinaryEncoding = true;

                // Create the endpoint.
                ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration);

                // Create the binding factory.
                BindingFactory bindingFactory = BindingFactory.Create(configuration);

                // Update endpoint description using the discovery endpoint.
                if (endpoint.UpdateBeforeConnect)
                {
                    endpoint.UpdateFromServer(bindingFactory);
                    endpointDescription = endpoint.Description;
                    endpointConfiguration = endpoint.Configuration[code=csharp]
; } X509Certificate2 clientCertificate = configuration.SecurityConfiguration.ApplicationCertificate.Find(); // Set up a callback to handle certificate validation errors. configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation); // Initialize the channel which will be created with the server. SessionChannel channel = SessionChannel.Create( configuration, endpointDescription, endpointConfiguration, bindingFactory, clientCertificate, null); // Wrap the channel with the session object. // This call will fail if the server does not trust the client certificate. m_Session = new Session(channel, configuration, endpoint); m_Session.ReturnDiagnostics = DiagnosticsMasks.All; // Register keep alive callback. m_Session.KeepAlive += new KeepAliveEventHandler(Session_KeepAlive); UserIdentity identity = new UserIdentity(); // Create the session. This actually connects to the server. // Passing null for the user identity will create an anonymous session. m_Session.Open("ClientUA_1", identity); } catch (Exception e) { throw e; } } [/code]
内容概要:本文研究了基于Q-Learning自适应强化学习的PID控制器在自主水下航行器(AUV)运动控制中的应用,旨在提升其在复杂海洋环境下的控制性能。通过建立AUV的动力学模型,将Q-Learning算法与传统PID控制相结合,实现控制器参数的在线自适应优化,有效增强了系统的响应速度、稳定性和抗干扰能力。研究采用Matlab进行仿真验证,结果表明该方法在轨迹跟踪与姿态控制方面具有优越表现,为水下机器人智能控制提供了可行的技术路径与理论支持。; 适合人群:具备自动控制理论、强化学习或水下机器人建模背景,从事相关科研工作的研究人员、高校研究生及工程技术开发者。; 使用场景及目标:①应用于高精度、强鲁棒性的水下机器人运动控制系统设计;②开展智能PID控制器在非线性、时变系统中的参数自整定研究;③作为强化学习在复杂工业控制场景中落地的典型案例参考,推动算法与工程实践融合。; 阅读建议:建议结合提供的Matlab代码进行仿真实验,重点剖析Q-Learning与PID融合的架构设计、奖励函数设定及参数收敛过程,可进一步拓展至与其他智能优化算法(如DQN、Actor-Critic)的对比研究,深化对自适应控制机制的理解。
已经博主授权,源码转载自 https://pan.quark.cn/s/a4b39357ea24 Matlab 被视为一种功能卓越的编程平台,特别是在数值运算和数据分析方面展现出广泛的应用价值。在应对多元非线性回归的挑战时,Matlab 拥备多种工具和函数,支持用户对复杂的数据进行构建模型和适配。本指南将重点阐释在 Matlab 环境下如何执行多元非线性回归分析。 我们需要掌握三种关键的回归指令: 1. `polyfit(x,y,n)`:此函数适用于拟合一元幂函数,能够导出一个多项式模型。例如,若知晓数据呈现二次函数形态,可选择`n=2`来适配一个二次曲线。 2. `regress(y,x)`:这是一个多元线性回归指令,能够处理多个自变量对因变量的影响。即便数据并非完全呈现线性特征,该函数也能提供一个线性近似。 3. `nlinfit(x,y,’fun’,beta0)`:这是最为通用的非线性回归指令,适用于适配任何类型的函数,无论是一元或多元,前提是用户能够定义函数形式(`fun`参数)。 回归分析的核心在于寻找一组最优的系数,使得模型能够最恰当地描述数据。这通常涉及选择一个合适的函数形态,随后通过最小化误差平方和来估算系数。在Matlab中,`regress`指令主要用于处理线性模型,而`nlinfit`则处理更为复杂的非线性模型。 对于多元线性回归模型,我们可以用如下形式进行表述: \[ y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \cdots + \beta_px_p + \epsilon \] 其中,\( y \)是因变量,\( x_1, x_2, \ldots, x_p \)是自变量,\( \beta_0, \beta_1, ...

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧