在OPC服务器中对项目进行排序 [英] Sorting items in OPC Server

查看:129
本文介绍了在OPC服务器中对项目进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试实现具有特定对象结构的OPC服务器,如下面的示例所示:

We are trying to implement an OPC Server, with a specific objects structure, as you can see in the following example:

  • 节点X
    • 第1项
    • 第2项
    • 第3项
    • 第4项
    • 第5项
    • 第6项
    • 第7项
    • ...(直到300)
    • Node X
      • Item 1
      • Item 2
      • Item 3
      • Item 4
      • Item 5
      • Item 6
      • Item 7
      • ... (till 300)
      • ...

      但是,出于某些奇怪的原因,在几个OPC客户端中,项目显示如下:

      But, for some strange reason, in several OPC clients the items are shown like this:

      • 节点X
        • 第3项
        • 第11项
        • 第22项
        • 第33项
        • 第44项
        • 第55项
        • 第4项
        • ...(直到300)
        • Node X
          • Item 3
          • Item 11
          • Item 22
          • Item 33
          • Item 44
          • Item 55
          • Item 4
          • ... (till 300)
          • ...

          我们的主要问题是对列表中的项目进行排序.如您在屏幕快照中所见,未在OPC客户端中显示项目的排序,我们尝试了多个OPC客户端,其中一些具有特殊的选项以排序方式显示项目,而另一些则没有.

          Our main problem is about sorting the items in the list. As you can see in the screenshot the items are not shown sorted in the OPC client, and we have tried several OPC clients and some of them have a special option to show the items in a sorted way and some others no.

          问题是...如果我们要为市场上所有现有的OPC客户创建通用的OPC服务器,则服务器有责任为已分类的物品提供服务,对吗?还是...客户的责任?

          The thing is... if we are creating a generic OPC Server for all the existing OPC clients in the market... it is responsibility of the server to serve the items sorted, right? or... is it responsibility of the client?

          从概念上讲,这是正确的方法吗?

          Conceptually, which is the correct way?

          我的感觉是,OPC Server应该对所有已排序的项目进行排序,但是我不确定是否可行和标准.

          My feeling is that the OPC Server should give all the items sorted anyway, but I'm not sure if it is possible and standard.

          否则,世界上有很多SCADA,可以肯定的是,尝试在屏幕上显示项目列表会像未提供的示例中那样显示未排序的项目,当您拥有一个SCADA时,这是一个大问题.列表中约有300个项目.

          Otherwise, there are a lot of SCADA's in the world, for sure, that trying to show the list of items in a screen will show them not sorted, as in the sample provided, and this is a big problem when you have around 300 items in a list.

          感谢您的协作!

          推荐答案

          项目顺序在OPC规范中不重要.另外,OPC不会告诉"服务器枚举项目的顺序,也不会告诉"客户端显示物品的顺序.

          The order of items has no significance in OPC specifications. In addition, OPC does not "tell" the servers in which order they should enumerate the items, and it does not "tell" the clients in which order they should display them.

          如果要查看以特定方式订购的项目,则最好的办法是开发OPC服务器,以使其确实按该顺序枚举它们.通过这种方式完成后,不以任何方式对传入项目进行排序的OPC客户端将按照您选择的顺序列出它们.对于决定以某种方式对项目进行分类的OPC客户,您很不走运-他们将始终按照自己的方式进行.我认为,向用户展示商品的良好OPC客户应该允许他们影响订购,但这取决于他们.

          If you want to see the items ordered in a specific way, the best you can do is to develop your OPC server so that it indeed enumerates them in that order. When done this way, the OPC clients that do NOT sort the incoming items in any way will list them in the order you have chosen. With OPC clients that decide to sort the items somehow, you are out of luck - they will always do it their way. I would argue that good OPC clients that present the items to the user should allow them to influence the ordering, but that's up to them.

          此外,您提供的示例顺序在某种程度上类似于使用哑"顺序对字符串进行排序而不在其中查找自然数顺序时发生的情况.这导致了数字排序,其中数字较少的数字散布在数字较多的数字内,而不是数字取其数值.但是,如果是这样,您的示例将更需要这样:

          Also, the example order you presented somewhat resembles what happens when strings are sorted using the "dumb" ordering, and not looking for the natural number order in them. This leads to number ordering where numbers with less digits are interspersed within numbers with more digits, instead of numbers being taken for their numerical value. But, if that was the case, you example would like more like this:

          • >-节点X

            • > - Node X

              -项目1 -项目10 -项目11 -项目12 -... -项目2 -项目20 -项目21 -项目22 -... -项目3 -项目30 -...

              -- Item 1 -- Item 10 -- Item 11 -- Item 12 -- ... -- Item 2 -- Item 20 -- Item 21 -- Item 22 -- ... -- Item 3 -- Item 30 -- ...

              • 节点Y

              那不是你得到的吗? (但无论如何,答案的第一部分仍然适用).

            • Isn't that what you are getting? (but regardless of it, the first part of the answer applies anyway).

              这篇关于在OPC服务器中对项目进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