CN115037571B - A hub applied to star-shaped TTP network and its implementation method - Google Patents

A hub applied to star-shaped TTP network and its implementation method Download PDF

Info

Publication number
CN115037571B
CN115037571B CN202210629084.XA CN202210629084A CN115037571B CN 115037571 B CN115037571 B CN 115037571B CN 202210629084 A CN202210629084 A CN 202210629084A CN 115037571 B CN115037571 B CN 115037571B
Authority
CN
China
Prior art keywords
hub
module
synchronization
time
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210629084.XA
Other languages
Chinese (zh)
Other versions
CN115037571A (en
Inventor
牛萌
蹇红
刘坤
谢军
张超
涂晓东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
University of Electronic Science and Technology of China
Xian Flight Automatic Control Research Institute of AVIC
Original Assignee
University of Electronic Science and Technology of China
Xian Flight Automatic Control Research Institute of AVIC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by University of Electronic Science and Technology of China, Xian Flight Automatic Control Research Institute of AVIC filed Critical University of Electronic Science and Technology of China
Priority to CN202210629084.XA priority Critical patent/CN115037571B/en
Publication of CN115037571A publication Critical patent/CN115037571A/en
Application granted granted Critical
Publication of CN115037571B publication Critical patent/CN115037571B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/44Star or tree networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0036Systems modifying transmission characteristics according to link quality, e.g. power backoff arrangements specific to the receiver
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/44Star or tree networks
    • H04L2012/445Star or tree networks with switching in a hub, e.g. ETHERNET switch
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Small-Scale Networks (AREA)

Abstract

本发明涉及飞行器管理系统通信总线技术领域,公开了一种应用于星型TTP网络的集线器,包括设置在物理链路层的门控模块和收发模块,以及设置在协议层的启动控制模块、同步控制模块、时钟生成和同步模块、MEDL解析模块、帧解析模块、集群模式切换模块、整形模块、帧长计算模块和在线配置模块,本发明还公开了一种应用于星型TTP网络的集线器的实现方法,使用上述的应用于星型TTP网络的集线器。本发明基于集线器的启动原理,提出了一种基于Bigbang机制的启动方案,同时,本发明的启动方案包含三条启动路径,适配各种启动场景。

The present invention relates to the technical field of aircraft management system communication bus, and discloses a hub applied to a star-type TTP network, including a gating module and a transceiver module arranged at a physical link layer, and a startup control module, a synchronization control module, a clock generation and synchronization module, a MEDL parsing module, a frame parsing module, a cluster mode switching module, a shaping module, a frame length calculation module, and an online configuration module arranged at a protocol layer. The present invention also discloses an implementation method of a hub applied to a star-type TTP network, using the above-mentioned hub applied to a star-type TTP network. Based on the startup principle of the hub, the present invention proposes a startup scheme based on the Bigbang mechanism. At the same time, the startup scheme of the present invention includes three startup paths, which are adapted to various startup scenarios.

Description

一种应用于星型TTP网络的集线器及其实现方法A hub applied to star-shaped TTP network and its implementation method

技术领域Technical Field

本发明涉及飞行器管理系统通信总线技术领域,具体涉及一种应用于星型TTP网络的集线器及其实现方法。The present invention relates to the technical field of aircraft management system communication bus, and in particular to a hub applied to a star-shaped TTP network and an implementation method thereof.

背景技术Background technique

近年来,具有高可靠性、安全性和关键性的计算机系统被广泛应用于航空航天、汽车领域和工业控制等安全关键性领域。这样的计算机系统本质上需要一个分布式的解决方案,使得系统的一部分损坏不会导致整个系统失效。然而,空间分布意味着通信基础设施的实施,使得系统中的参与者能够交换信息。出于经济原因,通信基础设施通常需要被实现为共享资源,必须实施专用通信协议来协调其使用。这种通信协议可以建立在参与者本地时钟同步的基础上,采用总线保护器(Bus Guardian,BG)来保护与协调共享资源的使用。这种保护与协调共享资源的网络可以采用总线型时间触发网络来进行保护与协调,如图7所示;但是采用总线型时间触发网络,由于是一个双冗余系统,需要2n个总线保护器,因此,成本会很高。为了能够实现保护与协调共享资源的作用,在星型时间触发网络中可以使用较少的集线器来实现总线保护和协调TTP节点共享资源的作用,目前国内鲜有关于星型时间触发网络TTP的集线器的研究,因此,设计出一种应用于星型TTP网络、具有较好的实时性、确定性以及更好的容错性能的集线器,迫在眉睫。In recent years, computer systems with high reliability, safety and criticality have been widely used in safety-critical fields such as aerospace, automotive and industrial control. Such computer systems essentially require a distributed solution so that damage to one part of the system will not cause the entire system to fail. However, spatial distribution means the implementation of a communication infrastructure that enables participants in the system to exchange information. For economic reasons, the communication infrastructure usually needs to be implemented as a shared resource, and a dedicated communication protocol must be implemented to coordinate its use. This communication protocol can be based on the synchronization of the local clocks of the participants, and a bus guard (BG) is used to protect and coordinate the use of shared resources. This network that protects and coordinates shared resources can be protected and coordinated by a bus-type time-triggered network, as shown in Figure 7; however, the use of a bus-type time-triggered network, because it is a dual-redundant system, requires 2n bus protectors, so the cost will be very high. In order to realize the function of protecting and coordinating shared resources, fewer hubs can be used in the star-type time-triggered network to realize the function of bus protection and coordination of TTP node shared resources. At present, there is little research on the hub of star-type time-triggered network TTP in China. Therefore, it is urgent to design a hub for star-type TTP network with better real-time, deterministic and better fault-tolerant performance.

发明内容Summary of the invention

本发明提供一种应用于星型TTP网络的集线器及其实现方法,该星型时间触发网络基于时分复用技术,该集线器的设计使得星型时间触发网络具有更好的容错性且成本比总线型时间触发网络低。The present invention provides a hub applied to a star-type TTP network and an implementation method thereof. The star-type time trigger network is based on time division multiplexing technology. The design of the hub makes the star-type time trigger network have better fault tolerance and lower cost than a bus-type time trigger network.

本发明通过下述技术方案实现:The present invention is achieved through the following technical solutions:

一种应用于星型TTP网络的集线器,包括设置在物理链路层的门控模块和收发模块,以及设置在协议层的启动控制模块、同步控制模块、时钟生成和同步模块、MEDL解析模块、帧解析模块、集群模式切换模块、整形模块、帧长计算模块和在线配置模块,A hub applied to a star-shaped TTP network comprises a gating module and a transceiver module arranged at a physical link layer, and a startup control module, a synchronization control module, a clock generation and synchronization module, a MEDL parsing module, a frame parsing module, a cluster mode switching module, a shaping module, a frame length calculation module and an online configuration module arranged at a protocol layer.

所述收发模块的输入端分别与所述整形模块、门控模块、帧长计算模块连接,所述收发模块的输出端分别与所述门控模块、帧解析模块、在线配置模块连接;The input end of the transceiver module is respectively connected to the shaping module, the gating module, and the frame length calculation module, and the output end of the transceiver module is respectively connected to the gating module, the frame parsing module, and the online configuration module;

所述时间生成和同步模块的输入端分别与所述帧解析模块、整形模块、MEDL解析模块连接,所述时间生成和同步模块的输出端分别与启动控制模块、同步控制模块连接;The input end of the time generation and synchronization module is connected to the frame analysis module, the shaping module, and the MEDL analysis module respectively, and the output end of the time generation and synchronization module is connected to the start control module and the synchronization control module respectively;

所述MEDL解析模块的输入端分别与启动控制模块、同步控制模块、集群模式切换模块和在线配置模块连接,所述MEDL解析模块的输出端还分别与所述帧长计算模块、启动控制模块、同步控制模块连接;The input end of the MEDL parsing module is respectively connected to the startup control module, the synchronization control module, the cluster mode switching module and the online configuration module, and the output end of the MEDL parsing module is also respectively connected to the frame length calculation module, the startup control module and the synchronization control module;

所述帧解析模块的输出端还与集群模式切换模块连接;The output end of the frame parsing module is also connected to the cluster mode switching module;

所述启动控制模块的输出端还分别与所述门控模块以及同步控制模块连接;The output end of the startup control module is also connected to the door control module and the synchronization control module respectively;

所述同步控制模块的输出端还与所述门控模块连接。The output end of the synchronization control module is also connected to the gate control module.

作为优化,所述启动控制模块用于在集线器的启动阶段实现集线器从非同步状态过渡到同步状态,根据所述MEDL解析模块提供的Sender Membershp Flag信号、时钟生成子模块提供的系统时间使集线器在启动阶段产生启动输入使能信号和启动输出使能信号,启动输入使能信号和启动输出使能信号控制集线器连接的外部节点的输入、输出,同时,在启动完成后,将启动完成时的时隙中的PSP开始时间点、TP开始时间点、PRP开始时间点和时隙结束时间点以及当前时隙数传递给同步控制模块;As an optimization, the startup control module is used to realize the transition of the hub from an asynchronous state to a synchronous state during the startup phase of the hub, and according to the Sender Membershp Flag signal provided by the MEDL parsing module and the system time provided by the clock generation submodule, the hub generates a startup input enable signal and a startup output enable signal during the startup phase, and the startup input enable signal and the startup output enable signal control the input and output of the external node connected to the hub. At the same time, after the startup is completed, the PSP start time point, TP start time point, PRP start time point and time slot end time point in the time slot when the startup is completed and the current time slot number are passed to the synchronization control module;

所述同步控制模块用于根据集线器进入同步状态时的各时间点以及所述MEDL解析模块提供的时隙信息,在集线器进入同步状态后生成控制门控模块的同步输入使能信号和同步输出使能信号以及将集线器在同步阶段中的各个时隙进行阶段划分,每个所述时隙均包括IDLE阶段,即空闲阶段;PSP阶段,即发送前的阶段;TP阶段,即发送数据阶段;PRP阶段,即发送后的阶段;所述集线器根据各个阶段的时间来进行状态跳转;The synchronization control module is used to generate a synchronization input enable signal and a synchronization output enable signal of the control gating module after the hub enters the synchronization state according to each time point when the hub enters the synchronization state and the time slot information provided by the MEDL parsing module, and divide each time slot of the hub in the synchronization phase into stages, each of which includes an IDLE stage, i.e., an idle stage; a PSP stage, i.e., a stage before sending; a TP stage, i.e., a stage for sending data; and a PRP stage, i.e., a stage after sending; the hub performs state jumps according to the time of each stage;

所述时钟生成和同步模块包括时钟生成子模块和时钟同步子模块,所述时钟生成子模块在集线器的启动阶段工作,根据从帧解析模块获取的Global time/startup time和帧解析时间再结合所述MEDL解析模块提供的发送延时和传播延时求得集线器的初始时间,并通过初始时间形成集线器的本地时间;所述时钟同步子模块在集线器处于同步阶段时工作,获取整形模块传输来的时间差值,对校正项进行计算并根据校正项校正集线器的本地时钟(本地时间),以实现在一个TDMA Round中进行至少一次地时间同步,其中,校正分为单步校正和多部校正,所述校正的规则由所述MEDL解析模块中的调度表的决定;The clock generation and synchronization module includes a clock generation submodule and a clock synchronization submodule. The clock generation submodule works in the startup phase of the hub, and obtains the initial time of the hub according to the Global time/startup time and frame parsing time obtained from the frame parsing module in combination with the sending delay and propagation delay provided by the MEDL parsing module, and forms the local time of the hub through the initial time; the clock synchronization submodule works when the hub is in the synchronization phase, obtains the time difference transmitted by the shaping module, calculates the correction item and corrects the local clock (local time) of the hub according to the correction item, so as to realize at least one time synchronization in a TDMA Round, wherein the correction is divided into single-step correction and multi-step correction, and the correction rule is determined by the scheduling table in the MEDL parsing module;

所述MEDL解析模块,包括全局条目表、协议参数表、MEDL标识表、时隙参数表和7种集群模式表;其中每个集群模式表包含模式控制表和若干时隙条目,在集线器开机后,在线配置模块将加载配置数据传输至MEDL解析模块的存储单元RAM中,完成集线器自检后,在每个时隙开始的阶段,启动控制模块或者同步控制模块向MEDL解析模块发送时隙请求信号或者全局协议参数获取请求信号,MEDL解析模块接收到时隙请求信号或全局协议参数获取请求信号,根据全局条目配置的各个表的起始地址和长度,结合请求信号类型将调度表中相应的信息发送给启动控制模块或者同步控制模块;The MEDL parsing module includes a global entry table, a protocol parameter table, a MEDL identification table, a time slot parameter table and seven cluster mode tables; each cluster mode table includes a mode control table and a number of time slot entries. After the hub is powered on, the online configuration module transfers the loaded configuration data to the storage unit RAM of the MEDL parsing module. After the hub self-check is completed, at the beginning of each time slot, the startup control module or the synchronization control module sends a time slot request signal or a global protocol parameter acquisition request signal to the MEDL parsing module. The MEDL parsing module receives the time slot request signal or the global protocol parameter acquisition request signal, and sends the corresponding information in the scheduling table to the startup control module or the synchronization control module according to the starting address and length of each table configured by the global entry and the request signal type.

所述帧解析模块,通过对输入的帧进行解析,获取帧中的控制状态字段的GlobalTime/Startup Time字段、DMC字段和Cluster position字段,并将帧中的控制状态字段的Global Time/Startup Time字段传输给所述时钟生成和同步模块,将DMC字段和Clusterposition字段传输给所述集群模式切换模块,以触发所述集群模式切换模块发送集群切换信号给MEDL解析模块;The frame parsing module parses the input frame to obtain the GlobalTime/Startup Time field, the DMC field, and the Cluster position field of the control status field in the frame, and transmits the Global Time/Startup Time field of the control status field in the frame to the clock generation and synchronization module, and transmits the DMC field and the Cluster position field to the cluster mode switching module to trigger the cluster mode switching module to send a cluster switching signal to the MEDL parsing module;

所述集群模式切换模块用于在集线器的PRP阶段检查模式更改请求是否被允许,允许则将模式更改请求的内容设置为延迟模式更改的内容,当检测到调度表中表示本集群模式下最后一个时隙的字段EOC有效且当前时隙即将结束时,将延迟模式更改的内容对应的后继模式赋值给集群模式,并将变更后的集群模式传输给MEDL解析模块,下一个时隙即进入一个新的集群模式;The cluster mode switching module is used to check whether the mode change request is allowed in the PRP phase of the hub. If allowed, the content of the mode change request is set to the content of the delayed mode change. When it is detected that the field EOC representing the last time slot in the current cluster mode is valid and the current time slot is about to end, the subsequent mode corresponding to the content of the delayed mode change is assigned to the cluster mode, and the changed cluster mode is transmitted to the MEDL parsing module, and the next time slot enters a new cluster mode.

所述收发模块用于集线器进行数据的收发,包括波特率生成子模块、接收子模块、发送子模块、寄存子模块和CRC校验子模块;The transceiver module is used for the hub to transmit and receive data, and includes a baud rate generation submodule, a receiving submodule, a sending submodule, a storage submodule and a CRC check submodule;

所述整形模块隔离时域SOS故障,在TP阶段中的接收窗口的末尾增加整形延时,待集线器的系统时间到了整形延时完成时,再产生整形输出使能信号给收发模块;The shaping module isolates the time domain SOS fault, adds a shaping delay at the end of the receiving window in the TP phase, and generates a shaping output enable signal to the transceiver module when the system time of the hub reaches the shaping delay completion;

所述门控模块在集线器启动阶段,根据启动输入使能信号和启动输出使能信号对数据进行输入和输出,在集线器同步阶段,根据同步控制模块传输的同步输入使能信号和同步输出使能信号,打开和关闭节点对应的各个端口,所述门控模块包括启动门控子模块、同步门控子模块和输出选择子模块;The gating module inputs and outputs data according to the startup input enable signal and the startup output enable signal during the hub startup phase, and opens and closes the ports corresponding to the nodes according to the synchronization input enable signal and the synchronization output enable signal transmitted by the synchronization control module during the hub synchronization phase. The gating module includes a startup gating submodule, a synchronization gating submodule and an output selection submodule;

所述帧长度生成模块用于根据所述MEDL解析模块提供的数据长度和帧类型以及每种帧类型固定的帧长开销计算出每次传输的帧长,并将计算出来的帧长输出给所述收发模块和门控模块;The frame length generation module is used to calculate the frame length of each transmission according to the data length and frame type provided by the MEDL parsing module and the fixed frame length overhead of each frame type, and output the calculated frame length to the transceiver module and the gating module;

所述在线配置模块用于给节点或集线器配置数据,配置主机在在下传配置数据时,在配置数据的前端加上一段用于标识目的地的目的地字段,所述集线器的目的地字段和节点的目的地字段均唯一且不同,因此集线器首先会判断标识字段,若该字段被判定为配置数据是发送给集线器的,则校验配置数据中的全局条目表是否正确,如果这部分配置数据校验正确则将数据配置到MEDL解析模块的RAM,同时,集线器也将该配置数据进行转发;若该字段被判定为配置数据是发送节点的,则将数据转发至对应的节点。The online configuration module is used to configure data for nodes or hubs. When the configuration host transmits configuration data, a destination field for identifying the destination is added to the front end of the configuration data. The destination field of the hub and the destination field of the node are unique and different. Therefore, the hub will first determine the identification field. If the field is determined to be the configuration data sent to the hub, then check whether the global entry table in the configuration data is correct. If this part of the configuration data is verified to be correct, the data will be configured to the RAM of the MEDL parsing module. At the same time, the hub will also forward the configuration data; if the field is determined to be the configuration data of the sending node, the data will be forwarded to the corresponding node.

本发明还公开了一种应用于星型TTP网络的集线器的实现方法,使用上述的应用于星型TTP网络的集线器,包括如下步骤:The present invention also discloses a method for implementing a hub applied to a star-shaped TTP network, using the hub applied to the star-shaped TTP network, comprising the following steps:

S1、将两个集线器和若干节点连接,两个所述集线器和若干所述节点构成星型网络;S1. Connect two hubs and a plurality of nodes, so that the two hubs and the plurality of nodes form a star network;

S2、对所述集线器和所述节点上电,集线器初始化完成后进入启动阶段;S2, powering on the hub and the node, and entering the startup phase after the hub is initialized;

S3、在启动阶段,所述时钟生成和同步模块从帧解析模块获取的Global time/startup time和帧解析时间结合所述MEDL解析模块提供的发送延时和传播延时求得集线器的初始时间,同时,帧长计算模块根据MEDL解析模块获取当前时隙的数据长度和IF字段计算出当前时隙的帧长,以判断帧传输是否结束,将MEDL解析模块的调度表信息和集线器的初始时间传输给所述启动控制模块,所述启动控制模块根据所述MEDL解析模块提供的信息、时钟生成子模块提供的系统时间使集线器在启动阶段产生启动输入使能信号和启动输出使能信号,同时,所述启动控制模块对所述调度表信息进行检验,检验通过后集线器进入帧听状态,并根据在规定时间范围内接收到的帧进行状态的转变,当集线器启动完成时,将此时对应的集线器的时间传输给同步控制模块,集线器进入同步阶段;S3. In the startup phase, the clock generation and synchronization module obtains the global time/startup time and frame parsing time from the frame parsing module in combination with the sending delay and propagation delay provided by the MEDL parsing module to obtain the initial time of the hub. At the same time, the frame length calculation module obtains the data length of the current time slot from the MEDL parsing module and the IF field to calculate the frame length of the current time slot to determine whether the frame transmission is completed. The scheduling information of the MEDL parsing module and the initial time of the hub are transmitted to the startup control module. The startup control module enables the hub to generate a startup input enable signal and a startup output enable signal in the startup phase according to the information provided by the MEDL parsing module and the system time provided by the clock generation submodule. At the same time, the startup control module verifies the scheduling information. After the verification, the hub enters the frame listening state and changes the state according to the frames received within the specified time range. When the hub is started, the corresponding hub time is transmitted to the synchronization control module, and the hub enters the synchronization phase.

S4、所述同步控制模块输出控制门控模块的同步输入使能信号和同步输出使能信号以及将集线器在同步阶段中的每个时隙进行阶段划分,集线器根据每个时隙的IDLE、PSP、TP和PRP阶段进行状态的跳转;所述时钟生成和同步模块在每一个TDMA Round中至少执行一次时间同步,所述门控模块的各端口根据所述输入输出使能控制信号开/关,收发模块通过整形模块给出的输出使能信号将数据输出至门控模块,根据帧长计算模块得到的数据的帧长判断是否传输结束。S4, the synchronization control module outputs the synchronization input enable signal and the synchronization output enable signal of the control gating module, and divides each time slot of the hub in the synchronization stage into stages, and the hub jumps the state according to the IDLE, PSP, TP and PRP stages of each time slot; the clock generation and synchronization module performs time synchronization at least once in each TDMA Round, each port of the gating module is turned on/off according to the input and output enable control signal, and the transceiver module outputs data to the gating module through the output enable signal given by the shaping module, and determines whether the transmission is completed according to the frame length of the data obtained by the frame length calculation module.

作为优化,集线器的启动控制模块包括有效性检查状态、帧听状态、冷启动状态、集成状态、同步状态、等待集成状态和等待同步状态;S3中,所述启动控制模块对所述调度表信息进行检验,检验通过后集线器进入帧听状态,并根据在规定时间范围内接收到的帧进行状态的转变的具体步骤为:As an optimization, the startup control module of the hub includes a validity check state, a frame listening state, a cold start state, an integration state, a synchronization state, a waiting integration state and a waiting synchronization state; in S3, the startup control module verifies the schedule information, and after the verification, the hub enters the frame listening state, and the specific steps of the state transition according to the frames received within the specified time range are:

启动控制模块进行有效性检查:在集线器开机初始化后,对所述MEDL解析模块传输来的MEDL标识表、协议参数表、全局条目表三个表格做crc检验,三个表格crc检验完成后集线器跳转为帧听状态;Start the control module to check the validity: after the hub is powered on and initialized, perform CRC checks on the three tables of MEDL identification table, protocol parameter table, and global entry table transmitted by the MEDL parsing module. After the CRC checks on the three tables are completed, the hub jumps to the frame listening state;

集线器为帧听状态时,用于进行帧识别,集线器处于帧听状态时继续接收帧,若在2个TDMA Round时间范围内未检测到帧,则集线器跳转为冷启动状态,若在2个TDMA Round时间范围内检测到有效的冷启动帧(由冷启动节点发送),则集线器跳转成等待集成状态,若在2个TDMA Round时间范围内检测到有效的同步帧,则集线器跳转为等待同步状态;When the hub is in the frame listening state, it is used for frame identification. The hub continues to receive frames in the frame listening state. If no frame is detected within 2 TDMA Round time ranges, the hub jumps to the cold start state. If a valid cold start frame (sent by the cold start node) is detected within 2 TDMA Round time ranges, the hub jumps to the waiting integration state. If a valid synchronization frame is detected within 2 TDMA Round time ranges, the hub jumps to the waiting synchronization state.

集线器处于冷启动状态一共包括第一冷启动阶段和第二冷启动阶段,在集线器处于冷启动状态时,集线器继续接收帧,集线器首先处于第一冷启动阶段,集线器在处于第一冷启动阶段时执行Bigbang机制,若在1个TDMA Round范围内检测到有效的冷启动帧且CRC校验成功,则跳转到第二冷启动阶段,否则仍然停留在第一冷启动阶段;The hub is in the cold start state, which includes the first cold start stage and the second cold start stage. When the hub is in the cold start state, the hub continues to receive frames. The hub is first in the first cold start stage. The hub executes the Bigbang mechanism in the first cold start stage. If a valid cold start frame is detected within 1 TDMA Round and the CRC check succeeds, it jumps to the second cold start stage, otherwise it remains in the first cold start stage.

若集线器处于第二冷启动阶段时,执行帧识别,在1个TDMA Round范围内若检测到有效的冷启动帧,则集线器跳转为集成状态,否则集线器跳转回第一冷启动阶段;If the hub is in the second cold start phase, frame recognition is performed. If a valid cold start frame is detected within one TDMA Round, the hub jumps to the integrated state, otherwise the hub jumps back to the first cold start phase;

若集线器为等待集成状态时,若在当前的时隙结束前检测CRC校验为正确的,则集线器变为集成状态,否则集线器重新变为帧听状态;If the hub is in the waiting integration state, if the CRC check is correct before the end of the current time slot, the hub changes to the integration state, otherwise the hub changes to the frame listening state again;

若集线器为集成状态时,若在一个TDMA Round范围内无有效帧或者无帧,则集线器重新变为帧听状态,若在一个TDMA Round范围内检测到来自不同于上一次发送节点的另外节点发送进来的有效帧,则集线器跳转至同步状态;If the hub is in the integrated state, if there is no valid frame or no frame within a TDMA Round range, the hub will change to the frame listening state again. If a valid frame sent from another node different from the last sending node is detected within a TDMA Round range, the hub will jump to the synchronous state;

若集线器为等待同步状态时,若在当前的时隙结束前检测到有效帧,则集线器变为同步状态,否则集线器重新变为帧听状态;If the hub is in the waiting synchronization state, if a valid frame is detected before the end of the current time slot, the hub changes to the synchronization state, otherwise the hub changes to the frame listening state again;

当集线器进入同步状态时,将启动完成时的时隙中的PSP开始时间点、TP开始时间点、PRP开始时间点和时隙结束时间点以及当前时隙数传递给同步控制模块。When the hub enters the synchronization state, the PSP start time point, TP start time point, PRP start time point and time slot end time point in the time slot when the startup is completed and the current time slot number are passed to the synchronization control module.

作为优化,S4中,所述同步控制模块输出控制门控模块的输入输出使能控制信号以及将集线器在同步阶段中的每个时隙进行阶段划分,集线器根据各个时隙进行状态的跳转的具体步骤为:As an optimization, in S4, the synchronization control module outputs the input and output enable control signal of the control gate module and divides each time slot of the hub in the synchronization phase into stages. The specific steps of the hub switching the state according to each time slot are:

S4.1、在同步阶段,在每一个时隙开始时,集线器均会进入S_Init状态,对当前系统是否活跃、集群模式是否进行切换进行判断,然后进入同步阶段的每个时隙的IDLE阶段,集线器跳转至S_IDLE状态,即空闲状态;S4.1. In the synchronization phase, at the beginning of each time slot, the hub will enter the S_Init state to determine whether the current system is active and whether the cluster mode is switched. Then, it will enter the IDLE phase of each time slot in the synchronization phase, and the hub will jump to the S_IDLE state, that is, the idle state.

S4.2、同步控制模块持续获取MEDL解析模块中的当前时隙信息,待当前时隙信息更新完成后,进入步骤4.3,S4.2, the synchronization control module continues to obtain the current time slot information in the MEDL parsing module, and after the current time slot information is updated, it enters step 4.3,

S4.3、将在线配置模块中存储的时隙信息赋值给同步控制模块中的寄存器,所述同步控制模块根据获取的时隙信息计算当前时隙信息的结束时间、PSP阶段开始时间、TP阶段开始时间、PRP阶段开始时间、TP阶段中接收窗口的开始时间和结束时间;S4.3, assigning the time slot information stored in the online configuration module to the register in the synchronization control module, and the synchronization control module calculates the end time of the current time slot information, the start time of the PSP phase, the start time of the TP phase, the start time of the PRP phase, and the start time and end time of the receiving window in the TP phase according to the acquired time slot information;

S4.4、判断S4.3中计算所得的任一时间是否超过最大阈值,若超出最大阈值,则将集线器的本地时间减去最大阈值作为系统时间,否则,直接使用集线器的本地时间作为系统时间。S4.4. Determine whether any time calculated in S4.3 exceeds the maximum threshold. If so, subtract the maximum threshold from the local time of the hub as the system time. Otherwise, directly use the local time of the hub as the system time.

在代码设计中,有规定节点和集线器的ma计数器位宽为16位,ma计数器是一个时间计算器,16位宽意味着最大值为65535。但是集线器的本地时钟(本地时间)是以mi为单位运行的,需要将ma*ma/mi的比值转变为以mi为单位的时钟。而ma/mi这个比值并非固定的,因此将mi计数器的位宽定义为28,也就是说,mi计数器的最大值要远远大于ma计数器,通常情况下mi计数器的最大值比ma计数器的最大值ma/mi还要大。因此如果让集线器的本地时钟计数器mi一直加1,如果超过最大阈值了不减去最大阈值,会使得集线器和节点的时钟失去同步,这对于时间触发网络来说是致命的错误。In the code design, it is stipulated that the bit width of the ma counter of the node and the hub is 16 bits. The ma counter is a time calculator, and the 16-bit width means that the maximum value is 65535. However, the local clock (local time) of the hub runs in units of mi, and the ratio of ma*ma/mi needs to be converted into a clock in units of mi. The ratio of ma/mi is not fixed, so the bit width of the mi counter is defined as 28, that is, the maximum value of the mi counter is much larger than the ma counter. Usually, the maximum value of the mi counter is larger than the maximum value of the ma counter, ma/mi. Therefore, if the local clock counter mi of the hub is always increased by 1, if it exceeds the maximum threshold without subtracting the maximum threshold, the clocks of the hub and the node will lose synchronization, which is a fatal error for the time-triggered network.

S4.5、检测系统时间是否达到PSP阶段的开始时间,若达到PSP阶段的开始时间,则集线器跳转至PSP阶段,进入S_PSP状态,并将IDLE_flg置为0,PSP_flg置为1;否则停留在S_IDLE状态,IDLE_flg置为1,PSP_flg置为0,IDLE_flg表示同步控制模块处于当前时隙的IDLE阶段,PSP_flg表示同步控制模块处于当前时隙的PSP阶段;S4.5, check whether the system time reaches the start time of the PSP stage. If it reaches the start time of the PSP stage, the hub jumps to the PSP stage, enters the S_PSP state, and sets IDLE_flg to 0 and PSP_flg to 1; otherwise, it stays in the S_IDLE state, sets IDLE_flg to 1 and PSP_flg to 0, IDLE_flg indicates that the synchronization control module is in the IDLE stage of the current time slot, and PSP_flg indicates that the synchronization control module is in the PSP stage of the current time slot;

S4.6、检测系统时间是否达到了TP阶段开始时间,达到则跳转至TP阶段,进入S_TP状态,并将TP_flg置为1,PSP_flg置为0,在该阶段,收发模块进行数据传输;否则停留在S_PSP状态并将TP_flg置为0,PSP_flg置为1,TP_flg表示同步控制模块处于当前时隙的TP阶段,PSP_flg表示集线器处于当前时隙的PSP阶段;S4.6, check whether the system time has reached the start time of the TP phase. If so, jump to the TP phase and enter the S_TP state, and set TP_flg to 1 and PSP_flg to 0. In this phase, the transceiver module performs data transmission; otherwise, stay in the S_PSP state and set TP_flg to 0 and PSP_flg to 1. TP_flg indicates that the synchronization control module is in the TP phase of the current time slot, and PSP_flg indicates that the hub is in the PSP phase of the current time slot;

S4.7、检测系统时间是否达到了PRP阶段开始时间,达到则跳转至PRP阶段,进入S_PRP状态,并将PRP_flg置为1,TP_flg置为0;否则停留在S_TP状态并将TP_flg置为1,PRP_flg置为0,其中PRP_flg表示集线器处于当前时隙的PRP阶段;S4.7, check whether the system time has reached the start time of the PRP phase, if so, jump to the PRP phase, enter the S_PRP state, and set PRP_flg to 1 and TP_flg to 0; otherwise, stay in the S_TP state and set TP_flg to 1 and PRP_flg to 0, where PRP_flg indicates that the hub is in the PRP phase of the current time slot;

S4.8、当系统时间等于当前时隙结束时间,同步控制模块的状态变为S4.1所述S_Init状态,将next_slot_flg置为1,PRP_flg置为0;否则停留在S_PRP状态,PRP_flg为1,next_slot_flg为0。S4.8. When the system time is equal to the end time of the current time slot, the state of the synchronization control module changes to the S_Init state described in S4.1, and next_slot_flg is set to 1 and PRP_flg is set to 0; otherwise, it stays in the S_PRP state, with PRP_flg being 1 and next_slot_flg being 0.

作为优化,S4.6中,TP阶段包括接收窗口前阶段、接收窗口阶段、接收窗口结束后阶段,在TP阶段的具体过程包括:As an optimization, in S4.6, the TP phase includes the pre-receiving window phase, the receiving window phase, and the receiving window end phase. The specific process in the TP phase includes:

S4.6.1、在接收窗口前阶段,当系统时间等于接收窗口起始时间点,则跳转至接收窗口阶段并将receve_window_phase_flg置为1,before_window_phase_flg置为0,并将输入使能无条件置为对应的值,即enable_in[Sender_membership_flg]=0,即输入使能为低电平有效;否则停留在当前的接收窗口前阶段且将enable_in置为无效值,其中,receve_window_phase_flg表示处于接收窗口阶段;before_window_phase_flg表示接收窗口前的阶段;enable_in[Sender_membership_flg]=0,enable_in表示输入使能,Sender_membership_flg表示当前发送的节点标识;S4.6.1. In the pre-receive window stage, when the system time is equal to the receive window start time point, jump to the receive window stage and set receve_window_phase_flg to 1, before_window_phase_flg to 0, and unconditionally set the input enable to the corresponding value, that is, enable_in[Sender_membership_flg] = 0, that is, the input enable is valid at a low level; otherwise, stay in the current pre-receive window stage and set enable_in to an invalid value, where receve_window_phase_flg indicates that it is in the receive window stage; before_window_phase_flg indicates the stage before the receive window; enable_in[Sender_membership_flg] = 0, enable_in indicates input enable, and Sender_membership_flg indicates the node identifier currently being sent;

S4.6.2、在接收窗口阶段,当系统时间等于接收窗口结束时间点,则跳转至接收窗口结束后阶段;否则停留在接收窗口阶段,并检测当前时隙的对应节点是否有数据输入,若当前时隙的对应节点有输入数据,则将对应的flg置为1,否则置为0;S4.6.2, in the receiving window stage, when the system time is equal to the receiving window end time point, jump to the receiving window end stage; otherwise, stay in the receiving window stage and detect whether the corresponding node of the current time slot has data input. If the corresponding node of the current time slot has input data, set the corresponding flg to 1, otherwise set it to 0;

S4.6.3、接收窗口结束后阶段,当系统时间等于PRP开始的时间点时,跳转至PRP阶段,进入状态S_PRP,否则停留在S_TP状态,在S_TP状态对S4.6.2中的flg进行判断,若flg为1,则继续保持enable_in[Sender_membership_flg]=0,否则enable_in[Sender_membership_flg]=1,置为无效。S4.6.3. In the post-receive window stage, when the system time is equal to the start time of PRP, jump to the PRP stage and enter the S_PRP state, otherwise stay in the S_TP state. In the S_TP state, the flg in S4.6.2 is judged. If flg is 1, enable_in[Sender_membership_flg]=0 is maintained, otherwise enable_in[Sender_membership_flg]=1 and is set to invalid.

作为优化,所述时钟生成和同步模块在每一个TDMA Round中至少执行一次时间同步的具体过程为:As an optimization, the specific process of the clock generation and synchronization module performing time synchronization at least once in each TDMA Round is as follows:

A1、在整形模块中获取数据实际被获取的时间以及理论被获取的时间差diff,并将时间差diff存储于时间同步模块中;A1. Obtain the time difference diff between the actual acquisition time of the data and the theoretical acquisition time in the shaping module, and store the time difference diff in the time synchronization module;

A2、根据容错中值算法,计算出校正项;A2. Calculate the correction term according to the fault-tolerant median algorithm;

A3、若在MEDL解析模块中解析出当前时隙的Clksyn字段为1,那么在当前时隙的PRP阶段执行时钟校正,若MEDL解析模块解析出当前时隙中的字段Free_running_MAcroticks_t[0]为1,则执行单步校正,否则执行多步校正。A3. If the Clksyn field of the current time slot is parsed as 1 in the MEDL parsing module, clock correction is performed in the PRP stage of the current time slot. If the MEDL parsing module parses the field Free_running_MAcroticks_t[0] in the current time slot as 1, single-step correction is performed, otherwise multi-step correction is performed.

作为优化,所述收发模块用于在集线器的同步阶段进行数据的收发,包括波特率生成子模块、接收子模块、发送子模块、寄存子模块和CRC校验子模块,As an optimization, the transceiver module is used to transmit and receive data in the synchronization phase of the hub, including a baud rate generation submodule, a receiving submodule, a sending submodule, a register submodule and a CRC check submodule.

所述波特率生成子模块用于生成波特率;The baud rate generation submodule is used to generate a baud rate;

所述接收子模块设置为接收到了下降沿认为数据传输开始,数据传输结束则通过帧长计算模块提供的帧长来判断传输是否结束;The receiving submodule is configured to determine whether data transmission starts when a falling edge is received, and whether data transmission ends when the frame length provided by the frame length calculation module is used to determine whether the transmission ends;

所述发送子模块的传输开始则由整形模块提供的使能信号决定,所述发送子模块的传输结束是通过帧长来判断;The start of transmission of the sending submodule is determined by the enable signal provided by the shaping module, and the end of transmission of the sending submodule is determined by the frame length;

所述寄存子模块与所述整形模块配合,用于将输入的数据寄存一段整形的时间;The storage submodule cooperates with the shaping module to store the input data for a shaping period of time;

所述CRC校验子模块是用来将输入数据做CRC校验的,CRC校验方式为一边输入一边校验。The CRC check submodule is used to perform CRC check on the input data, and the CRC check mode is to check while inputting.

作为优化,所述整形模块在TP阶段的接收窗口阶段的末尾加一个整形延时,等到系统时间到达整形延时完成时刻,再产生输出使能,输出使能控制收发模块将缓存在寄存子模块的数据转发出去。As an optimization, the shaping module adds a shaping delay at the end of the receiving window phase of the TP phase, and generates an output enable when the system time reaches the shaping delay completion moment. The output enable controls the transceiver module to forward the data cached in the register submodule.

作为优化,门控模块包括启动门控子模块、同步门控子模块和输出选择子模块,所述启动门控子模块用于在集线器的启动阶段接收或输出数据,所述同步门控子模块用于在集线器的同步阶段根据同步输入使能信号和同步输出使能信号进行数据的接收或输出,所述输出选择子模块用于根据集线器所处的启动状态或同步状态选择输出启动门控子模块的输出数据或同步门控子模块的数据。As an optimization, the gating module includes a start gating submodule, a synchronous gating submodule and an output selection submodule. The start gating submodule is used to receive or output data during the startup phase of the hub, the synchronous gating submodule is used to receive or output data according to the synchronous input enable signal and the synchronous output enable signal during the synchronization phase of the hub, and the output selection submodule is used to select the output data of the start gating submodule or the data of the synchronous gating submodule according to the startup state or synchronization state of the hub.

本发明与现有技术相比,具有如下的优点和有益效果:Compared with the prior art, the present invention has the following advantages and beneficial effects:

1.本发明提出了一个完整的集线器设计方案,一个星型时间触发网络只需要两个集线器起到总线保护作用,且相比于总线型的TTP网络极大得降低了成本,系统的容错性能更佳。1. The present invention proposes a complete hub design scheme. A star-type time trigger network only needs two hubs to play a bus protection role, and compared with the bus-type TTP network, the cost is greatly reduced, and the system has better fault tolerance performance.

2.本发明的集线器能够避免胡言乱语故障和时域SOS故障,因此比总线型时间触发网络具有更高的容错性。2. The hub of the present invention can avoid gibberish failures and time domain SOS failures, and therefore has higher fault tolerance than a bus-type time-triggered network.

3.本发明基于集线器的启动原理,提出了一种基于Bigbang机制的启动方案,同时,本发明的启动方案包含三条启动路径,适配各种启动场景。3. Based on the startup principle of the hub, the present invention proposes a startup solution based on the Bigbang mechanism. At the same time, the startup solution of the present invention includes three startup paths to adapt to various startup scenarios.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明示例性实施方式的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。在附图中:In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work. In the drawings:

图1为一种应用于星型TTP网络的集线器的框架图;FIG1 is a framework diagram of a hub applied to a star-type TTP network;

图2为星型时间触发网络的系统结构示意图;FIG2 is a schematic diagram of the system structure of a star-shaped time-triggered network;

图3为启动控制模块的启动控制状态图;FIG3 is a start-up control state diagram of the start-up control module;

图4为启动控制模块的同步控制流程图;FIG4 is a flow chart of synchronous control of the startup control module;

图5为时隙图;Fig. 5 is a time slot diagram;

图6为整形模块在时域SOS整形原理图;FIG6 is a schematic diagram of the shaping module for SOS shaping in the time domain;

图7为总线型时间触发网络的系统结构示意图。FIG. 7 is a schematic diagram of the system structure of a bus-type time-triggered network.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚明白,下面结合实施例和附图,对本发明作进一步的详细说明,本发明的示意性实施方式及其说明仅用于解释本发明,并不作为对本发明的限定。In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary implementation modes of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.

实施例Example

如图1所示,一种应用于星型TTP网络的集线器,包括设置在物理链路层的门控模块9和收发模块7,以及设置在协议层的启动控制模块1、同步控制模块2、时钟生成和同步模块3、MEDL解析模块4、帧解析模块5、集群模式切换模块6、整形模块8、帧长计算模块10和在线配置模块11,所述收发模块7的输入端分别与所述整形模块8、门控模块9、帧长计算模块10连接,所述收发模块7的输出端分别与所述门控模块9、帧解析模块5、在线配置模块11连接;所述时间生成和同步模块3的输入端分别与所述帧解析模块5、整形模块8、MEDL解析模块4连接,所述时间生成和同步模块3的输出端分别与启动控制模块1、同步控制模块2连接;所述MEDL解析模块4的输入端分别与启动控制模块1、同步控制模块2、集群模式切换模块6和在线配置模块11连接,所述MEDL解析模块4的输出端还分别与所述帧长计算模块10、启动控制模块1、同步控制模块2连接;所述帧解析模块5的输出端还与集群模式切换模块6连接;所述启动控制模块1的输出端还分别与所述门控模块9以及同步控制模块2连接;所述同步控制模块2的输出端还与所述门控模块9连接。As shown in FIG1 , a hub applied to a star-type TTP network includes a gating module 9 and a transceiver module 7 arranged at a physical link layer, and a startup control module 1, a synchronization control module 2, a clock generation and synchronization module 3, a MEDL parsing module 4, a frame parsing module 5, a cluster mode switching module 6, a shaping module 8, a frame length calculation module 10 and an online configuration module 11 arranged at a protocol layer. The input end of the transceiver module 7 is respectively connected to the shaping module 8, the gating module 9, and the frame length calculation module 10, and the output end of the transceiver module 7 is respectively connected to the gating module 9, the frame parsing module 5, and the online configuration module 11; the input end of the time generation and synchronization module 3 is respectively connected to the frame parsing module 5, the shaping module 8, and the frame length calculation module 10. Module 8 and MEDL parsing module 4 are connected, the output end of the time generation and synchronization module 3 is respectively connected to the start control module 1 and the synchronization control module 2; the input end of the MEDL parsing module 4 is respectively connected to the start control module 1, the synchronization control module 2, the cluster mode switching module 6 and the online configuration module 11, the output end of the MEDL parsing module 4 is also respectively connected to the frame length calculation module 10, the start control module 1 and the synchronization control module 2; the output end of the frame parsing module 5 is also connected to the cluster mode switching module 6; the output end of the start control module 1 is also respectively connected to the gating module 9 and the synchronization control module 2; the output end of the synchronization control module 2 is also connected to the gating module 9.

MEDL指the message descriptor list,本发明中理解为调度表。MEDL refers to the message descriptor list, which is understood as a scheduling table in the present invention.

接下来,将结合本发明的另一实施例所述的一种应用于星型TTP网络的集线器的实现方法进行介绍。Next, an implementation method of a hub applied to a star-type TTP network according to another embodiment of the present invention will be introduced.

本发明中的一种应用于星型TTP网络的集线器的实现方法,使用上述的应用于星型TTP网络的集线器,包括如下步骤:A method for implementing a hub applied to a star-type TTP network in the present invention uses the above-mentioned hub applied to a star-type TTP network, and comprises the following steps:

S1、将两个集线器和若干节点连接,两个所述集线器和若干所述节点构成星型网络,如图2所示,本发明中的集线器设为2个,节点设有10个;S1, connecting two hubs and a plurality of nodes, the two hubs and the plurality of nodes forming a star network, as shown in FIG2, the number of hubs in the present invention is set to 2, and the number of nodes is set to 10;

S2、对所述集线器和所述节点上电,集线器初始化完成后进入启动阶段;S2, powering on the hub and the node, and entering the startup phase after the hub is initialized;

S3、在启动阶段,所述时钟生成和同步模块通过从帧解析模块获取的Globaltime/startup time和帧解析时间结合所述MEDL解析模块提供的发送延时和传播延时求得集线器的初始时间,同时,帧长计算模块根据MEDL解析模块获取当前时隙的数据长度和IF字段计算出当前时隙的帧长,以判断帧传输是否结束,将MEDL解析模块的调度表信息和集线器的初始时间传输给所述启动控制模块,所述启动控制模块根据所述MEDL解析模块提供的信息(发送延时字段、TP持续时间、PSP持续时间字段、一个时隙的持续时间字段、ma和mi的比值字段、当前轮次所含时隙数字段)、时钟生成子模块提供的系统时间使集线器在启动阶段产生启动输入使能信号和启动输出使能信号,同时,所述启动控制模块对所述调度表信息进行检验,检验通过后集线器进入帧听状态,并根据在规定时间范围内接收到的帧进行状态的转变,当集线器启动完成时,将此时对应的集线器的时间传输给同步控制模块,集线器进入同步阶段;S3, in the startup phase, the clock generation and synchronization module obtains the Globaltime/startup from the frame parsing module time and frame parsing time combined with the sending delay and propagation delay provided by the MEDL parsing module to obtain the initial time of the hub. At the same time, the frame length calculation module obtains the data length of the current time slot and the IF field of the MEDL parsing module to calculate the frame length of the current time slot to determine whether the frame transmission is completed, and transmits the scheduling table information of the MEDL parsing module and the initial time of the hub to the startup control module. The startup control module generates a startup input enable signal and a startup output enable signal in the startup phase according to the information provided by the MEDL parsing module (sending delay field, TP duration field, PSP duration field, duration field of a time slot, ratio field of ma and mi, number of time slots contained in the current round) and the system time provided by the clock generation submodule. At the same time, the startup control module verifies the scheduling table information. After the verification, the hub enters the frame listening state and performs state transition according to the frames received within the specified time range. When the hub is started, the corresponding hub time is transmitted to the synchronization control module, and the hub enters the synchronization phase;

S4、所述同步控制模块输出控制门控模块的同步输入使能信号和同步输出使能信号以及将集线器在同步阶段中的每个时隙进行阶段划分,集线器根据每个时隙的IDLE、PSP、TP和PRP阶段进行状态的跳转;所述时钟生成和同步模块在每一个TDMA Round中至少执行一次时间同步,所述门控模块的各端口根据所述输入输出使能控制信号开/关,收发模块通过整形模块给出的输出使能信号将数据输出至门控模块,根据帧长计算模块得到的数据的帧长判断是否传输结束。S4, the synchronization control module outputs the synchronization input enable signal and the synchronization output enable signal of the control gating module, and divides each time slot of the hub in the synchronization stage into stages, and the hub jumps the state according to the IDLE, PSP, TP and PRP stages of each time slot; the clock generation and synchronization module performs time synchronization at least once in each TDMA Round, each port of the gating module is turned on/off according to the input and output enable control signal, and the transceiver module outputs data to the gating module through the output enable signal given by the shaping module, and determines whether the transmission is completed according to the frame length of the data obtained by the frame length calculation module.

本实施例中,所述启动控制模块1用于在集线器的启动阶段实现集线器从非同步状态过渡到同步状态,根据所述MEDL解析模块提供的Sender Membershp Flag信号、时钟生成子模块提供的系统时间使集线器在启动阶段产生启动输入使能信号和启动输出使能信号,启动输入使能信号和启动输出使能信号控制集线器连接的外部节点的输入、输出,同时,在启动完成后,将启动完成时的时隙中的PSP开始时间点、TP开始时间点、PRP开始时间点和时隙结束时间点以及当前时隙数传递给同步控制模块。In this embodiment, the startup control module 1 is used to realize the transition of the hub from an asynchronous state to a synchronous state during the startup phase of the hub. According to the Sender Membershp Flag signal provided by the MEDL parsing module and the system time provided by the clock generation submodule, the hub generates a startup input enable signal and a startup output enable signal during the startup phase. The startup input enable signal and the startup output enable signal control the input and output of the external nodes connected to the hub. At the same time, after the startup is completed, the PSP start time point, TP start time point, PRP start time point and time slot end time point in the time slot when the startup is completed and the current time slot number are passed to the synchronization control module.

启动控制模块会根据MEDL解析模块提供的Sender Membershp Flag信号、时钟生成子模块提供的本地时间等内容产生启动输入使能信号和启动输出使能信号,这些使能信号控制集线器门控模块各个端口的输入输出。在启动阶段,集线器的启动模块会给10个端口同时赋予输入使能,门控模块根据这些使能信号打开对应端口,当检测到某一正确节点输入数据且无胡言乱语节点时,等到整形时间到达后,启动模块再给除了发送节点以外的其他节点对应的端口赋予输出使能信号,收发模块将数据输出给门控模块,门控模块根据输出使能信号将数据转发给其他节点。启动过程完成后,将启动完成时的时隙中各个时间点(PSP开始时间点、TP开始时间点、PRP开始时间点以及时隙结束时间点)和当前时隙数传递给同步控制模块。The startup control module will generate startup input enable signals and startup output enable signals based on the Sender Membershp Flag signal provided by the MEDL parsing module and the local time provided by the clock generation submodule. These enable signals control the input and output of each port of the hub gating module. In the startup phase, the hub startup module will grant input enable to 10 ports at the same time, and the gating module will open the corresponding ports according to these enable signals. When a correct node inputs data and there is no nonsense node, after the shaping time arrives, the startup module will grant output enable signals to the ports corresponding to other nodes except the sending node. The transceiver module outputs the data to the gating module, and the gating module forwards the data to other nodes according to the output enable signal. After the startup process is completed, the various time points in the time slot when the startup is completed (PSP start time point, TP start time point, PRP start time point and time slot end time point) and the current time slot number are passed to the synchronization control module.

如图3所示,集线器的启动控制模块包括有效性检查状态、帧听状态、冷启动状态、集成状态、同步状态、等待集成状态和等待同步状态;S3中,所述启动控制模块对所述调度表信息进行检验,检验通过后集线器进入帧听状态,并根据在规定时间范围内接收到的帧进行状态的转变的具体步骤为:As shown in FIG3 , the startup control module of the hub includes a validity check state, a frame listening state, a cold start state, an integration state, a synchronization state, a waiting integration state, and a waiting synchronization state; in S3, the startup control module verifies the schedule information, and after the verification, the hub enters the frame listening state, and the specific steps of the state transition according to the frames received within the specified time range are as follows:

启动控制模块进行有效性检查:在集线器开机初始化后,对所述MEDL解析模块传输来的全局条目表(Global entry table)、协议参数表(Schedule/Protocol parameter)、MEDL标识表(MEDL Identifier table)三个表格做crc检验,三个表格crc检验完成后集线器跳转为帧听状态listen;Start the control module to check the validity: after the hub is powered on and initialized, perform CRC checks on the three tables of the global entry table, the schedule/protocol parameter table, and the MEDL identifier table transmitted by the MEDL parsing module. After the CRC checks on the three tables are completed, the hub jumps to the frame listening state listen;

集线器为帧听状态时,根据帧解析模块识别出的帧类型进行帧识别,集线器处于帧听状态时继续接收帧,若在2个TDMA Round时间范围(由时钟生成子模块提供的系统时间决定)内未检测到帧(无有效帧或者无帧),则集线器跳转为冷启动状态Co l d_start,若在2个TDMA Round时间范围内检测到有效的冷启动帧(由冷启动节点发送的冷启动帧),则集线器跳转成等待集成状态,若在2个TDMA Round时间范围内检测到有效的同步帧(I帧),则集线器跳转为等待同步状态。TDMA round具体解释见图5。When the hub is in the frame listening state, it performs frame identification according to the frame type identified by the frame parsing module. When the hub is in the frame listening state, it continues to receive frames. If no frame is detected (no valid frame or no frame) within 2 TDMA Round time ranges (determined by the system time provided by the clock generation submodule), the hub jumps to the cold start state Col d_start. If a valid cold start frame (cold start frame sent by the cold start node) is detected within the 2 TDMA Round time ranges, the hub jumps to the waiting integration state. If a valid synchronization frame (I frame) is detected within the 2 TDMA Round time ranges, the hub jumps to the waiting synchronization state. See Figure 5 for a detailed explanation of TDMA round.

集线器若处于冷启动状态,需要先后执行两个阶段(先执行第一冷启动阶段,再执行第二冷启动阶段)的动作,在集线器处于冷启动状态时,集线器继续接收帧,集线器在处于第一冷启动阶段时执行Bigbang机制,即对接收到的帧直接转发而不集成到该帧上,一边转发一边进行帧类型判断和CRC校验,若在1个TDMA Round范围内检测到有效的冷启动帧且对冷启动帧的CRC校验成功,则跳转到第二冷启动阶段,否则仍然停留在第一冷启动阶段;If the hub is in a cold start state, it needs to execute two stages (first the first cold start stage, then the second cold start stage) of actions in sequence. When the hub is in a cold start state, the hub continues to receive frames. When the hub is in the first cold start stage, it executes the Bigbang mechanism, that is, it directly forwards the received frames without integrating them into the frames, and performs frame type judgment and CRC check while forwarding. If a valid cold start frame is detected within one TDMA Round and the CRC check of the cold start frame is successful, it jumps to the second cold start stage, otherwise it remains in the first cold start stage.

若集线器处于第二冷启动阶段时,执行帧识别,在1个TDMA Round范围内若检测到有效的冷启动帧,则集线器跳转为集成状态,否则集线器跳转回第一冷启动阶段;If the hub is in the second cold start phase, frame recognition is performed. If a valid cold start frame is detected within one TDMA Round, the hub jumps to the integrated state, otherwise the hub jumps back to the first cold start phase;

若集线器为等待集成状态时,若在当前的时隙结束前检测CRC校验为正确的,则集线器变为集成状态,否则集线器重新变为帧听状态;If the hub is in the waiting integration state, if the CRC check is correct before the end of the current time slot, the hub changes to the integration state, otherwise the hub changes to the frame listening state again;

若集线器为集成状态时,若在一个TDMA Round范围内无有效帧或者无帧,则集线器重新变为帧听状态,若在一个TDMA Round范围内检测到来自不同于上一次发送节点的另外节点发送进来的有效帧,则集线器跳转至同步状态;If the hub is in the integrated state, if there is no valid frame or no frame within a TDMA Round range, the hub will change to the frame listening state again. If a valid frame sent from another node different from the last sending node is detected within a TDMA Round range, the hub will jump to the synchronous state;

若集线器为等待同步状态时,若在当前的时隙结束前检测到有效帧,则集线器变为同步状态,否则集线器重新变为帧听状态;If the hub is in the waiting synchronization state, if a valid frame is detected before the end of the current time slot, the hub changes to the synchronization state, otherwise the hub changes to the frame listening state again;

当集线器进入同步状态时,将启动状态结束所在时隙的PSP阶段开始时间点、TP阶段开始时间点、PRP阶段开始时间点和当前时隙结束时间点传输至同步控制模块。When the hub enters the synchronization state, the PSP phase start time point, TP phase start time point, PRP phase start time point and current time slot end time point of the start state end time slot are transmitted to the synchronization control module.

启动控制模块有三条启动路径,第一条启动路径:节点比集线器先上电,在节点进行通信活动后,集线器再上电开机,集线器一开机就能接受到冷启动帧,集线器可以直接集成接受到的冷启动帧上,即图3中的2→7→5→6路径;第二启动条路径:当集线器开机但是没有节点开机启动时,集线器需要等待直到节点开始进行通信活动时再集成到对应冷启动节点上完成启动,在第二条启动路径上,集线器需要执行bigbang机制,集线器的Bigbang机制不同于节点直接拒绝接收帧,而是将第一次接收到的冷启动帧直接转发保证节点能正常接收到这一次的帧,直接转发也意味着集线器不会集成到该冷启动帧上,即不会依据第一次接收到的冷启动帧的C状态来更新本地C状态,对应的路径为2→3→4→5→6;第三条启动路径,已有一个正在运行的同步集群,当有节点想要加入该集群时,可以集成在同步节点发送的同步帧(I帧)上,进而完成启动,对应的路径为2→8→6。The startup control module has three startup paths. The first startup path: the node is powered on before the hub. After the node starts communication activities, the hub is powered on and started. The hub can receive the cold start frame as soon as it is powered on. The hub can directly integrate the received cold start frame, that is, the 2→7→5→6 path in Figure 3; the second startup path: when the hub is powered on but no node is powered on, the hub needs to wait until the node starts communication activities and then integrate it into the corresponding cold start node to complete the startup. In the second startup path, the hub needs to execute the bigbang mechanism. The hub's B The igbang mechanism is different from the node directly refusing to receive frames. Instead, it directly forwards the cold start frame received for the first time to ensure that the node can receive the frame normally this time. Direct forwarding also means that the hub will not be integrated into the cold start frame, that is, the local C state will not be updated based on the C state of the cold start frame received for the first time. The corresponding path is 2→3→4→5→6. For the third startup path, there is already a running synchronization cluster. When a node wants to join the cluster, it can be integrated into the synchronization frame (I frame) sent by the synchronization node to complete the startup. The corresponding path is 2→8→6.

所述同步控制模块用于根据集线器进入同步状态时的初始时间点以及所述MEDL解析模块提供的时间信息,在集线器进入同步状态后生成控制门控模块9的同步输入使能信号和同步输出使能信号以及将集线器在同步阶段中的各个时隙进行阶段划分,如图5所示,每个所述时隙均包括IDLE阶段,即空闲阶段;PSP阶段,即发送前的阶段;TP阶段,即发送数据阶段;PRP阶段,即发送后的阶段,同步控制模块就会生成对应的IDLE_flg、PSP_flg、TP_flg和PRP_flg标识;所述集线器根据各个阶段的时间来进行状态跳转。The synchronization control module is used to generate a synchronization input enable signal and a synchronization output enable signal of the control gating module 9 after the hub enters the synchronization state according to the initial time point when the hub enters the synchronization state and the time information provided by the MEDL parsing module, and to divide the various time slots of the hub in the synchronization stage into stages. As shown in Figure 5, each of the time slots includes an IDLE stage, i.e., an idle stage; a PSP stage, i.e., a stage before sending; a TP stage, i.e., a stage for sending data; and a PRP stage, i.e., a stage after sending. The synchronization control module will generate corresponding IDLE_flg, PSP_flg, TP_flg and PRP_flg identifiers; and the hub will perform state jumps according to the time of each stage.

图5显示了一个4节点的时间触发系统,一个TDMA round包含4个节点;集群循环包含2个TDMA Round,这个根据实际情况来判断,可以更多。一个时隙由IDLE、PSP、TP、PRP四个阶段组成。IDLE表示空闲阶段;PSP表示pre-send phase,即发送前的阶段;TP表示transmission phase,表示发送数据阶段;PRP表示post-receive phase,即发送后的阶段。Figure 5 shows a 4-node time-triggered system. One TDMA round contains 4 nodes. The cluster cycle contains 2 TDMA rounds. This can be more depending on the actual situation. A time slot consists of four phases: IDLE, PSP, TP, and PRP. IDLE means idle phase; PSP means pre-send phase, i.e., the phase before sending; TP means transmission phase, i.e., the phase of sending data; PRP means post-receive phase, i.e., the phase after sending.

接下来,结合实现方法中的对同步控制模块的实现进行具体描述,如图4所示。Next, the implementation of the synchronization control module in the implementation method is described in detail, as shown in FIG4 .

S4.1、在同步阶段,在每一个时隙开始时,集线器均会进入S_Init状态,对当前系统是否活跃(是否有节点发送数据)、集群模式是否进行切换进行判断,然后进入同步阶段的每个时隙的IDLE阶段,集线器跳转至S_IDLE状态,即空闲状态;S4.1. In the synchronization phase, at the beginning of each time slot, the hub will enter the S_Init state to determine whether the current system is active (whether there are nodes sending data) and whether the cluster mode is switched. Then, the hub enters the IDLE phase of each time slot in the synchronization phase and jumps to the S_IDLE state, that is, the idle state.

S4.2、同步控制模块持续获取MEDL解析模块中的当前时隙信息,待当前时隙信息更新完成后,进入步骤4.3;S4.2, the synchronization control module continues to obtain the current time slot information in the MEDL parsing module, and after the current time slot information is updated, it goes to step 4.3;

S4.3、将在线配置模块中存储的时隙信息赋值给同步控制模块中的寄存器,所述同步控制模块根据获取的时隙信息计算当前时隙信息的结束时间、PSP阶段开始时间、TP阶段开始时间、PRP阶段开始时间、TP阶段中接收窗口的开始时间和结束时间;S4.3, assigning the time slot information stored in the online configuration module to the register in the synchronization control module, and the synchronization control module calculates the end time of the current time slot information, the start time of the PSP phase, the start time of the TP phase, the start time of the PRP phase, and the start time and end time of the receiving window in the TP phase according to the acquired time slot information;

S4.4、判断S4.3中计算所得的任一时间是否超过最大阈值,若超出最大阈值,则将集线器的本地时间减去最大阈值作为系统时间,否则,直接使用集线器的本地时间作为系统时间。S4.4. Determine whether any time calculated in S4.3 exceeds the maximum threshold. If so, subtract the maximum threshold from the local time of the hub as the system time. Otherwise, directly use the local time of the hub as the system time.

在代码设计中,有规定节点和集线器的ma计数器位宽为16位,ma计数器是一个时间计算器,16位宽意味着最大值为65535。但是集线器的本地时钟(本地时间)是以mi为单位运行的,需要将ma*ma/mi的比值转变为以mi为单位的时钟。而ma/mi这个比值并非固定的,因此将mi计数器的位宽定义为28,也就是说,mi计数器的最大值要远远大于ma计数器,通常情况下mi计数器的最大值比ma计数器的最大值乘以ma/mi的比值还要大。因此如果让集线器的本地时钟计数器mi一直加1,如果超过最大阈值了不减去最大阈值,会使得集线器和节点的时钟失去同步,这对于时间触发网络来说是致命的错误。In the code design, it is stipulated that the bit width of the ma counter of the node and the hub is 16 bits. The ma counter is a time calculator, and the 16-bit width means that the maximum value is 65535. However, the local clock (local time) of the hub runs in units of mi, and the ratio of ma*ma/mi needs to be converted into a clock in units of mi. The ratio of ma/mi is not fixed, so the bit width of the mi counter is defined as 28, that is, the maximum value of the mi counter is much larger than the ma counter. Usually, the maximum value of the mi counter is larger than the maximum value of the ma counter multiplied by the ratio of ma/mi. Therefore, if the local clock counter mi of the hub is always increased by 1, if it exceeds the maximum threshold without subtracting the maximum threshold, the clocks of the hub and the node will lose synchronization, which is a fatal error for the time-triggered network.

S4.5、检测系统时间是否达到PSP阶段的开始时间,若达到PSP阶段的开始时间(PSP_start_T_mi:单位为mi,由同步控制模块通过获取调度表中的时隙信息计算所得),则集线器跳转至PSP阶段,进入S_PSP状态,并将IDLE_flg置为0,PSP_flg置为1;否则停留在S_IDLE状态,IDLE_flg置为1,PSP_flg置为0,IDLE_flg表示同步控制模块处于当前时隙的IDLE阶段,PSP_flg表示同步控制模块处于当前时隙的PSP阶段;S4.5, detect whether the system time reaches the start time of the PSP stage. If the start time of the PSP stage is reached (PSP_start_T_mi: the unit is mi, which is calculated by the synchronization control module by obtaining the time slot information in the scheduling table), the hub jumps to the PSP stage, enters the S_PSP state, and sets IDLE_flg to 0 and PSP_flg to 1; otherwise, it stays in the S_IDLE state, IDLE_flg is set to 1, and PSP_flg is set to 0. IDLE_flg indicates that the synchronization control module is in the IDLE stage of the current time slot, and PSP_flg indicates that the synchronization control module is in the PSP stage of the current time slot;

S4.6、检测系统时间是否达到了TP阶段开始时间(TP_start_T_mi,单位为mi,由同步控制模块通过获取调度表中的时隙信息计算所得),达到则跳转至TP阶段,进入S_TP状态,并将TP_flg置为1,PSP_flg置为0,收发模块在TP阶段进行数据传输;否则停留在S_PSP状态并将TP_flg置为0,PSP_flg置为1,TP_flg表示同步控制模块处于当前时隙的TP阶段,PSP_flg表示集线器处于当前时隙的PSP阶段;S4.6, check whether the system time has reached the TP phase start time (TP_start_T_mi, the unit is mi, calculated by the synchronization control module by obtaining the time slot information in the schedule table), if reached, jump to the TP phase, enter the S_TP state, and set TP_flg to 1, PSP_flg to 0, and the transceiver module performs data transmission in the TP phase; otherwise, stay in the S_PSP state and set TP_flg to 0, PSP_flg to 1, TP_flg indicates that the synchronization control module is in the TP phase of the current time slot, and PSP_flg indicates that the hub is in the PSP phase of the current time slot;

S4.7、检测系统时间是否达到了PRP阶段开始时间(PRP_start_T_mi:单位为mi,由同步控制模块通过获取调度表中的时隙信息计算所得),达到则跳转至PRP阶段,进入S_PRP状态,并将PRP_flg置为1,TP_flg置为0;否则停留在S_TP状态并将TP_flg置为1,PRP_flg置为0,其中PRP_flg表示集线器处于当前时隙的PRP阶段;S4.7, check whether the system time has reached the start time of the PRP phase (PRP_start_T_mi: the unit is mi, which is calculated by the synchronization control module by obtaining the time slot information in the scheduling table). If it has reached the start time, jump to the PRP phase, enter the S_PRP state, and set PRP_flg to 1 and TP_flg to 0; otherwise, stay in the S_TP state and set TP_flg to 1 and PRP_flg to 0, where PRP_flg indicates that the hub is in the PRP phase of the current time slot;

S4.8、当系统时间等于当前时隙结束时间(Slot_end_T_mi,单位为mi,由控制模块通过获取调度表中的时隙信息计算所得),同步控制模块的状态变为S4.1所述S_Init状态,将next_slot_flg置为1,PRP_flg置为0;否则停留在S_PRP状态,PRP_flg为1,next_slot_flg为0。S4.8. When the system time is equal to the end time of the current time slot (Slot_end_T_mi, in units of mi, calculated by the control module by obtaining the time slot information in the scheduling table), the state of the synchronization control module changes to the S_Init state described in S4.1, and next_slot_flg is set to 1 and PRP_flg is set to 0; otherwise, it stays in the S_PRP state, PRP_flg is 1, and next_slot_flg is 0.

在进入同步阶段后,在每个时隙的PRP阶段判断是否进行集群模式切换。如果帧解析模块中解析出来的mode change request为001,则判断MEDL解析模块中的调度表中的M1是否为1,若为1则表示当前时隙允许将集群模式切换至后继模式1,当前集群模式最后一个时隙结束时,将新的集群模式mode输出给MEDL解析模块,用于后续MEDL解析。After entering the synchronization phase, determine whether to switch the cluster mode in the PRP phase of each time slot. If the mode change request parsed in the frame parsing module is 001, determine whether M1 in the scheduling table in the MEDL parsing module is 1. If it is 1, it means that the current time slot allows the cluster mode to be switched to the subsequent mode 1. When the last time slot of the current cluster mode ends, the new cluster mode mode is output to the MEDL parsing module for subsequent MEDL parsing.

具体的,S4.6中,TP阶段包括接收窗口前阶段、接收窗口阶段、接收窗口结束后阶段,在TP阶段的具体过程包括:Specifically, in S4.6, the TP phase includes a pre-receiving window phase, a receiving window phase, and a post-receiving window phase. The specific process in the TP phase includes:

S4.6.1、在接收窗口前阶段,当系统时间等于接收窗口起始时间(Receive_window_S_T_mi,单位为mi,由同步控制模块通过获取调度表中的时隙信息计算所得),则跳转至接收窗口阶段并将receve_window_phase_flg置为1,before_window_phase_flg置为0,并将输入使能无条件置为对应的值,即enable_in[Sender_membership_flg]=0,即输入使能为低电平有效;否则停留在当前的接收窗口前阶段且将enable_in置为无效值,其中,receve_window_phase_flg表示处于接收窗口阶段;before_window_phase_flg表示接收窗口前的阶段;enable_in[Sender_membership_flg]=0,enable_in表示输入使能,Sender_membership_flg表示当前发送的节点标识;S4.6.1. In the pre-receive window stage, when the system time is equal to the receive window start time (Receive_window_S_T_mi, in units of mi, calculated by the synchronization control module by obtaining the time slot information in the schedule table), jump to the receive window stage and set receve_window_phase_flg to 1, before_window_phase_flg to 0, and unconditionally set the input enable to the corresponding value, that is, enable_in[Sender_membership_flg] = 0, that is, the input enable is low-level valid; otherwise, stay in the current pre-receive window stage and set enable_in to an invalid value, where receve_window_phase_flg indicates that it is in the receive window stage; before_window_phase_flg indicates the stage before the receive window; enable_in[Sender_membership_flg] = 0, enable_in indicates input enable, and Sender_membership_flg indicates the node identifier currently being sent;

S4.6.2、在接收窗口阶段,当系统时间等于接收窗口结束时间(Receive_window_e_T_mi,单位为mi,由同步控制模块通过获取调度表中的时隙信息计算所得),则跳转至接收窗口结束后阶段;否则停留在接收窗口阶段,并检测当前时隙的对应节点是否有数据输入,若当前时隙的对应节点有输入数据,则将对应的flg置为1,否则置为0;S4.6.2, in the receiving window stage, when the system time is equal to the receiving window end time (Receive_window_e_T_mi, in units of mi, calculated by the synchronization control module by obtaining the time slot information in the scheduling table), jump to the receiving window end stage; otherwise, stay in the receiving window stage, and detect whether the corresponding node of the current time slot has data input. If the corresponding node of the current time slot has input data, set the corresponding flg to 1, otherwise set it to 0;

S4.6.3、接收窗口结束后阶段,当系统时间等于PRP开始的时间(PRP_start_T_mi,单位为mi,由控制模块通过获取调度表中的时隙信息计算所得)时,跳转至PRP阶段,进入状态S_PRP,否则停留在S_TP状态,在S_TP状态对S4.6.2中的flg进行判断,若flg为1,则继续保持enable_in[Sender_membership_flg]=0,否则enable_in[Sender_membership_flg]=1,置为无效。S4.6.3, in the post-end stage of the receiving window, when the system time is equal to the start time of PRP (PRP_start_T_mi, in units of mi, calculated by the control module by obtaining the time slot information in the scheduling table), jump to the PRP stage and enter the state S_PRP, otherwise stay in the S_TP state, and judge the flg in S4.6.2 in the S_TP state. If flg is 1, continue to keep enable_in[Sender_membership_flg]=0, otherwise enable_in[Sender_membership_flg]=1 and set it to invalid.

在同步阶段,集线器在每个时隙的IDLE阶段获取当前时隙的信息,即从MEDL解析模块中获取当前时隙的时隙条目表,时隙条目表中的Sender Membership Flag信号表示当前时隙的发送节点标志,同步控制模块根据这个信号在TP阶段的接收窗口开始时刻产生Sender Membership Flag所表示节点的同步输入使能信号,门控模块检测到这个同步输入使能信号后,将Sender Membership Flag所表示节点的端口打开。若在接收窗口阶段检测到正确的节点有数据输入,则同步控制模块在接收窗口阶段结束后的TP阶段继续给对应端口同步输入使能信号并给其他端口产生同步输出使能信号,门控模块根据同步输入使能信号和同步输出使能信号将数据转发给其他端口。In the synchronization phase, the hub obtains the information of the current time slot in the IDLE phase of each time slot, that is, obtains the time slot entry table of the current time slot from the MEDL parsing module. The Sender Membership Flag signal in the time slot entry table indicates the sending node flag of the current time slot. The synchronization control module generates a synchronization input enable signal of the node indicated by the Sender Membership Flag at the beginning of the receiving window of the TP phase according to this signal. After the gate control module detects this synchronization input enable signal, it opens the port of the node indicated by the Sender Membership Flag. If the correct node is detected to have data input in the receiving window phase, the synchronization control module continues to send a synchronization input enable signal to the corresponding port and generates a synchronization output enable signal to other ports in the TP phase after the receiving window phase ends. The gate control module forwards the data to other ports according to the synchronization input enable signal and the synchronization output enable signal.

所述时钟生成和同步模块3包括时钟生成子模块和时钟同步子模块,所述时钟生成子模块在集线器的启动阶段工作,根据从帧解析模块获取5的Global time/startuptime和帧解析时间结合所述MEDL解析模块4提供的发送延时和传播延时求得集线器的初始时间,并通过初始时间形成集线器的本地时间(单位为mi,一个mi等于一个系统时钟周期);所述时钟同步子模块集线器的同步阶段工作,获取整形模块8传输来的时间差值,对校正项进行计算和校正,以实现在一个TDMA Round中进行至少一次地时间同步,其中,校正分为单步校正和多部校正,所述校正的规则由所述MEDL解析模块4中的调度表的决定。The clock generation and synchronization module 3 includes a clock generation submodule and a clock synchronization submodule. The clock generation submodule works in the startup phase of the hub, and obtains the initial time of the hub based on the Global time/startuptime and frame parsing time obtained from the frame parsing module 5 combined with the sending delay and propagation delay provided by the MEDL parsing module 4, and forms the local time of the hub through the initial time (the unit is mi, one mi is equal to one system clock cycle); the clock synchronization submodule works in the synchronization phase of the hub, obtains the time difference transmitted by the shaping module 8, calculates and corrects the correction item, so as to achieve at least one time synchronization in a TDMA Round, wherein the correction is divided into single-step correction and multi-step correction, and the correction rule is determined by the scheduling table in the MEDL parsing module 4.

根据协议AS6003,所述时钟生成和同步模块在每一个TDMA Round中至少执行一次时间同步需要执行三个步骤:According to protocol AS6003, the clock generation and synchronization module needs to perform three steps to perform time synchronization at least once in each TDMA Round:

A1、在整形模块中获取数据实际被获取的时间以及理论被获取的时间差diff,并将时间差diff存储于时间同步模块中;A1. Obtain the time difference diff between the actual acquisition time of the data and the theoretical acquisition time in the shaping module, and store the time difference diff in the time synchronization module;

A2、根据容错中值算法,计算出校正项;A2. Calculate the correction term according to the fault-tolerant median algorithm;

A3、若在MEDL解析模块中解析出当前时隙的Clksyn字段为1,那么在当前时隙的PRP阶段执行时钟校正,若MEDL解析模块解析出当前时隙中的字段Free_running_MAcroticks_t[0]为1,则执行单步校正,否则执行多步校正。A3. If the Clksyn field of the current time slot is parsed as 1 in the MEDL parsing module, clock correction is performed in the PRP stage of the current time slot. If the MEDL parsing module parses the field Free_running_MAcroticks_t[0] in the current time slot as 1, single-step correction is performed, otherwise multi-step correction is performed.

所述MEDL解析模块4,包括全局条目表(Global entry table)、协议参数表(Schedule/Protocol parameter)、MEDL标识表(MEDL Identifier table)、时隙参数表(slot entry table)和7种集群模式表;其中每个集群模式表包含模式控制表和若干时隙条目,在集线器开机后,在集线器开机后,在线加载配置模块将加载配置数据传输至MEDL解析模块4的存储单元RAM中,完成集线器自检后,在每个时隙开始的阶段,启动控制模块1或者同步控制模块2向MEDL解析模块4发送时隙请求信号或者全局协议参数获取请求信号,MEDL解析模块4接收到时隙请求信号或全局协议参数获取请求信号后,根据全局条目配置的各个表的起始地址和长度,结合请求信号的类型将调度表中相应的信息发送给启动控制模块或者同步控制模块。The MEDL parsing module 4 includes a global entry table, a protocol parameter table (Schedule/Protocol parameter), a MEDL identifier table, a time slot parameter table (Slot entry table) and 7 cluster mode tables; each cluster mode table includes a mode control table and a number of time slot entries. After the hub is turned on, the online loading configuration module transfers the loading configuration data to the storage unit RAM of the MEDL parsing module 4. After completing the hub self-test, at the beginning of each time slot, the startup control module 1 or the synchronization control module 2 sends a time slot request signal or a global protocol parameter acquisition request signal to the MEDL parsing module 4. After receiving the time slot request signal or the global protocol parameter acquisition request signal, the MEDL parsing module 4 sends the corresponding information in the schedule table to the startup control module or the synchronization control module according to the starting address and length of each table configured by the global entry and the type of the request signal.

所述帧解析模块5,通过对输入的帧进行解析,获取帧中的控制状态字段(C状态)的Global Time/Startup Time字段(全局时间/初始时间字段)、DMC字段(延迟模式更改)和Cluster position字段(集群位置),并将帧中的控制状态字段的Global Time/StartupTime字段传输给所述时钟生成和同步模块3,将DMC字段(延迟模式更改)和Clusterposition字段(集群位置)传输给所述集群模式切换模块6,以触发所述集群模式切换模块6发送集群切换信号给MEDL解析模块4。The frame parsing module 5 parses the input frame to obtain the Global Time/Startup Time field (global time/initial time field), the DMC field (delay mode change) and the Cluster position field (cluster position) of the control status field (C state) in the frame, and transmits the Global Time/StartupTime field of the control status field in the frame to the clock generation and synchronization module 3, and transmits the DMC field (delay mode change) and the Clusterposition field (cluster position) to the cluster mode switching module 6 to trigger the cluster mode switching module 6 to send a cluster switching signal to the MEDL parsing module 4.

在启动过程中,帧解析模块一边接收输入的帧,一边解析出帧的C状态中的时间、集群位置(含DMC、Cluster Mode、Round slot字段)和帧头(含Mode Change Request、Type);并将冷启动帧中的startup time传递给时间生成模块,用于生成本地的时钟;根据DMC、Cluster Mode、Type等字段判断帧是I帧、N帧或者冷启动帧,将帧类型标志输出到启动控制模块和同步控制模块,用于状态跳转判断。During the startup process, the frame parsing module receives the input frame and parses the time, cluster position (including DMC, Cluster Mode, Round slot fields) and frame header (including Mode Change Request, Type) in the C state of the frame; and passes the startup time in the cold start frame to the time generation module for generating the local clock; according to the DMC, Cluster Mode, Type and other fields, it determines whether the frame is an I frame, N frame or cold start frame, and outputs the frame type flag to the startup control module and the synchronization control module for state jump judgment.

所述集群模式切换模块6用于在集线器的PRP阶段检查mode change request(模式更改请求)的内容是否允许,允许则将mode change request(模式更改请求)的内容设置为DMC(延迟模式更改),当检测到本集群模式下的最后一个时隙的EOC字段有效且当前时隙即将结束时,将DMC对应的后继模式赋值给cluster mode(集群模式),并将变更后的集群模式传输给MEDL解析模块,下一个时隙即代表一个新的集群模式开始运行。The cluster mode switching module 6 is used to check whether the content of the mode change request is allowed in the PRP stage of the hub. If allowed, the content of the mode change request is set to DMC (delayed mode change). When it is detected that the EOC field of the last time slot in this cluster mode is valid and the current time slot is about to end, the successor mode corresponding to DMC is assigned to the cluster mode, and the changed cluster mode is transmitted to the MEDL parsing module. The next time slot represents the start of a new cluster mode.

所述收发模块7用于在集线器的同步阶段进行数据的收发,包括波特率生成子模块、接收子模块、发送子模块、寄存子模块和CRC校验子模块;The transceiver module 7 is used to transmit and receive data in the synchronization phase of the hub, and includes a baud rate generation submodule, a receiving submodule, a sending submodule, a register submodule and a CRC check submodule;

所述波特率生成子模块用于生成波特率;本发明中,波特率设置为5M;The baud rate generation submodule is used to generate a baud rate; in the present invention, the baud rate is set to 5M;

所述接收子模块设置为接收到了下降沿认为数据传输开始(是因为输入使能为低电平有效),数据传输结束则通过帧长计算模块提供的帧长来判断传输是否结束;The receiving submodule is configured to consider that data transmission starts when a falling edge is received (because the input enable is low level valid), and whether data transmission ends is determined by the frame length provided by the frame length calculation module;

所述发送子模块的传输开始则由整形模块提供的整形使能信号决定,所述发送子模块的传输结束是通过帧长来判断;The start of transmission of the sending submodule is determined by the shaping enable signal provided by the shaping module, and the end of transmission of the sending submodule is determined by the frame length;

所述寄存子模块与所述整形模块配合,用于将输入的数据缓存一段整形的时间;The storage submodule cooperates with the shaping module to cache the input data for a shaping period of time;

所述CRC校验子模块是用来将输入数据做CRC校验的,CRC校验方式为一边输入一边校验。The CRC check submodule is used to perform CRC check on the input data, and the CRC check mode is to check while inputting.

所述整形模块8用于隔离时域SOS故障,在TP阶段中的接收窗口的末尾增加整形延时,待集线器的系统时间到了整形延时完成时,再产生整形输出使能信号给收发模块7。The shaping module 8 is used to isolate the time domain SOS fault, add a shaping delay at the end of the receiving window in the TP phase, and generate a shaping output enable signal to the transceiver module 7 when the system time of the hub reaches the shaping delay completion.

本发明的整形模块的整形,是指时域上的整形,主要是为了避免时域SOS故障。由于集线器和节点都有一个理想的接收时间点,当帧到达的时间比理想接收时间点早时,集线器可以等到系统时间为理想接收时间点的时候再进行转发数据,但是,当帧到达的时间比理想的接收时间点晚,集线器就没办法把帧缓存到系统时间等于理想接收时间点的时候。除此之外,通过调整ma和mi的比值,也可以减少节点之间的时钟误差,但是Ma和Mi的比值在每次配置完成后便是固定值,若要修改则需要修改配置数据,操作起来不方便,因此,本发明就提出了如下的整形方案。The shaping of the shaping module of the present invention refers to shaping in the time domain, which is mainly to avoid time domain SOS failure. Since the hub and the node both have an ideal receiving time point, when the frame arrives earlier than the ideal receiving time point, the hub can wait until the system time is the ideal receiving time point before forwarding the data. However, when the frame arrives later than the ideal receiving time point, the hub cannot cache the frame until the system time is equal to the ideal receiving time point. In addition, by adjusting the ratio of ma and mi, the clock error between nodes can also be reduced, but the ratio of Ma and Mi is a fixed value after each configuration is completed. If it needs to be modified, the configuration data needs to be modified, which is inconvenient to operate. Therefore, the present invention proposes the following shaping scheme.

具体的,所述整形模块在TP阶段的接收窗口阶段的末尾加一个整形延时,等到系统时间到达整形延时完成时刻,再产生整形输出使能信号,整形输出使能信号控制收发模块将缓存在寄存子模块的数据转发出去,节点将这段整形延时当成传播延时即可。这样,不管输入到集线器的数据是在集线器接收窗口范围内的任何一个时间段(不管来早了还是来迟了),都能保证所有的接收节点收到完成的数据,而不会一部分节点收到了正确的帧,一部分节点没有收到正确的帧,整形模块有效避免了节点之间的时域SOS故障(slightly-off-specifiacation)。如图6所示,将最佳接收时间点人为的延时一个时间段hub_delay(至少为半个接收窗口),然后把这段集线器的延时算入节点的传播延时,即节点0和节点1之间的传播延时需要设置为节点0传播延时corr0、集线器延时hub_delay与集线器传播延时corr_h之和。当没有对输入数据做任何整形时,如时域SOS整形原理图中红色线段所示,当节点0的数据到达集线器接收窗口比较早时,经过集线器转发后不能在节点1的接收窗口范围内到达。Specifically, the shaping module adds a shaping delay at the end of the receiving window phase of the TP phase, and waits until the system time reaches the shaping delay completion moment, and then generates a shaping output enable signal. The shaping output enable signal controls the transceiver module to forward the data cached in the register submodule, and the node regards this shaping delay as a propagation delay. In this way, no matter whether the data input to the hub is in any time period within the hub receiving window range (no matter whether it comes early or late), it can ensure that all receiving nodes receive the completed data, and some nodes will not receive the correct frame, and some nodes will not receive the correct frame. The shaping module effectively avoids the time domain SOS failure (slightly-off-specifiacation) between nodes. As shown in Figure 6, the best receiving time point is artificially delayed by a time period hub_delay (at least half of the receiving window), and then this hub delay is counted into the node propagation delay, that is, the propagation delay between node 0 and node 1 needs to be set to the sum of node 0 propagation delay corr0, hub delay hub_delay and hub propagation delay corr_h. When no shaping is done on the input data, as shown by the red line in the time domain SOS shaping principle diagram, when the data of node 0 arrives at the hub receiving window earlier, it cannot arrive within the receiving window of node 1 after being forwarded by the hub.

所述门控模块9在集线器启动阶段,根据启动输入使能信号和启动输出使能信号对数据进行输入和输出,在集线器同步阶段,根据同步控制模块传输的同步输入使能信号和同步输出使能信号,打开和关闭节点对应的各个端口,所述门控模块包括启动门控子模块、同步门控子模块和输出选择子模块;The gating module 9 inputs and outputs data according to the startup input enable signal and the startup output enable signal in the hub startup phase, and opens and closes the ports corresponding to the nodes according to the synchronization input enable signal and the synchronization output enable signal transmitted by the synchronization control module in the hub synchronization phase. The gating module includes a startup gating submodule, a synchronization gating submodule and an output selection submodule;

门控模块包括启动门控子模块、同步门控子模块和输出选择子模块,所述启动门控子模块用于在集线器的启动阶段接收或输出数据,所述同步门控子模块用于在集线器的同步阶段根据同步输入使能信号和同步输出使能信号进行数据的接收或输出,所述输出选择子模块用于根据集线器所处的启动状态或同步状态选择输出启动门控子模块的输出数据或同步门控子模块的数据。The gating module includes a start gating submodule, a synchronous gating submodule and an output selection submodule. The start gating submodule is used to receive or output data during the startup phase of the hub, the synchronous gating submodule is used to receive or output data according to a synchronous input enable signal and a synchronous output enable signal during the synchronization phase of the hub, and the output selection submodule is used to select the output data of the start gating submodule or the data of the synchronous gating submodule according to the startup state or synchronization state of the hub.

在启动阶段,最开始可能存在数据冲突,在第二条启动路径由于采用了Bigbang机制,集线器随意选一个端口的数据转发即可;在第一条和第三条启动路径过程中由于正在运行的第一集线器会给启动的第二集线器当前的时隙信息,因此第二集线器也能正确选择输入数据。等第二集线器成功集成后,就能根据调度表提供的时隙信息进行正确的数据选择,根据时分复用的思想,一个时隙中最多有一个端口的输入使能是有效的,即只允许调度表规定的当前时隙对应节点输入数据,数据经过整形后,经过收发模块发送到门控模块。收发模块为本发明的物理层接口,本发明采用半双工的方法进行收发,因此门控模块会将数据转发至除了输入数据端口的其余所有端口。In the startup phase, there may be data conflicts at the beginning. In the second startup path, due to the Bigbang mechanism, the hub can select any port to forward data. In the first and third startup paths, the running first hub will give the second hub the current time slot information, so the second hub can also correctly select the input data. After the second hub is successfully integrated, the correct data selection can be made according to the time slot information provided by the scheduling table. According to the idea of time division multiplexing, at most one port input enable is valid in a time slot, that is, only the node corresponding to the current time slot specified in the scheduling table is allowed to input data. After the data is shaped, it is sent to the gating module through the transceiver module. The transceiver module is the physical layer interface of the present invention. The present invention adopts a half-duplex method for transceiver, so the gating module will forward the data to all ports except the input data port.

进入同步阶段后,数据的收发是通过同步门控子模块将当前时隙的正确节点发送的数据传递给收发模块中的接收子模块,而屏蔽不应该在这个时隙发送数据的节点发送的数据。接收子模块会检测下降沿来判断数据是否开始传输了,再根据帧长计算模块提供的帧长判断当前时隙的数据是否传输结束。同步阶段的数据并不会直接转发,而是进入寄存子模块中的fifo中,等到整形模块给出整形使能信号后,才会将寄存子模块中的数据输出至发送子模块,发送子模块通过判断帧长来判断传输是否结束。发送子模块将数据转发给门控模块,门控模块根据同步控制模块输出的同步输出使能信号转发数据给其他节点。After entering the synchronization phase, the data is sent and received by passing the data sent by the correct node of the current time slot to the receiving submodule in the transceiver module through the synchronous gating submodule, while shielding the data sent by the node that should not send data in this time slot. The receiving submodule detects the falling edge to determine whether the data transmission has started, and then determines whether the data transmission of the current time slot has ended according to the frame length provided by the frame length calculation module. The data in the synchronization phase will not be forwarded directly, but will enter the fifo in the storage submodule. After the shaping module gives the shaping enable signal, the data in the storage submodule will be output to the sending submodule. The sending submodule determines whether the transmission is over by judging the frame length. The sending submodule forwards the data to the gating module, and the gating module forwards the data to other nodes according to the synchronous output enable signal output by the synchronous control module.

将启动阶段的门控功能和同步阶段的门控功能分开进行设计,因此还需要一个输出选择模块。输出选择模块将启动门控和同步门控的输出数据进行选择,在启动阶段输出启动门控子模块的输出数据,在同步阶段输出同步门控子模块的输出数据。The gating function of the startup phase and the gating function of the synchronization phase are designed separately, so an output selection module is also required. The output selection module selects the output data of the startup gating and the synchronization gating, outputs the output data of the startup gating submodule in the startup phase, and outputs the output data of the synchronization gating submodule in the synchronization phase.

所述帧长度生成模块10用于根据所述MEDL解析模块提供的数据长度和帧类型以及每种帧类型固定的帧长开销计算出每次传输的帧长,并将计算出来的帧长输出给所述收发模块7和门控模块9。The frame length generation module 10 is used to calculate the frame length of each transmission according to the data length and frame type provided by the MEDL parsing module and the fixed frame length overhead of each frame type, and output the calculated frame length to the transceiver module 7 and the gating module 9.

帧长计算模块则根据MEDL解析模块获取当前时隙的数据长度APPdata lengthe和IF字段判断当前时隙输入的数据是显示帧还是隐式帧,如果是隐式帧则没有C状态,如果是显示帧则有C状态。显示帧和隐式帧都有固定的帧开销,判断出帧类型后用固定帧开销和数据长度则可计算出当前时隙发送节点的帧长,用于判断帧传输是否结束。The frame length calculation module obtains the data length APPdata lengthe and IF fields of the current time slot according to the MEDL parsing module to determine whether the data input in the current time slot is a display frame or an implicit frame. If it is an implicit frame, there is no C state, and if it is a display frame, there is a C state. Both the display frame and the implicit frame have a fixed frame overhead. After determining the frame type, the fixed frame overhead and data length can be used to calculate the frame length of the sending node in the current time slot, which is used to determine whether the frame transmission is completed.

所述在线配置模块11用于给节点或集线器配置数据,配置主机在在下传配置数据时,在配置数据的前端加上一段用于标识目的地的目的地字段,所述集线器的目的地字段和节点的目的地字段均唯一且不同,因此集线器首先会判断标识字段,若该字段被判定为配置数据是发送给集线器的,则校验配置数据中的全局条目表是否正确,如果这部分配置数据校验正确则将数据配置到MEDL解析模块的RAM Random access memory,随机存储器)中,同时,集线器也将该配置数据进行转发;若该字段被判定为配置数据是发送节点的,则将数据转发至对应的节点。The online configuration module 11 is used to configure data for nodes or hubs. When the configuration host transmits the configuration data, a destination field for identifying the destination is added to the front end of the configuration data. The destination field of the hub and the destination field of the node are unique and different. Therefore, the hub will first determine the identification field. If the field is determined to be the configuration data sent to the hub, then check whether the global entry table in the configuration data is correct. If this part of the configuration data is verified to be correct, the data is configured to the RAM Random access memory (RAM) of the MEDL parsing module. At the same time, the hub will also forward the configuration data; if the field is determined to be the configuration data of the sending node, the data will be forwarded to the corresponding node.

