CN105487403A - Establishment of motion control system based on CAN and simulation modeling method - Google Patents

Establishment of motion control system based on CAN and simulation modeling method Download PDF

Info

Publication number
CN105487403A
CN105487403A CN201510731859.4A CN201510731859A CN105487403A CN 105487403 A CN105487403 A CN 105487403A CN 201510731859 A CN201510731859 A CN 201510731859A CN 105487403 A CN105487403 A CN 105487403A
Authority
CN
China
Prior art keywords
module
bus
node
data
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.)
Pending
Application number
CN201510731859.4A
Other languages
Chinese (zh)
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.)
WUHAN HUAMAO INDUSTRY AUTOMATION CO LTD
Original Assignee
WUHAN HUAMAO INDUSTRY AUTOMATION CO LTD
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 WUHAN HUAMAO INDUSTRY AUTOMATION CO LTD filed Critical WUHAN HUAMAO INDUSTRY AUTOMATION CO LTD
Priority to CN201510731859.4A priority Critical patent/CN105487403A/en
Publication of CN105487403A publication Critical patent/CN105487403A/en
Pending legal-status Critical Current

Links

Abstract

The invention relates to a motion control system based on a CAN bus. The system comprises a control unit, a rectification unit, an inversion unit, an executive motor, an industrial control computer, a CAN card, a physical layer module, a data link layer module, an application layer module, and a hardware interface module. The physical layer module comprises a CAN physical communication medium and a CAN transceiver. A CAN core controller comprises a sending module, a receiving module, an arbitration module, and an acceptance filtering module. The application layer module comprises a simulation center computer, and an application layer protocol uses a CANopen protocol. Beneficial effects of the system are that the system provides the hardware interface module which directly connects the physical device of a to-be-tested node with the system, so as to realize performance tests on an accessed node device under an environment that a complete physical system is not needed. An EDF dynamic priority scheduling algorithm can improve communication capability of the bus, improves handling capacity of the bus, so as to improve real-time performance of the bus system.

Description

