LV使用XBOX ONE
- 5GHZ无线传输
- 使用LV的XBOX ONE Package即可
- 参考范例
Network Endpoint Actors
- Message Stream
- Network Endpoints manage a Message Stream. Message Stream is an abstract class that defines an API for transmitting Actor Framework messages between applications. Children of this class adapt specific protocols, like TCP/IP or Network Streams to the API. Message Streams will transmit and receive any message class.
- Network Endpoint(端点)
- Use Write Message Stream.vi to specify the Message Stream that will be used for the connection. You must set this value prior to launching the actor.
- Use Write timeout.vi to set the amount of time the actor will wait while attempting to create an endpoint (i.e. while waiting for a connection).
- Network Endpoints have no message classes of their own; you can send any message class to an endpoint. Stop and Last Ack are handled locally; anything else is forwarded to the remote endpoint.
- Nested Endpoints(嵌套端点)
- A Nested Endpoint is a Network Endpoint that is launched by a calling actor.
- The nested endpoint will forward messages it receives from its caller across the network. Any message the nested endpoint receives from across the network will be passed up to its caller.
- Connected Msg(握手信息?)
- Nested Endpoints send a Connected Msg to their callers when they successfully connect to a remote endpoint (of any type). Connected messages are abstract; the caller must provide the actual implementation to be used. The payload of a Connected message is the nested endpoint’s enqueuer; use this data when you are using multiple nested endpoints, and need to identify which endpoint has successfully connected.
- Payload 解释:有效载荷
记载着信息的那部分数据。通常在传输数据时,为了使数据传输更可靠,要把原始数据分批传输,并且在每一批数据的头和尾都加上一定的辅助信息,比如这一批数据量的大小,校验位等,这样就相当于给已经分批原始数据加一些外套,这些外套起到标示作用,使得原始数据不易丢失。一批数据加上它的“外套”,就形成了传输通道中基本的传输单元,叫做数据帧或者数据包(有的地方数据帧和数据包不是同一概念比如网络传输)。这些数据帧中的记录信息的原始数据就是有效载荷数据,即payload data。而消息体就是外套。即标记着原始数据的大小等的辅助信息。
- Use Write Connected Msg.vi to set a concrete implementation of Connected Msg to send to the caller.
- Caller Endpoints(主端点)
- A Caller Endpoint is a Network Endpoint that sits at the top of an actor tree.
- Caller endpoints launch a single nested actor that you specify.
- If a remote actor uses a nested endpoint to connect to a local caller endpoint, the caller endpoint's nested actor will act like a nested actor of the remote actor.
- Use Read/Write Nested Actor.vi to get or set the nested actor called by the Caller Endpoint.
- Message Streams(消息流:封装了TCP/IP或者网络流的概念)
- Passing an instance of TCP Stream Initiator to a network endpoint means the endpoint will attempt to connect to another endpoint. Passing an instance of TCP Stream Listener to a network endpoint means the endpoint will wait passively for a connection. In either case, if no connection is made within the timeout period, the endpoint will shut down and return an error.
- Both Initiator and Listener classes include a Create method. Create methods take address information as inputs, and return a Message Stream object.
- Message Streams can accept a Cipher plug-in, which you can use to encrypt/decrypt transmitted messages. Cipher is an abstract class; inherit from this class to add specific ciphers to your application.
- 工作思路
- 本地端的主操作者进行网络化改造,远端主机安装LV,建立一个操作者框架项目,建立主操作者进行网络化改造。
- 实践
- 两台电脑上必须有项目的所有文件,但是各自执行自己的代码,各自执行的代码可以自己修改,只要不修改形式参数(函数定义)就可以正常运行
- 先开远程的TCP监听端口,在建立nestedendpoint.lvclass 时设置timeout长度,可以设置长一些,例如10000ms。注意在TCP发起端口设置的超时时长无效。
Launch Remote Actor(嵌套网络操作者)
- 老师电脑IP:10.0.126.4
- PTB:10.0.126.13
- LZS:10.0.126.11
- P3-AT:10.0.126.3
- 老版本示例程序执行错误原因分析
- 原理:主调操作者在获取远端的应用程序引用后,通过代理操作者寻找远端主机中的两个VI并且调用之,在调用这些VI时会传递一些参数,其中包括一个IP地址。
- 采用老版本AF的示例程序在获取应用程序引用后,传递了一个错误的IP地址,这个IP地址不是有线网卡的IP地址,而是虚拟机软件的虚拟网卡的网络地址。
- 所以,在主调操作者主机上应该在设备管理器卸载这两个虚拟网卡(一定要卸载,而不是禁用!)
- 当出现问题时,到远程主机上
- 使用新版本AF对示例程序进行适配
- 不管是老版本还是新版本,在LV项目管理器的组织下都无法成功执行!
- 对老版本示例程序的改造
- upperproxyactor中核心函数的port改为常量。该VI成功执行,输出没有错误。
- 后来还是出现了错误,无法解决。
- 写了一篇文档在论坛发布,等候回复。
- 回复请见另一篇笔记[11.18]
The Actor Framework Project Provider(niACS)[PDF]
- Creating Messages for Zero Coupling(零耦合消息)很有用!!
- 此方法将send.vi和DO.vi分开,使得灵活性更大,以往如果主操作者想发送同一类型的数据给不同的子操作者,需要在每一个子操作者中定义一个完整的消息函数类,现在只需要定义一个包含send.vi的消息虚类,然后在每个子操作者中继承这个子类,创建的子消息类只需包含一个DO.vi即可。
- 这样减轻了工作量,增强了代码复用。
MGI Actor Framework Message Maker
- (略)
Should I use the AF?
- 技术层面!什么情况下应该使用AF呢?
- 在以后的项目中重复使用状态机
- 这些操作者有共同的特点,比如功能类似
- AF可以减少你构建消息机制的时间消耗,增强代码复用
- 非技术层面
- 时间,尝试使用一个新的框架是很耗时的,尤其是你不熟悉LVOOP的情况下。你如果对于OO很熟悉,也能够全心投入其中,则可以试一试。
- 系统架构完后由谁维护呢?如果自己维护,那就随便了。如果是客户方负责维护,他们可不会去看AF操作者框架,那就会有问题了。
- 在使用AF的过程中,注意类的继承和功能划分
- As this is your first AF project, you can expect to have to do some rework before you are finished. You'll design a set of actors, and then realize that you've missed an opportunity for inheritance, or that functionality in Actor A needs to be in Actor B. (To be honest, though, I have found that is always true, regardless of project, framework, or level of experience. I've learned not to fear the rework.) How tolerant of that necessity is your environment?
- 当前的AF的项目模板太糟了!但是示例项目(蒸发冷却器)很完整,但是很难懂!
- 在深刻理解AF框架方面还有很长一段路要走!有时间一定要认认真真看技术文档,这对于理解软件设计模式与论文写作都有很大的作用。
Class Method Browser
- (略)
Community search tips
- (不需要看,略)