CN104102479B - A kind of automatic generation method of OBD variable-definitions source file - Google Patents

A kind of automatic generation method of OBD variable-definitions source file Download PDF

Info

Publication number
CN104102479B
CN104102479B CN201310123857.8A CN201310123857A CN104102479B CN 104102479 B CN104102479 B CN 104102479B CN 201310123857 A CN201310123857 A CN 201310123857A CN 104102479 B CN104102479 B CN 104102479B
Authority
CN
China
Prior art keywords
obd
variable
source files
variables
array
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.)
Expired - Fee Related
Application number
CN201310123857.8A
Other languages
Chinese (zh)
Other versions
CN104102479A (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.)
Beijing Treasure Car Co Ltd
Original Assignee
Beiqi Foton Motor 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 Beiqi Foton Motor Co Ltd filed Critical Beiqi Foton Motor Co Ltd
Priority to CN201310123857.8A priority Critical patent/CN104102479B/en
Publication of CN104102479A publication Critical patent/CN104102479A/en
Application granted granted Critical
Publication of CN104102479B publication Critical patent/CN104102479B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention proposes a kind of automatic generation method of OBD variable-definitions source file, comprises the following steps:Multiple OBD variables are obtained, wherein, each OBD variables include name variable and multiple attribute fields;Multiple OBD variables are write in default file;Default file is parsed, with respectively according to the title of each OBD variables, at least a portion attribute field and multiple initial multigroup design variables of OBD variable-definitions file generated, and corresponding multiple arrays are generated according to multigroup design variables;Respectively the content in multiple arrays is write in corresponding initial OBD variable-definitions file to generate multiple OBD variable-definitions source files.Embodiments of the invention can be automatically generated the related source code of OBD module contents by software, save human cost, shortened the construction cycle, development efficiency is improved, while decreasing error rate.In addition, the embodiment of the present invention also has the advantages that portable high, universality is high.

Description