A kind of kinetic control system based on CAN is set up and emulation modelling method
Technical field
The present invention relates to CAN communication system, particularly relate to a kind of kinetic control system based on CAN and set up and emulation modelling method.
Background technology
CAN (ControllerAreaNetwork), i.e. controller local area network.CAN transmission mode effectively can solve the problem that conventional data exchange method (i.e. point-to-point transmission mode) cannot meet the communicating requirement of a large amount of electronic control system and the communication system used in Hyundai Motor.
CANopen is the procotol of the application layer based on CAN, by CAL protocol extension.Just approved widely since issue.Two kinds of transmission mechanisms of this agreement are that CAN transmits the above data of 8 byte and provides a set of solution.Such as, by CANopen agreement and equipment sub-protocol thereof, Digital and analog input/output module sub-protocol, driven element agreement, operating equipment sub-protocol, controller, scrambler sub-protocol etc.This makes the product of Duo Jia manufacturer can be used in any CANopen network, solves consistance, interoperability and interchangeability problem.Initial CANopen is mainly used in embedded industry controlling system, because its agreement refining, transparent, be convenient to understand, have again higher real-time and reliability, data transmission speed high, the advantages [5] such as networking cost is low, in recent years, industry-by-industry is applied to.CAN is relatively more extensive in the application of China, but also rests in the application of lower level, and is all the agreement of some simple application layers of oneself definition, does not have with the upper-layer protocol of the CAN of international standard compatible.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of kinetic control system based on CAN and sets up the method for CAN realistic model based on EDF dynamic priority scheduling algorithm, the communication capacity solving CAN in current kinematic system is poor, handling capacity is low, the problem of real-time performance difference.
The technical scheme that the present invention solves the problems of the technologies described above is as follows, a kind of kinetic control system based on CAN, it is characterized in that: comprise control module, rectification unit, inversion unit, actuating motor, industrial computer, CAN card, physical layer block, Data Link Layer Module, application layer module and hardware interface module; Described physical layer block comprises CAN physical mediums of communication and CAN transceiver, and described CAN physical mediums of communication is used for settling signal transmission, and described CAN transceiver provides differential transmission to bus and receiving function; Described Data Link Layer Module comprises CAN core controller, described CAN core controller comprises sending module, receiver module, arbitration modules and acceptance filtenng module, described sending module is used for information frame to mail to Physical layer, described receiver module is used for from Physical layer obtaining information frame, described arbitration modules is used for arbitrating with the information frame received of sending out, described acceptance filtenng module, from data link layer received frame information, filters the data of this node needs by checking and accepting mask off code and examination code; Described application layer module comprises Simulation Center computing machine, and for analog node device emulation model, application layer protocol adopts CANopen agreement; Described hardware interface module is used for the communication between hardware and Physical layer.
Further, described control module adopts CU320-2DP control module; Described rectification unit adopts intelligent electric source module, and three-phase alternating current is rectified into direct current by described intelligent electric source module, and direct current is fed back to electrical network, and described intelligent electric source module keeps communicating by Drive-CLiQ with described control module; By Drive-CLiQ interface between described inversion unit and control module, carry out fast data exchange; The scrambler of described inversion unit is connected by Drive-CLiQ cable, by the feedback signal back of scrambler to control module; Described industrial computer comprises main frame, display, mouse and keyboard; Described CAN card adopts XJA1000CAN controller as main control chip.
Further, described sending module comprises framing module, signal transmitting module and transmit control device, and transmit control device is connected with framing module and signal transmitting module by bus; When receiving corresponding signal, framing module is by complete information frames convey to signal transmitting module, and current data position is sent to CAN by signal transmitting module.
Further, described application layer module also comprises simulation actuating equipment.
Further, described application layer module adopts C language as developing instrument, is built by compiling under BorlandC++2.0 translation and compiling environment.
Set up a method for CAN realistic model based on EDF dynamic priority scheduling algorithm, it is characterized in that: first using state, migration and condition set up the nodal analysis method relating to communication activity part under Stateflow environment; Described nodal analysis method comprises node transmitting portion, data buffer section and data unit; By 16 node submodules under time reference, input/output variable, Stateflow environment and bus arbitration submodule composition realistic model female module.
Further, described bus arbitration submodule, in communication process, has idle condition, busy condition and frame period state three kinds of states; When bus does not have Signal transmissions, bus is in idle condition state; During the signal sent when there being node, through arbitrating the arbitration of function, after arbitration terminates, bus starts the information of transmission node, and bus is in busy condition; After nodal information transmission completes, bus is getting back to idle condition again after a frame period state; In simulation process, the arbitration of bus is realized by arbitration function, and the priority of each node is that node 1 priority is high, and node 16 is minimum; Whether described arbitration function is 1 and determine whether arbitrate successfully, if 1 is arbitrated successfully by decision node current state.
Further, described node transmitting portion comprises without task status, waits for arbitrate state, transmission state, frame period state and state transition line; The flow process of its State Transferring is that first node is in without task status, buffer zone is entered Deng pending data, exit this state and enter wait arbitrate state, whether at this time start monitoring bus is idle condition, if it is the competition of bus is participated in, if won in bus contention, then the data collected are sent, be sent completely, come back to without task status; Sharing out the work of described frame period state and part described state transition line each task priority of completion system; Described node transmitting portion also comprises retransmission mechanism, by judging that the off period is that the number being less than 0 determines whether the data in bus are retransmitted;
Described data buffer section comprises buffer-empty and non-NULL two states, and capacity setting is 1, the loss of data old when there being new data to enter impact damper; Quantity of information is set to fixed value 100bits, the totalframes that after adopting b1 record node each run to complete, success sends in bus;
Described data unit comprises generation and framing two states of data, and wherein data are from the random function part of described realistic model female module, adopts p1 to record the number of the frame that node each run produces.
Further, described node submodule, bus arbitration submodule are all parallel organization.
The invention has the beneficial effects as follows: the invention provides hardware interface module, the physical equipment of node to be measured is directly accessed the present invention, the performance test to access node apparatus under the environment without the need to complete physical system can be realized; Application layer module also comprises simulation actuating equipment, and simulation actuating equipment is used for replacing other not produce the node of hardware device, and form complete CAN communication system, now CAN communication system is software and hardware combined analogue system; The design and analysis of the present invention to CAN communication system provides useful instrument, effectively can reduce the design of bus node, development& testing cost, shortens the R&D cycle.EDF dynamic priority scheduling algorithm more can improve the communication capacity of bus, improves the handling capacity of bus, and then can improve the real-time performance of bus system.
Accompanying drawing explanation
Fig. 1 is the structured flowchart of intelligent electric source module of the present invention;
Fig. 2 is SDO read-write object Dictionary operation FB(flow block) of the present invention;
Fig. 3 is the transmission of PDO message of the present invention and receives FB(flow block);
Fig. 4 is CAN realistic model female module schematic diagram of the present invention;
Fig. 5 is the structural representation that the present invention arbitrates discriminant function;
Fig. 6 is the structured flowchart of node module of the present invention;
Fig. 7 is invention employing EDF dispatching algorithm Bus simulator model schematic;
Fig. 8 is the Simulation results figure that the present invention adopts fixed priority algorithm;
Fig. 9 is the Simulation results figure that the present invention adopts EDF dispatching algorithm;
Figure 10 is that the present invention adopts fixed priority algorithm and the Simulation results comparison diagram adopting EDF dispatching algorithm.
In figure 1, node transmitting portion; 2, data buffer section; 3, data unit; 4, idle condition; 5, busy condition; 6, frame period state.
Embodiment
Be described principle of the present invention and feature below in conjunction with accompanying drawing, example, only for explaining the present invention, is not intended to limit scope of the present invention.
Embodiments of the invention are described for SinamicsS120 system.
Based on a kinetic control system for CAN, it is characterized in that: comprise control module, rectification unit, inversion unit, actuating motor, industrial computer, CAN card, physical layer block, Data Link Layer Module, application layer module and hardware interface module; Described physical layer block comprises CAN physical mediums of communication and CAN transceiver, and described CAN physical mediums of communication is used for settling signal transmission, and described CAN transceiver provides differential transmission to bus and receiving function; Described Data Link Layer Module comprises CAN core controller, described CAN core controller comprises sending module, receiver module, arbitration modules and acceptance filtenng module, described sending module is used for information frame to mail to Physical layer, described receiver module is used for from Physical layer obtaining information frame, described arbitration modules is used for arbitrating with the information frame received of sending out, described acceptance filtenng module, from data link layer received frame information, filters the data of this node needs by checking and accepting mask off code and examination code; Described application layer module comprises Simulation Center computing machine, and for analog node device emulation model, application layer protocol adopts CANopen agreement; Described hardware interface module is used for the communication between hardware and Physical layer.
The control module of SinamicsS120 drive system uses CU320, it is the brain of drive system, be responsible for all modules controlling and coordinate in whole drive system, complete the electric current loop of each axle, the speed ring even control of position ring, and can intercourse data between each axle that same CU320 controls, namely any axle can read the data of other axle on control module.According to the difference of the quantity of peripheral I/O module connected, axle control model, required function and CF card, the quantity that 1 piece of CU320 can control axle is also different.Native system adopts CU320-2DP control module, and it is the upgraded version of CU320, under identical peripheral components, can control the more of axle; Three-phase alternating current is rectified into direct current by described rectification unit, and direct current is fed back to electrical network, but DC bus-bar voltage can not regulate.Described rectification unit is intelligent electric source module, and its application scenario to product is different, and be divided into several grade according to the difference of power, the energy feedback mode that the difference of power is taked is also different, and communication modes is also different.Lower powered power module adopts terminal to control, and powerful power module is controlled by Drive-CLiQ interface, carries out exchanges data by this interface and main control unit.Intelligent electric source module keeps communicating by Drive-CLiQ with control module, and SLM structural drawing model as shown in Figure 1; By Drive-CLiQ interface between described inversion unit and control module, carry out fast data exchange; The scrambler of described inversion unit is connected by Drive-CLiQ cable, by the feedback signal back of scrambler to control module; Described industrial computer comprises main frame, display, mouse and keyboard; Described CAN card adopts XJA1000CAN controller as main control chip.
Described sending module comprises framing module, signal transmitting module and transmit control device, and transmit control device is connected with framing module and signal transmitting module by bus; When receiving corresponding signal, framing module is by complete information frames convey to signal transmitting module, and current data position is sent to CAN by signal transmitting module.
Described application layer module also comprises simulation actuating equipment.
Described application layer module adopts C language as developing instrument, is built by compiling under BorlandC++2.0 translation and compiling environment.
Set up a method for CAN realistic model based on EDF dynamic priority scheduling algorithm, it is characterized in that: first using state, migration and condition set up the nodal analysis method relating to communication activity part under Stateflow environment; Described nodal analysis method comprises node transmitting portion, data buffer section and data unit; By 16 node submodules under time reference, input/output variable, Stateflow environment and bus arbitration submodule composition realistic model female module.
Described bus arbitration submodule, in communication process, has idle condition, busy condition and frame period state three kinds of states; When bus does not have Signal transmissions, bus is in idle condition state; During the signal sent when there being node, through arbitrating the arbitration of function, after arbitration terminates, bus starts the information of transmission node, and bus is in busy condition; After nodal information transmission completes, bus is getting back to idle condition again after a frame period state; In simulation process, the arbitration of bus is realized by arbitration function, and the priority of each node is that node 1 priority is high, and node 16 is minimum; Whether described arbitration function is 1 and determine whether arbitrate successfully, if 1 is arbitrated successfully by decision node current state.
Described node transmitting portion comprises without task status, waits for arbitrate state, transmission state, frame period state and state transition line; The flow process of its State Transferring is that first node is in without task status, buffer zone is entered Deng pending data, exit this state and enter wait arbitrate state, whether at this time start monitoring bus is idle condition, if it is the competition of bus is participated in, if won in bus contention, then the data collected are sent, be sent completely, come back to without task status; Sharing out the work of described frame period state and part described state transition line each task priority of completion system; Described node transmitting portion also comprises retransmission mechanism, by judging that the off period is that the number being less than 0 determines whether the data in bus are retransmitted;
Described data buffer section comprises buffer-empty and non-NULL two states, and capacity setting is 1, the loss of data old when there being new data to enter impact damper; Quantity of information is set to fixed value 100bits, the totalframes that after adopting b1 record node each run to complete, success sends in bus;
Described data unit comprises generation and framing two states of data, and wherein data are from the random function part of described realistic model female module, adopts p1 to record the number of the frame that node each run produces.
Described node submodule, bus arbitration submodule are all parallel organization.
The core design of CANopen agreement is exactly object dictionary, because define various data type and communication object in object dictionary.Object dictionary also provides interface for writing of application program; Using SinamicsS120 as from the basis of machine, CBC10 communication board is integrated with CANopen application layer protocol, and object dictionary is also being established from machine.SDO is the object playing configuration effect, and generally we make SDO carry out concrete configuration to the object in object dictionary under pre-operation state.The reading of such as unit type, to parameters such as the rewritings that PDO maps.Write agreement by SDO and rewrite image parameter, SDO reads the state value of agreement reading object; The flow process of the SDO management object of native system exploitation as shown in Figure 2.
When carrying out the read-write to communication object with SDO service, if make a mistake, SDO can send and cancel SDO protocol frame, can carry error message in this frame.This contributes to us and analyzes error source concrete in the read write command frame format of SDO.We are by read operation fetch equipment type object 1000h in a program, the frame data format of transmission and the frame data format of response as shown in the table.
Table 1 object 1000hSDO frame format
Can send to host node before being transformed into pre-operation state from init state from node in CANopen agreement and start message, notice host node has been transformed into pre-operation state from init state.By NMTboot-up frame format, we can detect the COB-ID starting message, have entered into pre-operation state by the COB-ID advising process system starting message.Here there is a problem is exactly when master-slave equipment successively starts, and can produce and can't detect startup message, so we adopt the way of SDO read apparatus current state to carry out the renewal of Host Status here in order to ensure master-slave equipment relative synchronization.After entering into pre-operation state from node, we can not carry out transmitting the data object PDO of real-time in this condition, for this reason our transmitting-receiving of needing that node is entered into mode of operation just can carrying out normal PDO object data.Mode of operation will be forwarded from machine to by pre-operation state by NMT State Transferring agreement.
The process flow diagram of PDO transmission and reception as shown in Figure 3, after system enters into operator scheme, the main object now carrying out communicating is exactly PDO.In S120 system, we mainly use PDO object to carry out the control to motor.The subobject such as transmission mode, disable time, event timer of use can be found by subindex in PDO object.Here we use RPDO2 and TPDO2, TPDO4 object.By analysis above, we know in RPDO2 and have mapped control word and speed setting value, TPDO2 and TPDO4 have mapped values for actual speed and actual positional value.After the mode of operation of State Transferring, we just can send RPDO starter motor, and give the speed that motor specifies.Motor will be controlled run according to the speed of setting after S120 successfully introduces RPDO2 object.And by parameter TPDO2 and TPDO4, current status word and actual velocity amplitude and positional value are sent to main frame side, host computer side retains by receiving buffer register the data that receive, and then hexadecimal numerical value is become by the parsing of message the metric numerical value that we intuitively can understand.Reception described herein and transmission are all references object with slave computer, receive so RPDO and TPDO is slave computer S120 and sends PDO object.The management of RPDO is here easy to comparatively speaking, just according to the frame format sent, the speed assembling of control word and setting is sent to S120.When setting speed, S120 system needs to calculate according to formula below:
n _ s e t _ b u s = n _ s e t [ R P M ] * 1 60 s * p 408 * 2 p 418 * p 8798 [ 1 ] p 8798 [ 0 ]
In above formula, p8798 is CBC velocity conversion factor, and p408 is umber of pulse, and p418 is resolution parameter.In order to analytic message, above-mentioned formula also will be done inverse transformation and obtain n_set [RPM] parameter value by us.
Reception for TPDO adopts Asynchronous Reception mode.In asynchronous communication process, we can arrange the disable time that TPDO transmits, and we are more prone to the message management of TPDO.Here we can be undertaken downloading to CF card after off-line sets disable time preservation compiling by Starter software,
Also can be carried out the configuration of parameter under pre-operation state by the communication mode writing SDO.
The competition mechanism of CAN develops from CSMA/CA Communication Model basis.Its limitation is the time delay that the load of network directly affects message in bus.In bus, load is less, the transmission delay of message is very little or negligible.But along with the increase of load, the message queue of competition bus increases, and the handling capacity of network and utilization factor increase.Like this when the handling capacity of network is less than gathering way of load, node in the bus that finally can make is in the state of blocking, can cause having the transmission of low priority message lose for a long time or even through one section when the message of high priority first obtains the chance of arbitration.The final like this real-time degradation causing CAN.
For application layer protocol CANopen, the management of its primary responsibility NMT, SYNC, SDO, PDO communication object.Because the task that it has needed is a lot, so need higher real-time Communication for Power ability.The ability of the different competition bus of the priority due to each object also can be different.But we know that NMT, SDO etc. can operate under other state, and the object really needing real-time to operate just only has PDO, be therefore the highest to the requirement of real-time of this object.For CANopen network, the node that system needs is many, and each node needs the data volume of transmission larger, and then makes the offered load in CAN higher.Make the ability of the PDO competition bus of the low priority had weak like this, the message transmissions time delay of generation can be larger.
Real-time dispatching algorithm is mainly in order to the Real-Time Scheduling of completion system resource within the time of constraint.Two classes are mainly divided into: the priority scheduling algorithm of static (solid-state) and dynamic priority scheduling algorithm about to the research of real-time scheduling.About the dispatching algorithm of static state refer to the priority of task by keep immobilizing after definition, we also claim it to be fixing priority scheduling algorithm sometimes.Dynamic priority scheduling, refers to that the priority of the priority of task in implementation other task relative is change.In order to fully analyze the real-time of CAN, below detailed describing two kinds of dispatching algorithms and be incorporated in CAN.
Fixed Priority Schedule Algorithm is often used [29] in CAN system design process, mainly carries out real-time scheduling for periodic duty.In the bus system with Fixed Priority Schedule Algorithm, the priority of the task of system is fixing, and the priority of each task was determined before system cloud gray model, and remained unchanged in system operation.In Fixed Priority Schedule Algorithm, ratio dullness (RM) algorithm [30] has a wide range of applications.
RM algorithm is mainly applied in the scheduling of periodic duty, and this algorithm is simple, and it is convenient to realize, in the task scheduling of real-time system, create very large effect.The priority of RM dispatching algorithm task is decided by duty cycle.The priority level of RM algorithm assigns task is readily appreciated that, the cycle of task is shorter, and the priority level of the task of reflection is then higher, otherwise, then lower.If the relation of the duty cycle of system is expressed as T 1<=T 2<=... <=T n, so can determine that the priority arrangement of task is P by this dispatching algorithm 1>=P 2>=... >=P n.This dispatching algorithm requires that the task of system always should complete this cycle current before next cycle arrives, otherwise task will be made to miss the time limit, has comparatively short period task and should try one's best first to dispatch and first complete, in order to avoid miss deadline of task.
In real-time RM dispatching algorithm, each scheduler task is by 3 tuples, often organizes and is all made up of cycle, execution time, cut-off time limit, can symbolically be: S=(T, C, D).The essence of RM real-time scheduling is: be scheduled task-set S=(S 1, S 2..., S n), the cycle is respectively T 1, T 2..., T n, the execution time is C 1, C 2..., C n, during cut-off, be limited to D 1, D 2..., D n.
EDF is as very important scheduling theory a kind of in dynamic dispatching algorithm, and it is the dispatching algorithm of periodic duty group the best.EDF [33] [34] carry out the priority of allocating task according to the length of task range cutoff phase, and range cutoff phase nearer task priority is higher, and the priority of task is then lower on the contrary.In EDF dispatching algorithm, task priority is distributed formula and is defined as follows:
d i(t)-t
D in above-mentioned formula it () represents the task deadline of t, formula determines the task that subsequent time should be dispatched thus.
Such as, assuming that have 3 scheduler task group: T1=(1,3,3,0), T2=(Isosorbide-5-Nitrae, 4,0), T3=(1,5,5,0) in real-time system.Three tasks all discharge in the t=0 moment, and by priority assign formulae discovery, show that the time limit of T1 is nearest, the priority of task is the highest, now system call T1 task.In the t=1 moment, the current T2 of only having and T3 is in and waits to dispatch state of activation, and by calculating the priority of these two tasks, show that T2 priority is higher than T3, therefore T2 task is scheduled execution.When t=3, task T1 is released, current be in wait for scheduling state of activation be T1 and T3, by calculating priority level, show that T3 priority is scheduled higher than T1, T3 task, scheduling so repeatedly.Known by analysis above, EDF dispatching algorithm will calculate the task priority being in and waiting for dispatch state in each moment, workload is larger, the system next moment task of scheduling is uncertain, with in system other etc. task to be scheduled have relation, this method, makes system flexibility relatively good.
Communication mode for CAN belongs to event-driven mechanism, when there being communication message to transmit in system, can there is the change of state in the state of communication node and bus, so it is suitable that the communication simulation of CAN adopts based on FSM theory because of the appearance of message and the event such as reception or transmission.
CAN realistic model is as shown in Figure 4, theoretical based on FSM, uses Stateflow tool box effectively can carry out system modeling and simulation to CAN traffic model.In order to clearly analyze bus system real time under heavy load, we use Sateflow tool box to establish the realistic model of following system.Recognized by SinamicsS120 system equipment, if define the number of PDO by predefine, so under control module CU320-2DP controls, a set of S120 equipment can be with six axis servomotors, namely bus has 6 nodes, altogether employs 18 PDO objects in system.Because these PDO objects are not necessarily simultaneously in total Above-the-line, only get 16 PDO objects analyze to analyze us, and suppose 16 PDO all campaigns compete bus such a case in bus.Conveniently, we only establish the bus model of part here, so can reach our requirement.Because we know that the transmission for PDO becomes the master data frame format of CAN then to send data assembling, the communication media of actual message still in CAN transmits, and the different so priority of the identifier of PDO is different, and we can emulate a PDO as independent node in simulations, said node all represents a PDO below.So we only establish the real-time that the simplest model in operational conditions carrys out analyzing communication.Because CAN adopts how main working method, each node is equal, regardless of primary and secondary, so each node active at any time other nodes on network send information.Here by the data that randomizer representative sends.In this female module as shown in Figure 4, mainly provide time reference and input/output variable.Contain 16 node submodules under Stateflow environment and bus arbitration submodule in this module in addition, under female module, all submodules are all parallel organizations.
Bus have three kinds of states: idle, busy and space.When bus not having Signal transmissions, bus is in idle condition (idle) state.During the signal sent when bus there being node, through arbitrating the arbitration of function, after arbitration terminates, bus starts the information of transmission node, and bus is in the state of busy (busy).After nodal information transmission completes, bus is getting back to idle condition again after frame period (space) state.In simulation process, the arbitration of bus is realized by arbitration function, and as shown in Figure 5, and the priority of each node is that node 1 priority is high, and node 16 is minimum.
Three parts are contained: node transmitting portion (Send), data buffer section (Buffer), data unit (Period_data_put) in nodal analysis method.
The transmitting portion of node contains without task status (sleep), waits for arbitration (wait), transmission (transmission) three states.The flow process of its State Transferring is that first node is in sleep state, buffer zone is entered Deng pending data, exit this state and enter wait state, whether at this time start monitoring bus is idle state if so just participate in the competition of bus, if won in bus contention, so with regard to starting, the data collected being sent, being sent completely, coming back to sleep state.
Data buffer section contains buffer-empty (null) and non-NULL (nonnull) two states.Capacity setting is 1, if old data will be lost when therefore having new data to enter impact damper.Conveniently emulate in addition and compare, quantity of information is set to fixed value 100bits.Here we record with b1 the totalframes that after node each run completes, success sends in bus.
Data unit contains generation (nodata) and framing (datain) two states of data.Data, from the random function part of female module, simulate a kind of dynamic image data.Here we record the number of the frame that node each run produces with p1.
Because the priority that EDF dispatching algorithm distributes to each task is dynamic, the change along with the time changes.So the realistic model set up based on EDF algorithm is compared complicated many with the CAN model based on fixed priority algorithm.In EDF dispatching algorithm, be the calculating of task priority with the maximum difference of fixed priority algorithm, the priority of each task is defined as d i(t)-t.And EDF arthmetic statement can be described as in non-preemptive network C AN:
(1) priority of CAN message task immobilizes, and becomes in time;
(2) priority of CAN message task is distributed by off period length.
On basis based on fixed priority algorithm realistic model, the Bus simulator model adopting EDF algorithm to set up under Stateflow simulated environment as shown in Figure 7.
Because data unit is identical with the nodal analysis method of fixed priority with the model of data unit in EDF dispatching algorithm CAN realistic model, so here we only give part of nodes model.The principle of work of CAN realistic model is substantially the same with Fixed Priority Schedule Algorithm realistic model principle, just in the figure 7, we by adding frame period (prior) state and partial status Migration Line carrys out sharing out the work of each task priority of completion system in transmitting portion.And add in sending module, retransmission mechanism, by judging that the off period is the whether repeating transmission that the number being less than 0 determines total Thread Message.The bus model of CAN have also been made corresponding change, and whether arbitration only needs decision node current state to be 1 and determine whether arbitrate successfully.
The present invention is when based on the increase that can bring bus network load many to message frame number CAN with multiple node and transmission, the time delay of system message can be caused, in order to ensure the real-time Transmission of total Thread Message, introduce two kinds of dispatching algorithms and carry out emulation experiment, by the analysis to simulation result, compare the excellence of two kinds of methods.In design and simulation process, we design 125Kbit/s baud rate and are inputted by female level module, and 2s working time that system is total conveniently analyzes, and the data length that we design every frame message is 100bit.The relation that each node of design system sends cycle and bus load is as shown in table 2.
The each node of table 2 sends the relation table of cycle and load
Load Node1 Node2 Node3 Node4 Node5 Node6 Node7 Node8
19.2% 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
50.4% 0.1 0.1 0.05 0.05 0.025 0.025 0.05 0.05
80% 0.05 0.05 0.025 0.025 0.025 0.025 0.02 0.02
103.2% 0.025 0.025 0.025 0.025 0.025 0.025 0.02 0.02
Load Node9 Node10 Node11 Node12 Node13 Node14 Node15 Node16
19.2% 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05
50.4% 0.05 0.02 0.025 0.025 0.02 0.02 0.01 0.01
80% 0.01 0.02 0.02 0.01 0.01 0.01 0.01 0.01
103.2% 0.01 0.02 0.01 0.01 0.01 0.01 0.005 0.005
Conveniently analyze and statistics, the real-time that we choose node 1, node 4, node 7, node 10, node 13, node 16 analyze bus communication under different loads.Have realistic model above known, p1 ~ p16 represents the number of the message frame that 16 nodes send at every turn, and b1 ~ b16 represents the number successfully receiving message frame.It can thus be appreciated that the success ratio that message sends can be calculated by following formula:
S i=b i/p i
Relation according to table 2 is set up system communication and is obtained the simulation result of system when load is 19.2%, 50.4%, 80%, 103.2%, as shown in following table 3,4.
Table 3 fixed priority algorithm the simulation experiment result
In order to analysis design mothod result more clearly, the experimental data of acquisition is depicted as figure by us, as shown in Figure 8,9, analyze from data and Fig. 8,9, in Fixed Priority Schedule Algorithm, no matter the information of high priority is the real-time Transmission that can ensure to communicate under low load or high load condition.But along with the increasing of offered load, the real-time of the information communication of low priority declines, and as seen from Figure 8, along with the increasing of bus load, from node 7, bus starts to occur loss of data.Significantly gliding appears in node 13 and 16 communication performance especially finally.Compare with Fixed Priority Schedule Algorithm, under the low loading condition of bus network, the normal transmission of message can be ensured.But along with the increase of offered load, scheduling performance also there will be downward trend.From node 10, we can find that the downtrending sending success ratio slows down.In order to clearer contrast, the simulation result of two kinds of dispatching algorithm gained of node 10,13,16 is put together comparative analysis by we, as shown in Figure 10.Known through comparative analysis, although there will be the decline of scheduling performance in the increasing along with load, EDF dispatching algorithm is better than the scheduling performance of fixed priority algorithm at scheduling performance.
Through experimental verification, two kinds of dispatching algorithms, when offered load is lower, well can ensure the real-time performance that message packet transmits.But when load strengthens, dynamic priority scheduling algorithm EDF is stronger than fixing priority scheduling algorithm schedulable performance.Especially exist, in the network transmission process of multinode and many messages and heavy load, Fixed Priority Schedule Algorithm, there will be the competition of low priority message causes data loss less than bus, produces disadvantageous consequence to system.Can effectively improve this situation by introducing dynamic priority scheduling algorithm, improving the communication capacity of system, reduce total inorganic nitrogen, system real time can improve.In kinetic control system, the speed that we require data to transmit is very fast, and requires to ensure transmission reliably.In order to keep this requirement, dynamic priority scheduling algorithm EDF is for we providing a kind of solution very well.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (9)