以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims (9)

1.一种应用于星型TTP网络的集线器,其特征在于,包括设置在物理链路层的门控模块(9)和收发模块(7),以及设置在协议层的启动控制模块(1)、同步控制模块(2)、时钟生成和同步模块(3)、MEDL解析模块(4)、帧解析模块(5)、集群模式切换模块(6)、整形模块(8)、帧长计算模块(10)和在线配置模块(11),TTP网络即时间触发网络,MEDL解析模块即消息描述列表解析模块;1. A hub applied to a star-shaped TTP network, characterized in that it comprises a gating module (9) and a transceiver module (7) arranged at a physical link layer, and a startup control module (1), a synchronization control module (2), a clock generation and synchronization module (3), a MEDL parsing module (4), a frame parsing module (5), a cluster mode switching module (6), a shaping module (8), a frame length calculation module (10) and an online configuration module (11) arranged at a protocol layer, wherein the TTP network is a time-triggered network, and the MEDL parsing module is a message description list parsing module; 所述收发模块(7)的输入端分别与所述整形模块(8)、门控模块(9)、帧长计算模块(10)连接,所述收发模块(7)的输出端分别与所述门控模块(9)、帧解析模块(5)、在线配置模块(11)连接;The input end of the transceiver module (7) is respectively connected to the shaping module (8), the gate control module (9), and the frame length calculation module (10), and the output end of the transceiver module (7) is respectively connected to the gate control module (9), the frame analysis module (5), and the online configuration module (11); 所述时钟生成和同步模块(3)的输入端分别与所述帧解析模块(5)、整形模块(8)、MEDL解析模块(4)连接,所述时钟生成和同步模块(3)的输出端分别与启动控制模块(1)、同步控制模块(2)连接;The input end of the clock generation and synchronization module (3) is respectively connected to the frame analysis module (5), the shaping module (8), and the MEDL analysis module (4); the output end of the clock generation and synchronization module (3) is respectively connected to the start control module (1) and the synchronization control module (2); 所述MEDL解析模块(4)的输入端分别与启动控制模块(1)、同步控制模块(2)、集群模式切换模块(6)和在线配置模块(11)连接,所述MEDL解析模块(4)的输出端还分别与所述帧长计算模块(10)、启动控制模块(1)、同步控制模块(2)连接;The input end of the MEDL parsing module (4) is respectively connected to the startup control module (1), the synchronization control module (2), the cluster mode switching module (6) and the online configuration module (11), and the output end of the MEDL parsing module (4) is also respectively connected to the frame length calculation module (10), the startup control module (1) and the synchronization control module (2); 所述帧解析模块(5)的输出端还与集群模式切换模块(6)连接;The output end of the frame analysis module (5) is also connected to the cluster mode switching module (6); 所述启动控制模块(1)的输出端还分别与所述门控模块(9)以及同步控制模块(2)连接;The output end of the start control module (1) is also connected to the gate control module (9) and the synchronization control module (2) respectively; 所述同步控制模块(2)的输出端还与所述门控模块(9)连接;The output end of the synchronization control module (2) is also connected to the gate control module (9); 所述启动控制模块(1)用于在集线器的启动阶段实现集线器从非同步状态过渡到同步状态,根据所述MEDL解析模块提供的Sender Membership Flag信号、时钟生成子模块提供的系统时间使集线器在启动阶段产生启动输入使能信号和启动输出使能信号,启动输入使能信号和启动输出使能信号控制集线器连接的外部节点的输入、输出,同时,在启动完成后,将启动完成时的时隙中的PSP开始时间点、TP开始时间点、PRP开始时间点和时隙结束时间点以及当前时隙数传递给同步控制模块;Sender Membership Flag信号即发送端成员变量标志信号;The startup control module (1) is used to realize the transition of the hub from an asynchronous state to a synchronous state during the startup phase of the hub, and generates a startup input enable signal and a startup output enable signal during the startup phase according to the Sender Membership Flag signal provided by the MEDL parsing module and the system time provided by the clock generation submodule, wherein the startup input enable signal and the startup output enable signal control the input and output of the external node connected to the hub, and at the same time, after the startup is completed, the PSP start time point, TP start time point, PRP start time point and time slot end time point in the time slot when the startup is completed and the current time slot number are transmitted to the synchronization control module; the Sender Membership Flag signal is a sender member variable flag signal; 所述同步控制模块用于根据集线器进入同步状态时的各时间点以及所述MEDL解析模块提供的时隙信息,在集线器进入同步状态后生成控制门控模块(9)的同步输入使能信号和同步输出使能信号以及将集线器在同步阶段中的各个时隙进行阶段划分,每个所述时隙均包括IDLE阶段,即空闲阶段;PSP阶段,即发送前的阶段;TP阶段,即发送数据阶段;PRP阶段,即发送后的阶段;所述集线器根据各个阶段的时间来进行状态跳转;The synchronization control module is used to generate a synchronization input enable signal and a synchronization output enable signal of the control gating module (9) after the hub enters the synchronization state according to each time point when the hub enters the synchronization state and the time slot information provided by the MEDL parsing module, and divide each time slot of the hub in the synchronization phase into stages, each of which includes an IDLE stage, i.e. an idle stage; a PSP stage, i.e. a stage before sending; a TP stage, i.e. a stage for sending data; and a PRP stage, i.e. a stage after sending; the hub performs state jumps according to the time of each stage; 所述时钟生成和同步模块(3)包括时钟生成子模块和时钟同步子模块,所述时钟生成子模块在集线器的启动阶段工作,根据从帧解析模块(5)获取的Global time/startuptime和帧解析时间再结合所述MEDL解析模块(4)提供的发送延时和传播延时求得集线器的初始时间,并通过初始时间形成集线器的本地时间;所述时钟同步子模块在集线器处于同步阶段时工作,获取整形模块(8)传输来的时间差值,对校正项进行计算并根据校正项校正集线器的本地时钟,以实现在一个TDMA Round中进行至少一次地时间同步,其中,校正分为单步校正和多部校正,所述校正的规则由所述MEDL解析模块(4)中的调度表的决定;Globaltime/startup time即全局时间/启动时间,TDMA Round即以时分多址形式排布的周期;The clock generation and synchronization module (3) comprises a clock generation submodule and a clock synchronization submodule. The clock generation submodule operates in the startup phase of the hub, obtains the initial time of the hub based on the Global time/startuptime and the frame parsing time obtained from the frame parsing module (5) combined with the sending delay and the propagation delay provided by the MEDL parsing module (4), and forms the local time of the hub through the initial time; the clock synchronization submodule operates when the hub is in the synchronization phase, obtains the time difference transmitted by the shaping module (8), calculates the correction item and corrects the local clock of the hub based on the correction item, so as to achieve at least one time synchronization in a TDMA Round, wherein the correction is divided into single-step correction and multi-step correction, and the correction rule is determined by the scheduling table in the MEDL parsing module (4); Global time/startup time refers to global time/startup time, and TDMA Round refers to a period arranged in the form of time division multiple access; 所述MEDL解析模块(4),包括全局条目表、协议参数表、MEDL标识表、时隙参数表和7种集群模式表;其中每个集群模式表包含模式控制表和若干时隙条目,在集线器开机后,在线配置模块将加载配置数据传输至MEDL解析模块(4)的存储单元RAM中,完成集线器自检后,在每个时隙开始的阶段,启动控制模块或者同步控制模块向MEDL解析模块(4)发送时隙请求信号或者全局协议参数获取请求信号,MEDL解析模块(4)接收到时隙请求信号或全局协议参数获取请求信号后,根据全局条目配置的各个表的起始地址和长度,结合请求信号类型将调度表中相应的信息发送给启动控制模块或者同步控制模块;The MEDL parsing module (4) comprises a global entry table, a protocol parameter table, a MEDL identification table, a time slot parameter table and seven cluster mode tables; wherein each cluster mode table comprises a mode control table and a plurality of time slot entries; after the hub is powered on, the online configuration module transfers the loaded configuration data to the storage unit RAM of the MEDL parsing module (4); after the hub self-check is completed, at the beginning of each time slot, the startup control module or the synchronization control module sends a time slot request signal or a global protocol parameter acquisition request signal to the MEDL parsing module (4); after receiving the time slot request signal or the global protocol parameter acquisition request signal, the MEDL parsing module (4) sends the corresponding information in the scheduling table to the startup control module or the synchronization control module according to the starting address and length of each table configured by the global entry and in combination with the request signal type; 所述帧解析模块(5),通过对输入的帧进行解析,获取帧中的控制状态字段的GlobalTime/Startup Time字段、DMC字段和Cluster position字段,并将帧中的控制状态字段的GlobalTime/Startup Time字段传输给所述时钟生成和同步模块(3),将DMC字段和Clusterposition字段传输给所述集群模式切换模块(6),以触发所述集群模式切换模块(6)发送集群切换信号给MEDL解析模块(4);DMC字段即延迟模式更改字段,Cluster position字段即集群位置字段;The frame parsing module (5) parses the input frame to obtain the GlobalTime/Startup Time field, the DMC field and the Cluster position field of the control status field in the frame, and transmits the GlobalTime/Startup Time field of the control status field in the frame to the clock generation and synchronization module (3), and transmits the DMC field and the Cluster position field to the cluster mode switching module (6) to trigger the cluster mode switching module (6) to send a cluster switching signal to the MEDL parsing module (4); the DMC field is the delay mode change field, and the Cluster position field is the cluster position field; 所述集群模式切换模块(6)用于在集线器的PRP阶段检查模式更改请求是否被允许,允许则将模式更改请求的内容设置为延迟模式更改的内容,当检测到调度表中表示本集群模式下最后一个时隙的字段EOC有效且当前时隙即将结束时,将延迟模式更改的内容对应的后继模式赋值给集群模式,并将变更后的集群模式传输给MEDL解析模块,下一个时隙即进入一个新的集群模式;EOC即集群周期结束;The cluster mode switching module (6) is used to check whether the mode change request is allowed in the PRP phase of the hub. If allowed, the content of the mode change request is set to the content of the delayed mode change. When it is detected that the field EOC representing the last time slot in the current cluster mode is valid and the current time slot is about to end, the subsequent mode corresponding to the content of the delayed mode change is assigned to the cluster mode, and the changed cluster mode is transmitted to the MEDL parsing module, and the next time slot enters a new cluster mode; EOC means the end of the cluster cycle; 所述收发模块(7)用于集线器进行数据的收发,包括波特率生成子模块、接收子模块、发送子模块、寄存子模块和CRC校验子模块;CRC校验子模块即循环冗余校验子模块;The transceiver module (7) is used for the hub to perform data transmission and reception, and comprises a baud rate generation submodule, a receiving submodule, a sending submodule, a storage submodule and a CRC check submodule; the CRC check submodule is a cyclic redundancy check submodule; 所述整形模块(8)用于隔离时域SOS故障,在TP阶段中的接收窗口的末尾增加整形延时,待集线器的系统时间到了整形延时完成时,再产生整形输出使能信号给收发模块(7);SOS故障即隔离时域轻微不合规故障;The shaping module (8) is used to isolate the time domain SOS fault, add a shaping delay at the end of the receiving window in the TP phase, and generate a shaping output enable signal to the transceiver module (7) when the system time of the hub reaches the shaping delay completion; the SOS fault is to isolate the minor non-compliance fault in the time domain; 所述门控模块(9)在集线器启动阶段,根据启动输入使能信号和启动输出使能信号对数据进行输入和输出,在集线器同步阶段,根据同步控制模块传输的同步输入使能信号和同步输出使能信号,打开和关闭节点对应的各个端口,所述门控模块(9)包括启动门控子模块、同步门控子模块和输出选择子模块;The gating module (9) inputs and outputs data according to a startup input enable signal and a startup output enable signal during the hub startup phase, and opens and closes each port corresponding to the node according to a synchronization input enable signal and a synchronization output enable signal transmitted by the synchronization control module during the hub synchronization phase. The gating module (9) includes a startup gating submodule, a synchronization gating submodule and an output selection submodule; 所述帧长计算模块(10)用于根据所述MEDL解析模块提供的数据长度和帧类型以及每种帧类型固定的帧长开销计算出每次传输的帧长,并将计算出来的帧长输出给所述收发模块(7)和门控模块(9);The frame length calculation module (10) is used to calculate the frame length of each transmission according to the data length and frame type provided by the MEDL parsing module and the fixed frame length overhead of each frame type, and output the calculated frame length to the transceiver module (7) and the gate control module (9); 所述在线配置模块(11)用于给节点或集线器配置数据,配置主机在下传配置数据时,在配置数据的前端加上一段用于标识目的地的字段,所述集线器和节点的标识字段均唯一且不同,若该字段被判定为配置数据是发送给集线器的,则校验配置数据中的全局条目表是否正确,如果这部分配置数据校验正确则将数据配置到MEDL解析模块的RAM,同时,集线器也将该配置数据进行转发;若该字段被判定为节点的,则集线器将数据转发出去。The online configuration module (11) is used to configure data for a node or a hub. When the configuration host transmits the configuration data, a field for identifying the destination is added to the front end of the configuration data. The identification fields of the hub and the node are unique and different. If the field is determined to be the configuration data sent to the hub, the global entry table in the configuration data is checked to see if it is correct. If this part of the configuration data is checked to be correct, the data is configured to the RAM of the MEDL parsing module. At the same time, the hub also forwards the configuration data. If the field is determined to be the node, the hub forwards the data. 2.一种应用于星型TTP网络的集线器的实现方法,使用权利要求1所述的应用于星型TTP网络的集线器,其特征在于,包括如下步骤:2. A method for implementing a hub applied to a star-shaped TTP network, using the hub applied to a star-shaped TTP network according to claim 1, characterized in that it comprises the following steps: S1、将两个集线器和若干节点连接,两个所述集线器和若干所述节点构成星型网络;S1. Connect two hubs and a plurality of nodes, so that the two hubs and the plurality of nodes form a star network; S2、对所述集线器和所述节点上电,集线器初始化完成后进入启动阶段;S2, powering on the hub and the node, and entering the startup phase after the hub is initialized; S3、在启动阶段,所述时钟生成和同步模块从帧解析模块获取的Global time/startuptime和帧解析时间结合所述MEDL解析模块提供的发送延时和传播延时求得集线器的初始时间,同时,帧长计算模块根据MEDL解析模块获取当前时隙的数据长度和IF字段计算出当前时隙的帧长,以判断帧传输是否结束,将MEDL解析模块的调度表信息和集线器的初始时间传输给所述启动控制模块,所述启动控制模块根据所述MEDL解析模块提供的信息、时钟生成子模块提供的系统时间使集线器在启动阶段产生启动输入使能信号和启动输出使能信号,同时,所述启动控制模块对所述调度表信息进行检验,检验通过后集线器进入帧听状态,并根据在规定时间范围内接收到的帧进行状态的转变,当集线器启动完成时,将此时对应的集线器的时间传输给同步控制模块,集线器进入同步阶段;IF字段即同步帧标志字段;S3. In the startup phase, the clock generation and synchronization module obtains the global time/startuptime and frame parsing time from the frame parsing module in combination with the sending delay and propagation delay provided by the MEDL parsing module to obtain the initial time of the hub. At the same time, the frame length calculation module obtains the data length of the current time slot from the MEDL parsing module and the IF field to calculate the frame length of the current time slot to determine whether the frame transmission is completed, and transmits the scheduling table information of the MEDL parsing module and the initial time of the hub to the startup control module. The startup control module enables the hub to generate a startup input enable signal and a startup output enable signal in the startup phase according to the information provided by the MEDL parsing module and the system time provided by the clock generation submodule. At the same time, the startup control module verifies the scheduling table information. After the verification, the hub enters the frame listening state and changes the state according to the frames received within the specified time range. When the hub is started, the corresponding hub time is transmitted to the synchronization control module, and the hub enters the synchronization phase; the IF field is the synchronization frame flag field; S4、所述同步控制模块输出控制门控模块的同步输入使能信号和同步输出使能信号以及将集线器在同步阶段中的每个时隙进行阶段划分,集线器根据每个时隙的IDLE、PSP、TP和PRP阶段进行状态的跳转;所述时钟生成和同步模块在每一个TDMARound中至少执行一次时间同步,所述门控模块的各端口根据输入输出使能控制信号开/关,收发模块通过整形模块给出的输出使能信号将数据输出至门控模块,根据帧长计算模块得到的数据的帧长判断是否传输结束。S4. The synchronization control module outputs the synchronization input enable signal and the synchronization output enable signal of the control gating module and divides each time slot of the hub into stages in the synchronization stage. The hub jumps the state according to the IDLE, PSP, TP and PRP stages of each time slot; the clock generation and synchronization module performs time synchronization at least once in each TDMARound, and each port of the gating module is turned on/off according to the input and output enable control signal. The transceiver module outputs data to the gating module through the output enable signal given by the shaping module, and determines whether the transmission is completed according to the frame length of the data obtained by the frame length calculation module. 3.根据权利要求2所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,集线器的启动控制模块包括有效性检查状态、帧听状态、冷启动状态、集成状态、同步状态、等待集成状态和等待同步状态;S3中,所述启动控制模块对所述调度表信息进行检验,检验通过后集线器进入帧听状态,并根据在规定时间范围内接收到的帧进行状态的转变的具体步骤为:3. According to claim 2, a method for implementing a hub applied to a star-type TTP network is characterized in that the startup control module of the hub includes a validity check state, a frame listening state, a cold start state, an integration state, a synchronization state, a waiting integration state and a waiting synchronization state; in S3, the startup control module verifies the schedule information, and after the verification, the hub enters the frame listening state, and the specific steps of changing the state according to the frames received within the specified time range are: 启动控制模块进行有效性检查:在集线器开机初始化后,对所述MEDL解析模块传输来的MEDL标识表、协议参数表、全局条目表三个表格做crc检验,三个表格crc检验完成后集线器跳转为帧听状态;Start the control module to check the validity: after the hub is powered on and initialized, perform CRC checks on the three tables of MEDL identification table, protocol parameter table, and global entry table transmitted by the MEDL parsing module. After the CRC checks on the three tables are completed, the hub jumps to the frame listening state; 集线器为帧听状态时,用于进行帧识别,集线器处于帧听状态时继续接收帧,若在2个TDMA Round时间范围内未检测到帧,则集线器跳转为冷启动状态,若在2个TDMA Round时间范围内检测到有效的冷启动帧,则集线器跳转成等待集成状态,若在2个TDMA Round时间范围内检测到有效的同步帧,则集线器跳转为等待同步状态;When the hub is in the frame listening state, it is used for frame recognition. The hub continues to receive frames in the frame listening state. If no frame is detected within 2 TDMA Round time ranges, the hub jumps to the cold start state. If a valid cold start frame is detected within 2 TDMA Round time ranges, the hub jumps to the waiting integration state. If a valid synchronization frame is detected within 2 TDMA Round time ranges, the hub jumps to the waiting synchronization state. 集线器处于冷启动状态一共包括第一冷启动阶段和第二冷启动阶段,在集线器处于冷启动状态时,集线器继续接收帧,集线器首先处于第一冷启动阶段,集线器在处于第一冷启动阶段时执行Bigbang机制,若在1个TDMA Round范围内检测到有效的冷启动帧且CRC校验成功,则跳转到第二冷启动阶段,否则仍然停留在第一冷启动阶段;Bigbang机制即碰撞避让机制;The hub is in the cold start state, which includes the first cold start stage and the second cold start stage. When the hub is in the cold start state, the hub continues to receive frames. The hub is first in the first cold start stage. The hub executes the Bigbang mechanism in the first cold start stage. If a valid cold start frame is detected within 1 TDMA Round and the CRC check succeeds, it jumps to the second cold start stage, otherwise it still stays in the first cold start stage; the Bigbang mechanism is a collision avoidance mechanism; 若集线器处于第二冷启动阶段时,执行帧识别,在1个TDMA Round范围内若检测到有效的冷启动帧,则集线器跳转为集成状态, 否则集线器跳转回第一冷启动阶段;If the hub is in the second cold start phase, frame recognition is performed. If a valid cold start frame is detected within one TDMA Round, the hub jumps to the integrated state, otherwise the hub jumps back to the first cold start phase; 若集线器为等待集成状态时,若在当前的时隙结束前检测CRC校验为正确的,则集线器变为集成状态,否则集线器重新变为帧听状态;If the hub is in the waiting integration state, if the CRC check is correct before the end of the current time slot, the hub changes to the integration state, otherwise the hub changes to the frame listening state again; 若集线器为集成状态时,若在一个TDMA Round范围内无有效帧或者无帧,则集线器重新变为帧听状态,若在一个TDMA Round范围内检测到来自不同于上一次发送节点的另外节点发送进来的有效帧,则集线器跳转至同步状态;If the hub is in the integrated state, if there is no valid frame or no frame within a TDMA Round range, the hub will change to the frame listening state again. If a valid frame sent from another node different from the last sending node is detected within a TDMA Round range, the hub will jump to the synchronous state; 若集线器为等待同步状态时,若在当前的时隙结束前检测到有效帧,则集线器变为同步状态,否则集线器重新变为帧听状态;If the hub is in the waiting synchronization state, if a valid frame is detected before the end of the current time slot, the hub changes to the synchronization state, otherwise the hub changes to the frame listening state again; 当集线器进入同步状态时,将启动完成时的时隙中的PSP开始时间点、TP开始时间点、PRP开始时间点和时隙结束时间点以及当前时隙数传递给同步控制模块。When the hub enters the synchronization state, the PSP start time point, TP start time point, PRP start time point and time slot end time point in the time slot when the startup is completed and the current time slot number are passed to the synchronization control module. 4.根据权利要求2所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,S4中,所述同步控制模块输出控制门控模块的输入输出使能控制信号以及将集线器在同步阶段中的每个时隙进行阶段划分,集线器根据各个时隙进行状态的跳转的具体步骤为:4. The implementation method of a hub applied to a star-type TTP network according to claim 2 is characterized in that, in S4, the synchronization control module outputs an input and output enable control signal of the control gate module and divides each time slot of the hub in the synchronization phase into stages, and the specific steps of the hub jumping the state according to each time slot are: S4.1、在同步阶段,在每一个时隙开始时,集线器均会进入S_Init状态,对当前系统是否活跃、集群模式是否进行切换进行判断,然后进入每个时隙的IDLE阶段,集线器跳转至S_IDLE状态,即空闲状态;S_Init状态即同步状态下的初始状态;S4.1. In the synchronization phase, at the beginning of each time slot, the hub will enter the S_Init state to determine whether the current system is active and whether the cluster mode is switched, and then enter the IDLE phase of each time slot. The hub jumps to the S_IDLE state, that is, the idle state; the S_Init state is the initial state under the synchronization state; S4.2、同步控制模块持续获取MEDL解析模块中的当前时隙信息,待当前时隙信息更新完成后,进入步骤4.3;S4.2, the synchronization control module continues to obtain the current time slot information in the MEDL parsing module, and after the current time slot information is updated, it goes to step 4.3; S4.3、将在线配置模块中存储的时隙信息赋值给同步控制模块中的寄存器,所述同步控制模块根据获取的时隙信息计算当前时隙信息的结束时间、PSP阶段开始时间、TP阶段开始时间、PRP阶段开始时间、TP阶段中接收窗口的开始时间和结束时间;S4.3, assigning the time slot information stored in the online configuration module to the register in the synchronization control module, and the synchronization control module calculates the end time of the current time slot information, the start time of the PSP phase, the start time of the TP phase, the start time of the PRP phase, and the start time and end time of the receiving window in the TP phase according to the acquired time slot information; S4.4、判断S4.3中计算所得的任一时间是否超过最大阈值,若超出最大阈值,则将集线器的本地时间减去最大阈值作为系统时间,否则,直接使用集线器的本地时间作为系统时间;S4.4, determine whether any time calculated in S4.3 exceeds the maximum threshold. If so, subtract the maximum threshold from the local time of the hub as the system time. Otherwise, directly use the local time of the hub as the system time. S4.5、检测系统时间是否达到PSP阶段的开始时间,若达到PSP阶段的开始时间,则集线器跳转至PSP阶段,进入S_PSP状态,并将IDLE_flg置为0,PSP_flg置为1;否则停留在S_IDLE状态,IDLE_flg置为1,PSP_flg置为0,IDLE_flg表示同步控制模块处于当前时隙的IDLE阶段,PSP_flg表示集线器处于当前时隙的PSP阶段;S_PSP状态即同步状态下的发送前阶段状态;S4.5, check whether the system time reaches the start time of the PSP stage. If it reaches the start time of the PSP stage, the hub jumps to the PSP stage, enters the S_PSP state, and sets IDLE_flg to 0 and PSP_flg to 1; otherwise, it stays in the S_IDLE state, IDLE_flg is set to 1, PSP_flg is set to 0, IDLE_flg indicates that the synchronization control module is in the IDLE stage of the current time slot, and PSP_flg indicates that the hub is in the PSP stage of the current time slot; the S_PSP state is the pre-sending stage state under the synchronization state; S4.6、检测系统时间是否达到了TP阶段开始时间,达到则跳转至TP阶段,进入S_TP状态,并将TP_flg置为1,PSP_flg置为0,在该阶段,收发模块进行数据传输;否则停留在S_PSP状态并将TP_flg置为0,PSP_flg置为1,TP_flg表示同步控制模块处于当前时隙的TP阶段,PSP_flg表示集线器处于当前时隙的PSP阶段;S_TP状态即同步状态下的传输阶段状态;S4.6, check whether the system time has reached the start time of the TP phase, if it has reached it, jump to the TP phase, enter the S_TP state, and set TP_flg to 1, PSP_flg to 0, in this phase, the transceiver module performs data transmission; otherwise, stay in the S_PSP state and set TP_flg to 0, PSP_flg to 1, TP_flg indicates that the synchronization control module is in the TP phase of the current time slot, PSP_flg indicates that the hub is in the PSP phase of the current time slot; S_TP state is the transmission phase state under the synchronization state; S4.7、检测系统时间是否达到了PRP阶段开始时间,达到则跳转至PRP阶段,进入S_PRP状态,并将PRP_flg置为1,TP_flg置为0;否则停留在S_TP状态并将TP_flg置为1,PRP_flg置为0,其中PRP_flg表示集线器处于当前时隙的PRP阶段;S_PRP状态即同步状态下的接收后阶段状态;S4.7, check whether the system time has reached the start time of the PRP phase, if it has reached it, jump to the PRP phase, enter the S_PRP state, and set PRP_flg to 1, TP_flg to 0; otherwise, stay in the S_TP state and set TP_flg to 1, PRP_flg to 0, where PRP_flg indicates that the hub is in the PRP phase of the current time slot; the S_PRP state is the post-receive phase state in the synchronous state; S4.8、当系统时间等于当前时隙结束时间,同步控制模块的状态变为S4.1所述S_Init状态,将next_slot_flg置为1,PRP_flg置为0;否则停留在S_PRP状态,PRP_flg为1,next_slot_flg为0,next_slot_flg即下一时隙到来标志。S4.8. When the system time is equal to the end time of the current time slot, the state of the synchronization control module changes to the S_Init state described in S4.1, and next_slot_flg is set to 1 and PRP_flg is set to 0; otherwise, it stays in the S_PRP state, PRP_flg is 1, next_slot_flg is 0, and next_slot_flg is the arrival flag of the next time slot. 5.根据权利要求4所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,S4.6中,TP阶段包括接收窗口前阶段、接收窗口阶段、接收窗口结束后阶段,在TP阶段的具体过程包括:5. The implementation method of a hub applied to a star-type TTP network according to claim 4 is characterized in that, in S4.6, the TP stage includes a pre-receiving window stage, a receiving window stage, and a post-receiving window stage, and the specific process in the TP stage includes: S4.6.1、在接收窗口前阶段,当系统时间等于接收窗口起始时间点,则跳转至接收窗口阶段并将receve_window_phase_flg置为1,before_window_phase_flg置为0,并将输入使能无条件置为对应的值,即enable_in[Sender_membership_flg]=0,即输入使能为低电平有效;否则停留在当前的接收窗口前阶段且将enable_in置为无效值,其中,receve_window_phase_flg表示处于接收窗口阶段;before_window_phase_flg表示接收窗口前的阶段;enable_in[Sender_membership_flg]=0,enable_in表示输入使能,Sender_membership_flg表示当前发送的节点标识;S4.6.1. In the pre-receive window stage, when the system time is equal to the receive window start time point, jump to the receive window stage and set receve_window_phase_flg to 1, before_window_phase_flg to 0, and unconditionally set the input enable to the corresponding value, that is, enable_in[Sender_membership_flg]=0, that is, the input enable is low-level valid; otherwise, stay in the current pre-receive window stage and set enable_in to an invalid value, where receve_window_phase_flg indicates that it is in the receive window stage; before_window_phase_flg indicates the stage before the receive window; enable_in[Sender_membership_flg]=0, enable_in indicates input enable, and Sender_membership_flg indicates the node identifier currently being sent; S4.6.2、在接收窗口阶段,当系统时间等于接收窗口结束时间点,则跳转至接收窗口结束后阶段;否则停留在接收窗口阶段,并检测当前时隙的对应节点是否有数据输入,若当前时隙的对应节点有输入数据,则将对应的flg置为1,否则置为0,flg即标志位;S4.6.2, in the receiving window stage, when the system time is equal to the receiving window end time point, jump to the receiving window end stage; otherwise, stay in the receiving window stage and detect whether the corresponding node of the current time slot has data input. If the corresponding node of the current time slot has input data, set the corresponding flg to 1, otherwise set it to 0, flg is the flag bit; S4.6.3、接收窗口结束后阶段,当系统时间等于PRP开始的时间点时,跳转至PRP阶段,进入状态S_PRP,否则停留在S_TP状态,在S_TP状态对S4.6.2中的flg进行判断,若flg为1,则继续保持enable_in[Sender_membership_flg]=0,否则enable_in[Sender_membership_flg]=1,置为无效。S4.6.3. In the post-receive window phase, when the system time is equal to the start time of PRP, jump to the PRP phase and enter the S_PRP state, otherwise stay in the S_TP state. In the S_TP state, the flg in S4.6.2 is judged. If flg is 1, enable_in[Sender_membership_flg]=0 is maintained, otherwise enable_in[Sender_membership_flg]=1 and is set to invalid. 6.根据权利要求2所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,所述时钟生成和同步模块在每一个TDMARound中至少执行一次时间同步的具体过程为:6. The implementation method of a hub applied to a star-type TTP network according to claim 2, characterized in that the specific process of the clock generation and synchronization module performing time synchronization at least once in each TDMARound is: A1、在整形模块中获取数据实际被获取的时间以及理论被获取的时间差diff,并将时间差diff存储于时间同步子模块中;A1. Obtain the time difference diff between the actual acquisition time of the data and the theoretical acquisition time in the shaping module, and store the time difference diff in the time synchronization submodule; A2、根据容错中值算法,计算出校正项;A2. Calculate the correction term according to the fault-tolerant median algorithm; A3、若在MEDL解析模块中解析出当前时隙的Clksyn字段为1,那么在当前时隙的PRP阶段执行时钟校正,若MEDL解析模块解析出当前时隙中的字段Free_running_MAcroticks_t[0]为1,则执行单步校正,否则执行多步校正,Clksyn字段即是否用于执行时钟矫正的标志字段,Free_running_MAcroticks_t[0]即宏刻度自由运行标志。A3. If the Clksyn field of the current time slot is parsed as 1 in the MEDL parsing module, clock correction is performed in the PRP stage of the current time slot. If the MEDL parsing module parses the field Free_running_MAcroticks_t[0] in the current time slot as 1, single-step correction is performed, otherwise multi-step correction is performed. The Clksyn field is the flag field that indicates whether to perform clock correction, and Free_running_MAcroticks_t[0] is the macro-scale free running flag. 7.根据权利要求2所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,所述收发模块(7)用于在集线器的同步阶段进行数据的收发,包括波特率生成子模块、接收子模块、发送子模块、寄存子模块和CRC校验子模块,7. The implementation method of a hub applied to a star-type TTP network according to claim 2, characterized in that the transceiver module (7) is used to transmit and receive data in the synchronization phase of the hub, and comprises a baud rate generation submodule, a receiving submodule, a sending submodule, a register submodule and a CRC check submodule, 所述波特率生成子模块用于生成波特率;The baud rate generation submodule is used to generate a baud rate; 所述接收子模块设置为接收到了下降沿认为数据传输开始,数据传输结束则通过帧长计算模块提供的帧长来判断传输是否结束;The receiving submodule is configured to determine whether data transmission starts when a falling edge is received, and whether data transmission ends when the frame length provided by the frame length calculation module is used to determine whether the transmission ends; 所述发送子模块的传输开始则由整形模块提供的使能信号决定,所述发送子模块的传输结束是通过帧长来判断;The start of transmission of the sending submodule is determined by the enable signal provided by the shaping module, and the end of transmission of the sending submodule is determined by the frame length; 所述寄存子模块与所述整形模块配合,用于将输入的数据寄存一段整形的时间;The storage submodule cooperates with the shaping module to store the input data for a shaping period of time; 所述CRC校验子模块是用来将输入数据做CRC校验的,CRC校验方式为一边输入一边校验。The CRC check submodule is used to perform CRC check on the input data, and the CRC check mode is to check while inputting. 8.根据权利要求2或7所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,所述整形模块在TP阶段的接收窗口阶段的末尾加一个整形延时,等到系统时间到达整形延时完成时刻,再产生输出使能,输出使能控制收发模块将缓存在寄存子模块的数据转发出去。8. According to claim 2 or 7, a method for implementing a hub applied to a star-type TTP network is characterized in that the shaping module adds a shaping delay at the end of the receiving window phase of the TP phase, and generates an output enable when the system time reaches the shaping delay completion moment, and the output enable controls the transceiver module to forward the data cached in the storage submodule. 9.根据权利要求2所述的一种应用于星型TTP网络的集线器的实现方法,其特征在于,门控模块包括启动门控子模块、同步门控子模块和输出选择子模块,所述启动门控子模块用于在集线器的启动阶段接收或输出数据,所述同步门控子模块用于在集线器的同步阶段根据同步输入使能信号和同步输出使能信号进行数据的接收或输出,所述输出选择子模块用于根据集线器所处的启动状态或同步状态选择输出启动门控子模块的输出数据或同步门控子模块的数据。9. According to claim 2, a method for implementing a hub applied to a star-type TTP network is characterized in that the gating module includes a startup gating submodule, a synchronization gating submodule and an output selection submodule, the startup gating submodule is used to receive or output data in the startup phase of the hub, the synchronization gating submodule is used to receive or output data according to a synchronization input enable signal and a synchronization output enable signal in the synchronization phase of the hub, and the output selection submodule is used to select and output the output data of the startup gating submodule or the data of the synchronization gating submodule according to the startup state or synchronization state of the hub.
CN202210629084.XA 2022-06-06 2022-06-06 A hub applied to star-shaped TTP network and its implementation method Active CN115037571B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210629084.XA CN115037571B (en) 2022-06-06 2022-06-06 A hub applied to star-shaped TTP network and its implementation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210629084.XA CN115037571B (en) 2022-06-06 2022-06-06 A hub applied to star-shaped TTP network and its implementation method