A kind of automatic generation method of OBD variable-definitions source file
Technical field
The present invention relates to field of automobile, more particularly to a kind of side of automatically generating of OBD variable-definitions source file Method.
Background technology
Now, the application of automobile electronic controller in the car is more and more extensive, it has also become influence the important of automotive performance Composition.Construction cycle of automobile electronic controller program and quality as automobile research cycle and a ring of quality, increasingly by To the concern of automotive development business.
OBD(On Board Diagnostic, automatic vehicle diagnosis system), it is a weight in electronic controller program Want part.At the beginning of OBD this concept is introduced, its monitoring function also only only to exhaust system, but over time with section The development of skill, OBD become as one integrate detection, maintenance and management multifunction module, importance is self-evident.
In automobile making, OBD block codes can be in multiple source code files by the numerous related changes of different classes of definition Measure, and variable and its definition can be used in different source program codes, and many can be involved by changing one of variable The change of source file, pulls one hair and move the whole body, and uses manual compiling mostly about the source file of OBD module variable-definitions at present And the mode of modification, the change of a variable-definition, it would be desirable to many related source file relevant portions are changed one by one, no Only waste time and energy, and be very easy to error, have influence on the development cost and quality of whole product.
The content of the invention
It is contemplated that at least solving one of above-mentioned technical problem.
Therefore, it is an object of the invention to propose that one kind can save human cost, shortening the construction cycle, exploitation effect is improved Rate and accuracy rate, and there is the automatic generation method for the OBD variable-definition source files that transplantability is high, universality is high.
To achieve these goals, embodiments of the invention propose a kind of OBD variable-definitions source file side of automatically generating Method, comprises the following steps:Multiple OBD variables are obtained, wherein, the OBD variables include name variable and multiple attribute fields;Will In the multiple OBD variables default file;The default file is parsed, with respectively according to the title of each OBD variables, At least a portion attribute field and multiple initial multigroup design variables of OBD variable-definitions file generated, and according to described multigroup Design variables generate corresponding multiple arrays;And respectively by the corresponding initial OBD changes of the content write-in in the multiple array Amount defines in file to generate multiple OBD variable-definitions source files.
The automatic generation method of OBD variable-definition source files according to embodiments of the present invention, can be automatically generated by software The related source code file of OBD module contents, saves human cost, shortens the construction cycle, improves development efficiency, while Error rate is reduced, development quality is improved.In addition, the embodiment of the present invention is applied to different development platforms, it can somewhat be repaiied Migrate to and used in different development platforms after changing, therefore also have the advantages that portable high, universality is high.
In addition, the automatic generation method of OBD variable-definitions source file according to the above embodiment of the present invention can also have The technical characteristic added as follows:
In an embodiment of the present invention, the multiple initial OBD variable-definitions file includes:Obd_const.h source files, Obd_data.h source files, obd_table.h source files, obd_externals.h source files, obd_config.h source files and Obd.a2l source files.
In an embodiment of the present invention, the generation of the obd_externals.h source files, further comprises:Obtain institute State the name variable of the OBD variables in default file;External related contents are generated according to the name variable and the is write In one array;The obd_externals.h source files are generated according to first array.
In an embodiment of the present invention, the generation of the obd_const.h source files, further comprises:Obtain described pre- If the preset attribute field groups of the OBD variables in file;The name variable and other field combination of two are generated respectively new Name variable;Assignment is carried out according to the corresponding attribute of preset attribute field and write in the second array;According to the described second number The group generation obd_const.h source files.
In an embodiment of the present invention, the generation of the obd_table.h source files, further comprises:Obtain described pre- If the name variable of the OBD variables in file;Table related contents are generated according to the name variable and the 3rd number is write In group;The obd_table.h source files are generated according to the 3rd array.
In an embodiment of the present invention, the generation of the obd_data.h source files, further comprises:Obtain described default The name variable of OBD variables in file;Data related contents are generated according to the name variable and the 4th array is write In;The obd_data.h source files are generated according to the 4th array.
In an embodiment of the present invention, the generation of the obd_config.h source files, further comprises:Obtain described pre- If the name variable of the OBD variables in file;Config related contents are generated according to name variable and write in the 5th array;Root The obd_config.h source files are generated according to the 5th array.
In an embodiment of the present invention, the generation of the obd.a2l source files, further comprises:Obtain the default text The name variable of OBD variables in part;A2l related contents are generated according to name variable and write in the 6th array;According to described 6th array generates the obd.a2l source files.
In an embodiment of the present invention, in addition to:If reading the end identifier in the default file, stop Only.
The additional aspect and advantage of the present invention will be set forth in part in the description, and will partly become from the following description Obtain substantially, or recognized by the practice of the present invention.
Brief description of the drawings
The above-mentioned and/or additional aspect and advantage of the present invention will become from description of the accompanying drawings below to embodiment is combined Substantially and be readily appreciated that, wherein:
Fig. 1 is the flow chart of the automatic generation method of the OBD variable-definition source files according to the embodiment of the present invention;
Fig. 2 is the overall work of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention Schematic diagram;
Fig. 3 is the overall procedure of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention Figure;
Fig. 4 is the sort_io_ of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention The workflow diagram of spec functions;
Fig. 5 a to Fig. 5 b are the life of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention Into obd_const.h source files and the flow chart of obd_externals.h source files;
Fig. 6 is the generation obd_ of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention The flow chart of table.h source files;
Fig. 7 is the generation obd_ of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention The flow chart of data.h source files;
Fig. 8 is the generation obd_ of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention The flow chart of config.h source files;With
Fig. 9 is the generation of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention The flow chart of obd.a2l source files.
Embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached The embodiment of figure description is exemplary, is only used for explaining the present invention, and is not considered as limiting the invention.
In the description of the invention, it is to be understood that term " " center ", " longitudinal direction ", " transverse direction ", " on ", " under ", The orientation or position relationship of the instruction such as "front", "rear", "left", "right", " vertical ", " level ", " top ", " bottom ", " interior ", " outer " are Based on orientation shown in the drawings or position relationship, it is for only for ease of the description present invention and simplifies description, rather than indicate or dark Specific orientation must be had, with specific azimuth configuration and operation by showing the device or element of meaning, therefore it is not intended that right The limitation of the present invention.In addition, term " first ", " second " are only used for describing purpose, and it is not intended that indicating or implying and be relative Importance.
In the description of the invention, it is necessary to illustrate, unless otherwise clearly defined and limited, term " installation ", " phase Even ", " connection " should be interpreted broadly, for example, it may be being fixedly connected or being detachably connected, or be integrally connected;Can To be mechanical connection or electrical connection;Can be joined directly together, can also be indirectly connected to by intermediary, Ke Yishi The connection of two element internals.For the ordinary skill in the art, with concrete condition above-mentioned term can be understood at this Concrete meaning in invention.
The automatic generation method of OBD variable-definition source files according to embodiments of the present invention is described below in conjunction with accompanying drawing.
As shown in figure 1, the automatic generation method of OBD variable-definition source files according to embodiments of the present invention, including it is following Step:
Step S101, obtains multiple OBD variables, wherein, each OBD variables include name variable and multiple attribute fields.
Step S102, multiple OBD variables are write in default file.Wherein, default file is one pre-set Csv files.In one embodiment of the invention, the content format of default file is for example shown in table 1:
Table 1
The OBD variables of default file include name variable and multiple attribute fields are as shown in table 2:
Content Sequence number Content Sequence number
Column_ID 0 Column_FF_Priority 10
Column_Fault_Name 1 Column_MIL1_Behaviour 11
Column_AFL_Threshold 2 Column_MIL2_Behaviour 12
Column_AFL_Increment 3 Column_MIL3_Behaviour 13
Column_AFL_Decrement 4 Column_MIL4_Behaviour 14
Column_DCC_Threshold 5 Column_Display_On_Tester 15
Column_DCC_Increment 6 Column_Freeze_Frame 16
Column_DCC_Decrement 7 Column_Latch_Fault 17
Column_AFF_Limit 8 Column_ExpectedMask 18
Column_DTC_Number 9 Column_EOBD_Fault 19
Table 2
Wherein, with reference to Tables 1 and 2, wherein, for example:1 in table 1 represents the OBD variables that ID is 1, A_SENS_SUPPLY_ FAULT represents entitled A_SENS_SUPPLY_FAULT of the variable etc..
Step S103, is parsed to default file, to be belonged to respectively according to the title of each OBD variables, at least a portion Property field and multiple initial multigroup design variables of OBD variable-definitions file generated, and generate correspondence according to multigroup design variables Multiple arrays.Specifically, the operation such as it can be ranked up, check, extract and change to default file to realize to default file Parsing, so as to obtain the title of each OBD variables, at least a portion attribute field and multiple initial OBD variable-definitions text Part.
Step S104, the content in multiple arrays respectively write in corresponding initial OBD variable-definitions file to generate Multiple OBD variable-definitions source files.Wherein, multiple initial OBD variable-definitions source files include:Obd_const.h source files, Obd_data.h source files, obd_table.h source files, obd_externals.h source files, obd_config.h source files and Obd.a2l source files.
Specifically, in step S104, the generation of obd_externals.h source files further comprises:Obtain first pre- If the name variable of the OBD variables in file, and external related contents the first array of write-in is generated according to name variable (Obd_externals arrays)In, generate obd_externals.h source files further according to the first array.Wherein, external phases Hold inside the Pass for example, shown in table 3:
extern const uint8_t A_SENS_SUPPLY_FAULT_afl_threshold;
Table 3
The generation of obd_const.h source files further comprises:The default category of the OBD variables in default file is obtained first Property field groups, for example:Fault_Name fields, EOBD_Fault fields, MIL1 to MIL4 fields, freeze_Frame fields and Latch_Fault fields etc., respectively by name variable(Fault_Name fields)New change is generated with other field combination of two Title is measured, assignment is carried out according to the corresponding property value of preset attribute field and the second array is write(Obd_const arrays)In, and Obd_const.h source files are generated according to second array.Const related contents are as shown in table 4 below:
Table 4
In table 4, const uint8_t represent the form of variable, such as A_SENS_SUPPLY_FAULT_afl_ threshold、A_SENS_SUPPLY_FAULT_afl_increment、A_SENS_SUPPLY_FAULT_warning_mask Represent the title and its attribute field of variable with A_SENS_SUPPLY_FAULT_eobd_fault etc., 50u, 10u, 1u and FALSE etc. represents the content of the corresponding attribute field of variable.For example, the first row of table 4 represents that name variable is A_SENS_ SUPPLY_FAULT_, attribute field is afl_threshold, and the corresponding content of attribute field is 50u.
The generation of obd_table.h source files further comprises:The Fault_ of OBD variables in default file is obtained first Name field, and table related contents the 3rd array of write-in is generated according to name variable(Obd_table arrays)In, last root Obd_table.h source files are generated according to the 3rd array.In one embodiment of the invention, table related contents such as table 5 below institute Show:
Table 5
The generation of obd_data.h source files further comprises:Obtain the Fault_Name of the OBD variables in default file Field, and data related contents the 4th array of write-in is generated according to name variable(Obd_data arrays)In, according to the 4th array Generate obd_data.h source files.Wherein, data related contents are as shown in table 6 below:
Table 6
The generation of obd_config.h source files further comprises:First according to OBD variables in acquisition default file Fault_Name fields, and config related contents the 5th array of write-in is generated according to name variable(Obd_config arrays) In, obd_config.h source files are generated according to the 5th array.
The generation of obd.a2l source files further comprises:The Fault_Name of the OBD variables in default file is obtained first Field, and a2l related contents the 6th array of write-in is generated according to name variable(Obd.a2l arrays)In, finally according to the 6th number Group generation obd.a2l source files.
Further, in above-mentioned example, when reading the end identifier in default file, then stop reading, And stop continuing to generate OBD variable-definition source files.Wherein, terminate indications to be preset by technical staff.
As specific example, ODB variable-definition source documents according to embodiments of the present invention are described in detail below in conjunction with Fig. 2-9 The automatic generation method of part.
Fig. 2 is the overall work of the automatic generation method of the OBD variable-definition source files according to one embodiment of the invention Schematic diagram.
As shown in Fig. 2 by content-defined to one related csv file of OBD variables(That is default file)In, i.e., in figure Fault_Definitions.csv files, are then automatically passed through the variable-definition in the csv files by perl pin language The a series of operations such as sequence, inspection, extraction, change, are generated in multiple source files about obd module variable-definitions, i.e. Fig. 2 Obd_const.h source files, obd_data.h source files, obd_table.h source files, obd_externals.h source files, Obd_config.h source files and obd.a2l source files.Wherein, perl script language is that one kind is especially suitable for editing and handles each The language of text is planted, instead of the work of human-edited and modification, work can be greatly simplified with the mode of perl script is performed, Efficiency and quality are improved, development cost is reduced.
Fig. 3 is the flow chart of the automatic generation method of the OBD variable-definition source files according to another embodiment of the present invention. As shown in figure 3, the automatic generation method of OBD variable-definitions source file in accordance with another embodiment of the present invention, including following step Suddenly:
Step S301, Start.I.e. workflow starts.
Step S302, sort_io_spec.The csv files defined to OBD module related contents carry out Preliminary Analysis, and Each row content parsed in file is ranked up according to Column_ID and Column_DTC_Number, and generated Temp.csv files.
Step S303, create_obd_const_data.Specifically, temp.csv files are parsed, and are therefrom extracted related Content generates tetra- arrays of OBD_CONST, OBD_DATA, OBD_TABLES and OBD_EXTERNALS.
Step S304, exports obd_const.h files.Content in the@OBD_CONST files obtained in above-mentioned steps is write Enter into obd_const.h files, to export obd_const.h files.
Step S305, exports obd_data.h files.Content in obtained@OBD_DATA files is written to obd_ In data.h files, to export obd_data.h files.
Step S306, exports obd_table.h files.Content in obtained@OBD_TABLES files is written to obd_ In table.h files, to export obd_table.h files.
Step S307, exports obd_externals.h files.Content in obtained@OBD_EXTERNALS files is write Into obd_externals.h files, to export obd_externals.h files.
Step S308, create_obd_config.Temp.csv files are parsed, and therefrom extract related content generation@ OBD_CONFIG arrays.
Step S309, exports obd_config.h files.Content is write in the@OBD_CONFIG files that above-mentioned steps are obtained Enter into obd_config.h files, to export obd_config.h files.
Step S310, create_obd_a2l.Temp.csv files are parsed, and therefrom extract related content generation@OBD_ A2L arrays.
Step S311, exports obd.a2l files.Content in obtained@OBD_A2L files is written to obd.a2l files In, to export obd.a2l files.
Step S312, End.I.e. workflow terminates, and stops generation OBD variable-definition source files.
As can be seen that this method can mainly be summarised as three steps from above-mentioned Fig. 2 overview flow chart:
The first step is reads in Fault_Definitions.csv files, to csv files progress Preliminary Analysis, and according to Column_ID and Column_DTC_Number is ranked up to each row content parsed in file, and generates temp.csv texts Part.
Second step is, by parsing temp.csv files, to generate related content according to the data provided in csv and be put into@ This six arrays of OBD_CONST, OBD_DATA, OBD_TABLES, OBD_EXTERNALS, OBD_CONFIG, OBD_A2L In.
3rd step is that this six array write-ins are corresponding five<.h>File and one<.a2l>File.
As shown in figure 4, being the automatic generation method of OBD variable-definition source files according to one embodiment of the invention The workflow diagram of sort-_io_spec functions.Wherein, there are four encapsulation functions, and its specific place in whole perl script Manage step as follows:
Step S401, Start.I.e. workflow starts.
Step S402, reads a line content from Fault_Definitions.csv files, such as not to be empty, then circulate after It is continuous.
Step S403, removes the additional character in one's own profession(Such as $, ", tab etc.).
Step S404, treated content of text is stored into@fields arrays.
Step S405, Loop.Circulate, return and perform step S402.
Step S406, is ranked up using sort function pair@fields arrays.I.e. according to Column_ID and Column_ DTC_Number is ranked up to@fields arrays.
Step S407, the content in array@fields is output in temp.csv files.
Step S408, End.I.e. workflow terminates.
It is automatically generating according to the OBD variable-definition source files of one embodiment of the invention as shown in Fig. 5 a to Fig. 5 b The flow chart of the generation obd_const.h source files and obd_externals.h source files of method.Comprise the following steps:
Step S501, Start.I.e. workflow starts.
Step S502, reads a line content from csv files, is not space-time when reading in content, circulation continues.
Step S503, removes the space in this journey, and is separated this journey content for delimiter with ", ", and is deposited into@ In fields arrays.
Step S504, obtains the field on name in@fields arrays, and generate the macrodefinition deposit@OBD_ of correlation In EXTERNALS arrays.
Step S505, obtains the field on name in@fields arrays, and generate the macrodefinition deposit@OBD_ of correlation In CONST arrays.
Step S506, $ fields [$ Column_EOBD_Fault]==" TRUE ".If then performing step S507, otherwise Perform step S515.
Step S507, $ fields [$ Column_Fault_Name]=FF_HIGH_PRIORITY.
Step S508, $ fields [$ Column_Fault_Name] corresponding content is put into@OBD_CONST arrays.
Step S509, determines warning_mask, and be written to@according to the values arranged of MIL1/MIL2/MIL3/MIL4 tetra- In OBD_CONST arrays.
Step S510, obtains the content of Column_Display_On_Tester row and is written to@OBD_CONST arrays In.
Step S511, $ fields [$ Column_Freeze_Frame]==FF_REQ.It is then to perform step S513, otherwise Perform step S512.
Step S512, $ fields [$ Column_Freeze_Frame]==NONE.It is then to perform step S514, otherwise holds Row step S521.
Step S513, $ fields [$ Column_Freeze_Frame]=TRUE, and be written in@OBD_CONST arrays, And continue executing with step S512.
Step S514, $ fields [$ Column_Freeze_Frame]=FALSE, and it is written to@OBD_CONST arrays In, and continue executing with step S521.
Step S515, $ fields [$ Column_FF_Priority]==low.It is then to perform step S516, otherwise performs Step S517.
Step S516, $ fields [$ Column_Fault_Name]=FF_HIGH_PRIORITY, and continue executing with step S508。
Step S517, $ fields [$ Column_FF_Priority]==low.It is then to perform step S518, otherwise performs Step S519.
Step S518, $ fields [$ Column_Fault_Name]=FF_HIGH_PRIORITY, and continue executing with step S508。
Step S519, $ fields [$ Column_FF_Priority]==low.It is then to perform step S520, otherwise performs Step S508.
Step S520, $ fields [$ Column_Fault_Name]=FF_HIGH_PRIORITY, and continue executing with step S508。
Step S521, $ fields [$ Column_Latch_Fault]==NORMAL.It is then to perform step S522, otherwise holds Row step S523.
Step S522, $ fields [$ Column_Fault_Name]=OBD_NORMAL, and it is written to@OBD_CONST numbers In group, and continue executing with step S523.
Step S523, $ fields [$ Column_Latch_Fault]==SERVICE LATCHED.It is to perform step S524, otherwise performs step S525.
Step S524, $ fields [$ Column_Fault_Name]=OBD_SERVICE, and it is written to@OBD_CONST numbers In group, and continue executing with step S525.
Step S525, $ fields [$ Column_Latch_Fault]==DRIVE CYCLE LATCHED.It is then to perform step Rapid S526, otherwise performs step S527.
Step S526, $ fields [$ Column_Fault_Name]=OBD_DRIVE_CYCLE, and it is written to@OBD_ In CONST arrays, and continue executing with step S527.
Step S527, $ fields [$ Column_Latch_Fault]==RETAINED.It is then to perform step S528.
Step S528, $ fields [$ Column_Fault_Name]=OBD_RETAINED, and it is written to@OBD_CONST In array, and continue executing with step S529.
Step S529, Loop.Circulate.
Step S530, closes temp files.
Step S531, End.Terminate.
As shown in fig. 6, the life of the automatic generation method for the OBD variable-definition source files according to one embodiment of the invention Into the flow chart of obd_table.h source files.Comprise the following steps:
Step S601, Start.I.e. workflow starts.
Step S602, generates obd_const_array gauge outfits, is put into@OBD_TABLES arrays.And gauge outfit table tail is all Immobilized substance, is inserted directly into.
Step S603, opens temp.csv files.
Step S604, reads a line content from csv files, is not space-time when reading in content, circulation continues.
Step S605, removes the space in this journey, and is separated this journey content for delimiter with ", ", and is deposited into@ In fields arrays.
Step S606, judges $ fault_no!=0If it is, performing step S607, step S608 is otherwise performed.
Step S607, a carriage return character is inputted into@OBD_TABLES.
Step S608, obtains $ Column_Fault_Name fields, generates variable and is put into@OBD_TABLES arrays. Wherein, generate and generated in variable of the suffix for _ afl_threshold, obd_diag_array tables in obd_const_array tables Suffix for _ afl_count variable.
Step S609, Loop.And return to execution step S604.
Step S610, closes temp files.
Step S611, generates obd_const_array table tails, is put into@OBD_TABLES arrays.
Step S612, table obd_diag_array is similarly generated according to above-mentioned steps.One meets together in Obd_table.h files Generate the variable generated in obd_const_array and obd_diag_array2 table, 2 tables different, but it generates the side of table Method is the same.
Step S613, End.I.e. workflow terminates.
As shown in fig. 7, the life of the automatic generation method for the OBD variable-definition source files according to one embodiment of the invention Into the flow chart of obd_data.h source files.Comprise the following steps:
Step S701, Start.I.e. workflow starts.
Step S702, generates obd_data.h file headers, is put into@OBD_DATA arrays.Wherein, file header end-of-file is all For immobilized substance, it is inserted directly into.
Step S703, opens temp.csv files.
Step S704, reads a line content from csv files, is not space-time when reading in content, circulation continues.
Step S705, removes the space in this journey, and is separated this journey content for delimiter with ", ", and is deposited into@ In fields arrays.
Step S706, judges $ fault_no!=0If it is, performing step S707, step S708 is otherwise performed.
Step S707, a carriage return character is inputted into@OBD_DATA.
Step S708, obtains $ Column_Fault_Name fields, generates variable and is put into@OBD_DATA arrays.Tool Body, generation suffix is _ diag_flags, _ fec_count, _ aff_count, _ dcc_count, _ afl_count variable.
Step S709, $ fault_no=$ fault_no+1.
Step S710, Loop.And return to execution step S704.
Step S711, closes temp files.
Step S712, generates OBD_MAX_NO_FAULT variables, and be put into@OBD_DATA arrays.
Step S713, generates obd_data.h end-of-files, is put into@OBD_DATA arrays.One in Obd_table.h files Meet the variable generated in generation obd_const_array and obd_diag_array2 table, 2 tables together different, but generate table Method is the same.
Step S714, End.I.e. workflow terminates.
As shown in figure 8, the life of the automatic generation method for the OBD variable-definition source files according to one embodiment of the invention Into the flow chart of obd_config.h source files.Comprise the following steps:
Step S801, Start.I.e. workflow starts.
Step S802, opens temp.csv files.
Step S803, reads a line content from csv files, is not space-time when reading in content, circulation continues.
Step S804, removes the space in this journey, and is separated this journey content for delimiter with ", ", and is deposited into@ In fields arrays.Specifically, using perl regular expression, the character string of measurement of correlation amount is substituted into $ a2l_str and become In amount.
Step S805, obtains the field on name in@fields arrays, and generate the macrodefinition deposit@OBD_ of correlation In CONFIG arrays.
Step S806, Loop.And return to execution step S803.
Step S807, OBD_MAX_NO_FAULT and EOBD_MAX_NO_FAULT is defined as grand and to its assignment, insertion Into@OBD_CONFIG arrays.
Step S808, End.I.e. workflow terminates.
As shown in figure 9, the life of the automatic generation method for the OBD variable-definition source files according to one embodiment of the invention Into the flow chart of obd.a2l source files.Comprise the following steps:
Step S901, Start.I.e. workflow starts.
Step S902, opens temp.csv files.
Step S903, $ a2l_str=get_odb_a2l_header.Generate the header parts of a2l files and write In variable $ a2l_str.
Step S904, travels through cvs files, and the related scalar quantity of generation is inserted into $ a2l_str.Specifically, perl is utilized Regular expression, the character string of associated calibration amount is substituted into $ a2l_str variables.
Step S905, travels through cvs files, and the related measurement amount of generation is inserted into $ a2l_str.I.e. using perl just Then expression formula, the character string of measurement of correlation amount is substituted into $ a2l_str variables.
Step S906, $ a2l_str are stored in@OBD_A2L.
Step S907, reads a line content from csv files, is not space-time when reading in content, circulation continues.
Step S908, removes the space in this journey, and is separated this journey content for delimiter with ", ", and is deposited into@ In fields arrays.
Step S909, obtains the field on name in@fields arrays, and generate 29 variables deposit@of correlation In OBD_A2L arrays.
Step S910, Loop.And return to execution step S907.
Step S911, $ a2l_str=get_odb_a2l_trailer.Generate the ending of a2l files and write change Measure in $ a2l_str.
Step S912, $ a2l_str content is written in@OBD_A2L arrays.
Step S913, End.I.e. workflow terminates.
In above-mentioned example, the major function of sort_io_spec functions is to be ordered as;create_obd_const_ The major function of data functions is generation@OBD_CONST ,@OBD_DATA ,@OBD_TABLES, the numbers of@OBD_EXTERNALS tetra- Group;The major function of create_obd_config functions is generation@OBD_CONFIG arrays;Create_obd_a2l functions Major function is generation@OBD_A2L arrays.In above-mentioned example, artificial treatment is instead of using perl script language, will be various The variable-definition of OBD modules is read csv file contents by perl script automatically in csv files, by the content read according to Required sequence, variable needed for being extracted by the definition of each class variable, title etc. is simultaneously modified, integrated, each needed for finally exporting Class source file, so that development efficiency and accuracy rate are improved, while reducing development cost.
The automatic generation method of OBD variable-definition source files according to embodiments of the present invention, can be automatically generated by software The related source code file of OBD module contents, saves human cost, shortens the construction cycle, improves development efficiency, while Error rate is reduced, development quality is improved.In addition, the embodiment of the present invention is applied to different development platforms, it can somewhat be repaiied Migrate to and used in different development platforms after changing, therefore also have the advantages that portable high, universality is high.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show The description of example " or " some examples " etc. means to combine specific features, structure, material or the spy that the embodiment or example are described Point is contained at least one embodiment of the present invention or example.In this manual, to the schematic representation of above-mentioned term not Necessarily refer to identical embodiment or example.Moreover, specific features, structure, material or the feature of description can be any One or more embodiments or example in combine in an appropriate manner.
Although an embodiment of the present invention has been shown and described, it will be understood by those skilled in the art that:Not In the case of departing from the principle and objective of the present invention a variety of change, modification, replacement and modification can be carried out to these embodiments, this The scope of invention is by claim and its equivalent limits.