1. based on a kinetic control system for CAN, it is characterized in that: comprise control module, rectification unit, inversion unit, actuating motor, industrial computer, CAN card, physical layer block, Data Link Layer Module, application layer module and hardware interface module; Described physical layer block comprises CAN physical mediums of communication and CAN transceiver, and described CAN physical mediums of communication is used for settling signal transmission, and described CAN transceiver provides differential transmission to bus and receiving function; Described Data Link Layer Module comprises CAN core controller, described CAN core controller comprises sending module, receiver module, arbitration modules and acceptance filtenng module, described sending module is used for information frame to mail to Physical layer, described receiver module is used for from Physical layer obtaining information frame, described arbitration modules is used for arbitrating with the information frame received of sending out, described acceptance filtenng module, from data link layer received frame information, filters the data of this node needs by checking and accepting mask off code and examination code; Described application layer module comprises Simulation Center computing machine, and for analog node device emulation model, application layer protocol adopts CANopen agreement; Described hardware interface module is used for the communication between hardware and Physical layer.
2. a kind of kinetic control system based on CAN according to claim 1, is characterized in that: described control module adopts CU320-2DP control module; Described rectification unit adopts intelligent electric source module, and three-phase alternating current is rectified into direct current by described intelligent electric source module, and direct current is fed back to electrical network, and described intelligent electric source module keeps communicating by Drive-CLiQ with described control module; By Drive-CLiQ interface between described inversion unit and control module, carry out fast data exchange; The scrambler of described inversion unit is connected by Drive-CLiQ cable, by the feedback signal back of scrambler to control module; Described industrial computer comprises main frame, display, mouse and keyboard; Described CAN card adopts XJA1000CAN controller as main control chip.
3. a kind of kinetic control system based on CAN according to claim 1, it is characterized in that: described sending module comprises framing module, signal transmitting module and transmit control device, transmit control device is connected with framing module and signal transmitting module by bus; When receiving corresponding signal, framing module is by complete information frames convey to signal transmitting module, and current data position is sent to CAN by signal transmitting module.
4. a kind of kinetic control system based on CAN according to claim 1, is characterized in that: described application layer module also comprises simulation actuating equipment.
5. a kind of kinetic control system based on CAN according to claim 1, is characterized in that: described application layer module adopts C language as developing instrument, is built by compiling under BorlandC++2.0 translation and compiling environment.
6. set up a method for CAN realistic model based on EDF dynamic priority scheduling algorithm, it is characterized in that: first using state, migration and condition set up the nodal analysis method relating to communication activity part under Stateflow environment; Described nodal analysis method comprises node transmitting portion, data buffer section and data unit; By 16 node submodules under time reference, input/output variable, Stateflow environment and bus arbitration submodule composition realistic model female module.
7. a kind of method setting up CAN realistic model based on EDF dynamic priority scheduling algorithm according to claim 6, it is characterized in that: described bus arbitration submodule, in communication process, has idle condition, busy condition and frame period state three kinds of states; When bus does not have Signal transmissions, bus is in idle condition state; During the signal sent when there being node, through arbitrating the arbitration of function, after arbitration terminates, bus starts the information of transmission node, and bus is in busy condition; After nodal information transmission completes, bus is getting back to idle condition again after a frame period state; In simulation process, the arbitration of bus is realized by arbitration function, and the priority of each node is that node 1 priority is high, and node 16 is minimum; Whether described arbitration function is 1 and determine whether arbitrate successfully, if 1 is arbitrated successfully by decision node current state.
8. a kind of method setting up CAN realistic model based on EDF dynamic priority scheduling algorithm according to claim 7, is characterized in that: described node transmitting portion comprises without task status, waits for arbitrate state, transmission state, frame period state and state transition line; The flow process of its State Transferring is that first node is in without task status, buffer zone is entered Deng pending data, exit this state and enter wait arbitrate state, whether at this time start monitoring bus is idle condition, if it is the competition of bus is participated in, if won in bus contention, then the data collected are sent, be sent completely, come back to without task status; Sharing out the work of described frame period state and part described state transition line each task priority of completion system; Described node transmitting portion also comprises retransmission mechanism, by judging that the off period is that the number being less than 0 determines whether the data in bus are retransmitted;
Described data buffer section comprises buffer-empty and non-NULL two states, and capacity setting is 1, the loss of data old when there being new data to enter impact damper; Quantity of information is set to fixed value 100bits, the totalframes that after adopting b1 record node each run to complete, success sends in bus;
Described data unit comprises generation and framing two states of data, and wherein data are from the random function part of described realistic model female module, adopts p1 to record the number of the frame that node each run produces.
9. a kind of method setting up CAN realistic model based on EDF dynamic priority scheduling algorithm according to claim 8, is characterized in that: described node submodule, bus arbitration submodule are all parallel organization.
CN201510731859.4A 2015-10-30 2015-10-30 Establishment of motion control system based on CAN and simulation modeling method Pending CN105487403A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510731859.4A CN105487403A (en) 2015-10-30 2015-10-30 Establishment of motion control system based on CAN and simulation modeling method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510731859.4A CN105487403A (en) 2015-10-30 2015-10-30 Establishment of motion control system based on CAN and simulation modeling method

Publications (1)

Publication Number Publication Date
CN105487403A true CN105487403A (en) 2016-04-13

Family

ID=55674451

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510731859.4A Pending CN105487403A (en) 2015-10-30 2015-10-30 Establishment of motion control system based on CAN and simulation modeling method

Country Status (1)

Country Link
CN (1) CN105487403A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110798390A (en) * 2019-11-13 2020-02-14 无锡欧特海洋科技有限公司 Communication system and communication method for power supply and distribution system of submarine observation network
CN112527708A (en) * 2020-12-07 2021-03-19 上海智能制造功能平台有限公司 Device and method for realizing universal servo drive bus interface
CN112702411A (en) * 2020-12-21 2021-04-23 上汽大通汽车有限公司 Method for solving CANTP multi-frame packet loss retransmission
CN115314338A (en) * 2022-07-27 2022-11-08 湖南航天机电设备与特种材料研究所 Real-time motion control method and system
CN116886350A (en) * 2023-06-30 2023-10-13 中汽院新能源科技有限公司 New energy automobile control working method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101626333A (en) * 2009-08-07 2010-01-13 北京和利时电机技术有限公司 Controller area network (CAN) bus system and application layer communication method in same
CN102833141A (en) * 2012-08-23 2012-12-19 天津瑞能电气有限公司 CAN (control area network) open slave station system based on DSP (digital signal processor) 28335
CN103997450A (en) * 2014-05-28 2014-08-20 天津瑞能电气有限公司 Implementation method of CANopen master station based on DSP 28335

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101626333A (en) * 2009-08-07 2010-01-13 北京和利时电机技术有限公司 Controller area network (CAN) bus system and application layer communication method in same
CN102833141A (en) * 2012-08-23 2012-12-19 天津瑞能电气有限公司 CAN (control area network) open slave station system based on DSP (digital signal processor) 28335
CN103997450A (en) * 2014-05-28 2014-08-20 天津瑞能电气有限公司 Implementation method of CANopen master station based on DSP 28335

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《中国优秀硕士学位论文全文数据库》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110798390A (en) * 2019-11-13 2020-02-14 无锡欧特海洋科技有限公司 Communication system and communication method for power supply and distribution system of submarine observation network
CN110798390B (en) * 2019-11-13 2023-11-07 深圳欧特海洋科技有限公司 Communication system and communication method for power supply and distribution system of submarine observation network
CN112527708A (en) * 2020-12-07 2021-03-19 上海智能制造功能平台有限公司 Device and method for realizing universal servo drive bus interface
CN112527708B (en) * 2020-12-07 2023-03-31 上海智能制造功能平台有限公司 Device and method for realizing universal servo drive bus interface
CN112702411A (en) * 2020-12-21 2021-04-23 上汽大通汽车有限公司 Method for solving CANTP multi-frame packet loss retransmission
CN115314338A (en) * 2022-07-27 2022-11-08 湖南航天机电设备与特种材料研究所 Real-time motion control method and system
CN115314338B (en) * 2022-07-27 2024-03-12 湖南航天机电设备与特种材料研究所 Real-time motion control method and system
CN116886350A (en) * 2023-06-30 2023-10-13 中汽院新能源科技有限公司 New energy automobile control working method
CN116886350B (en) * 2023-06-30 2024-04-23 中汽院新能源科技有限公司 New energy automobile control working method

Similar Documents

Publication Publication Date Title
CN105487403A (en) Establishment of motion control system based on CAN and simulation modeling method
CN106814657B (en) Embedded real-time EtherCAT main website construction method based on ARM
CN110519138B (en) Profibus-DP master station protocol implementation method and system
CN103713940B (en) Method for reconfigurable distributed real-time simulation based on RTX-HLA reflection storage card
CN101178666A (en) Coordinating and scheduling method between heterogeneous multi-core
CN101630343B (en) Simulation method and simulation system
Theiss et al. Software agents in industry: A customized framework in theory and praxis
CN105677605A (en) Highly-efficient interconnected system capable of configuring chips and realization system thereof and device
CN115827168B (en) Optimization method for virtual machine communication in binary simulation environment
CN110399221A (en) Data processing method, system and terminal device
CN110177146A (en) A kind of non-obstruction Restful communication means, device and equipment based on asynchronous event driven
CN103677983A (en) Scheduling method and device of application
CN204733178U (en) A kind of EtherCAT master station device based on FPGA
CN105843995A (en) Model-driven based IMA system time resource configuration verification method
CN117032812B (en) Management method, device and apparatus of server, storage medium and electronic device
CN109426643A (en) USB interface request scheduling method, device and equipment
CN105592492A (en) Platform and method for testing high-layer protocol stack consistency
CN110430110B (en) On-site bus gateway and protocol conversion method thereof
CN103149909A (en) Field programmable gate array (FPGA)-based controller area network (CAN) simulation node system
CN109361653B (en) POWERLINK main station
US9866501B2 (en) Virtual switch enabling communication between external objects and simulation objects
CN108055186B (en) Master-slave processor communication method and device
CN114780143A (en) CAN controller excitation sequence generation method and device based on UVM and verification platform
Yan et al. Mixed time-triggered and event-triggered industrial controller in IoT environment
CN110098991B (en) Equipment for accessing EtherCAT bus system to universal Internet of things cloud platform

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160413

WD01 Invention patent application deemed withdrawn after publication