Publications (2)

Publication Number Publication Date
CN115037571A CN115037571A (en) 2022-09-09
CN115037571B true CN115037571B (en) 2024-05-17

Family

ID=83123108

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210629084.XA Active CN115037571B (en) 2022-06-06 2022-06-06 A hub applied to star-shaped TTP network and its implementation method

Country Status (1)

Country Link
CN (1) CN115037571B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005053244A2 (en) * 2003-11-19 2005-06-09 Honeywell International Inc. Simplified time synchronization for a centralized guardian in a tdma star network
CN110149260A (en) * 2019-05-09 2019-08-20 中国航空工业集团公司西安航空计算技术研究所 A kind of starting of time trigger bus cluster and method for restarting and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ATE545224T1 (en) * 2005-06-28 2012-02-15 Tttech Computertechnik Ag SECURELY STARTING UP A NETWORK

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005053244A2 (en) * 2003-11-19 2005-06-09 Honeywell International Inc. Simplified time synchronization for a centralized guardian in a tdma star network
CN110149260A (en) * 2019-05-09 2019-08-20 中国航空工业集团公司西安航空计算技术研究所 A kind of starting of time trigger bus cluster and method for restarting and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
星型TTP总线中的集线器技术研究;陈长胜;何向栋;张旭;;电子技术;20170425(第04期);全文 *