Claims (8)

1. a kind of automatic generation method of OBD variable-definitions source file, it is characterised in that comprise the following steps:
Multiple OBD variables are obtained, wherein, the OBD variables include name variable and multiple attribute fields;
The multiple OBD variables are write in default file;
The default file is parsed, with respectively according to the title of each OBD variables, at least a portion attribute field and Multiple initial multigroup design variables of OBD variable-definitions file generated, and it is corresponding multiple according to multigroup design variables generation Array, wherein, the multiple initial OBD variable-definitions file includes:Obd_const.h source files;
Respectively the content in the multiple array is write in corresponding initial OBD variable-definitions file to generate multiple OBD changes Definition source file is measured, wherein, the generation of the obd_const.h source files further comprises:
Obtain the preset attribute field groups of the OBD variables in the default file;
The name variable and other field combination of two are generated into new name variable respectively;
Assignment is carried out according to the corresponding attribute of preset attribute field and write in the second array;
The obd_const.h source files are generated according to second array.
2. according to the method described in claim 1, it is characterised in that the multiple initial OBD variable-definitions file also includes: Obd_data.h source files, obd_table.h source files, obd_externals.h source files, obd_config.h source files and Obd.a2l source files.
3. method according to claim 2, it is characterised in that the generation of the obd_externals.h source files, enters one Step includes:
Obtain the name variable of the OBD variables in the default file;
External related contents are generated according to the name variable and write in the first array;
The obd_externals.h source files are generated according to first array.
4. method according to claim 2, it is characterised in that the generation of the obd_table.h source files, is further wrapped Include:
Obtain the name variable of the OBD variables in the default file;
Table related contents are generated according to the name variable and write in the 3rd array;
The obd_table.h source files are generated according to the 3rd array.
5. method according to claim 2, it is characterised in that the generation of the obd_data.h source files, is further wrapped Include:
Obtain the name variable of the OBD variables in the default file;
Data related contents are generated according to the name variable and write in the 4th array;
The obd_data.h source files are generated according to the 4th array.
6. method according to claim 2, it is characterised in that the generation of the obd_config.h source files, further Including:
Obtain the name variable of the OBD variables in the default file;
Config related contents are generated according to name variable and write in the 5th array;
The obd_config.h source files are generated according to the 5th array.
7. method according to claim 2, it is characterised in that the generation of the obd.a2l source files, further comprises:
Obtain the name variable of the OBD variables in the default file;
A2l related contents are generated according to name variable and write in the 6th array;
The obd.a2l source files are generated according to the 6th array.
8. according to the method described in claim 1, it is characterised in that also include:
If reading the end identifier in the default file, stop.
CN201310123857.8A 2013-04-10 2013-04-10 A kind of automatic generation method of OBD variable-definitions source file Expired - Fee Related CN104102479B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310123857.8A CN104102479B (en) 2013-04-10 2013-04-10 A kind of automatic generation method of OBD variable-definitions source file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310123857.8A CN104102479B (en) 2013-04-10 2013-04-10 A kind of automatic generation method of OBD variable-definitions source file

Publications (2)

Publication Number Publication Date
CN104102479A CN104102479A (en) 2014-10-15
CN104102479B true CN104102479B (en) 2017-09-15

Family

ID=51670659

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310123857.8A Expired - Fee Related CN104102479B (en) 2013-04-10 2013-04-10 A kind of automatic generation method of OBD variable-definitions source file

Country Status (1)

Country Link
CN (1) CN104102479B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI571811B (en) * 2015-11-05 2017-02-21 財團法人資訊工業策進會 Variable definition modification device and method for process model integration systems
CN108733674B (en) * 2017-04-14 2021-10-08 宁德时代新能源科技股份有限公司 A2L file merging method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541521A (en) * 2010-12-17 2012-07-04 中国银联股份有限公司 Automatic operating instruction generating device based on structured query language and method
CN102722372A (en) * 2012-05-25 2012-10-10 上海学智科技有限公司 Method and system for automatically generating codes through classification and configuration

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020059348A1 (en) * 2000-11-14 2002-05-16 Cypress Semiconductor Corp. Automatic documentation generation tool and associated method
EP1606735A2 (en) * 2003-03-14 2005-12-21 Beach Solutions Limited Database tools

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541521A (en) * 2010-12-17 2012-07-04 中国银联股份有限公司 Automatic operating instruction generating device based on structured query language and method
CN102722372A (en) * 2012-05-25 2012-10-10 上海学智科技有限公司 Method and system for automatically generating codes through classification and configuration

Also Published As

Publication number Publication date
CN104102479A (en) 2014-10-15

Similar Documents

Publication Publication Date Title
CN108962393B (en) Automatic arrhythmia analysis method based on compression figure neural network
Malozyomov et al. Study of supercapacitors built in the start-up system of the main diesel locomotive
CN104102479B (en) A kind of automatic generation method of OBD variable-definitions source file
CN103631255B (en) For the Fault Insertion Equipment of avionics system Gernral Check-up
CN104699719B (en) A kind of semantization method of internet-of-things terminal equipment
CN108937912A (en) A kind of automatic arrhythmia analysis method based on deep neural network
CN109448703A (en) In conjunction with the audio scene recognition method and system of deep neural network and topic model
Del Pero et al. Automotive lightweight design: simulation modeling of mass-related consumption for electric vehicles
Lin et al. Online state-of-health estimation of lithium-ion battery based on incremental capacity curve and BP neural network
Ricco et al. Smart battery pack for electric vehicles based on active balancing with wireless communication feedback
Duffy et al. An analysis of design reuse benefits
Golowich et al. Two-loop analysis of axial vector current propagators in chiral perturbation theory
CN105388881B (en) The fault detect display device and method of a kind of entire car controller
CN106990774A (en) A kind of electric automobile portable fault diagnosis tester and its monitoring method
Ceschia et al. Optimal sizing of fuel cell hybrid power sources with reliability consideration
Moulik et al. Optimal rule-based power management for online, real-time applications in HEVs with multiple sources and objectives: a review
Girijaprasanna et al. A review on different state of battery charge estimation techniques and management systems for EV applications
Cui et al. Study on lifetime decline prediction of lithium-ion capacitors
CN109592525A (en) Elevator frequency converter fault diagnosis system and method
CN101718972B (en) Multifunctional vehicle-borne control system
CN106444510B (en) A kind of data collecting system based on grating
CN104406618B (en) State diagram based test method in small satellite test
Deng et al. A method for reliability detection of automated guided vehicle based on timed automata
CN102183988A (en) Method for judging stability of distributed power-supply system based on equivalent open-loop transfer function
Machedon-Pisu et al. Impact of the Light-Duty Vehicles’ Storage and Travel Demand on the Sustainable Exploitation of Available Resources and Air Pollution Abatement

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20180419

Address after: No. 188, Miyun District, Miyun District, Beijing, Beijing

Patentee after: Beijing treasure Car Co.,Ltd.

Address before: 102206 Changping District City, Shahe, Sha Yang Road, Beijing

Patentee before: BEIQI FOTON MOTOR Co.,Ltd.

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170915

CF01 Termination of patent right due to non-payment of annual fee