Also Published As

Publication number Publication date
CN115037571A (en) 2022-09-09

Similar Documents

Publication Publication Date Title
US7839868B2 (en) Communication method and system for the transmission of time-driven and event-driven Ethernet messages
CN108847961B (en) Large-scale high-concurrency deterministic network system
CN110149260B (en) Time-triggered bus cluster starting and restarting method and device
JP5382472B2 (en) Data relay apparatus and data relay method used in the apparatus
WO2014128802A1 (en) Interface device and bus system
WO2005053240A2 (en) Relaying data in unsynchronous mode of braided ring networks
Kong et al. Run-time recovery and failure analysis of time-triggered traffic in time sensitive networks
CN108279597A (en) A kind of computer interlocking platform courses method based on finite state machine
US20150124600A1 (en) Method for transmitting data in a packet-oriented communications network and correspondingly configured user terminal in said communications network
Pimentel et al. Dependable automotive CAN networks
JP2000092089A (en) Data transmission system
CN115037571B (en) A hub applied to star-shaped TTP network and its implementation method
US20100082875A1 (en) Transfer device
Claesson et al. An efficient TDMA start-up and restart synchronization approach for distributed embedded systems
CN114039909B (en) Method for realizing rapid real-time spanning tree protocol
CN114697270A (en) EPA network model-based arbitration method, system, equipment and medium
CN115695323A (en) Method, device and system for determining message sending period
Driscoll et al. Maximizing fault tolerance in a low-s WaP data network
US11463373B2 (en) In-vehicle communication system, relay device, and communication method
Peng et al. A distributed tsn time synchronization algorithm with increased tolerance for failure scenarios
Abuteir et al. Mixed-criticality systems based on time-triggered ethernet with multiple ring topologies
Song et al. Asynchronous Dual-Channel Controller Area Network for Tolerating Inconsistent Message Omission and Duplication
Hu et al. On the software-based development and verification of automotive control systems
JP2000261452A (en) Network system and terminal
Chang et al. A novel scheme for modeling and analyzing of FlexRay communication systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant