
| Current Path : /proc/thread-self/root/home/ift/52_procpy/xy/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //proc/thread-self/root/home/ift/52_procpy/xy/xy.rule |
#===================================================================== # # xyparser v 1.0 # # The csv parser into the database # # DOCUMENTATION # ============= # # The xyparser reads maXYmos csv files and writes # their cycle data to a database. # # Copyright: Ift Informatik GmbH, Fuerth, Germany # HRG 11020, AG Fuerth, info@ift-informatik.de # # # 1. Introduction and installation # -------------------------------- # # To extend the toolchain of the maXYmos family, IfT provides a # tool to read csv-files coming from maXYmos BL, TL, NC series. # csv files are read and the values are stored in a database. # # This tool comes with three files: # # - the executable: xyparrser_<name>.exe # - license file: <name>.license # - configuration file: <name>.rule (THIS file) # # All these three file have to be put into the directory # where the csv files are located. # # # 2. The parsing process # ---------------------- # # To start the parsing of the csv-files, start the exe-file # (as a service). # # All the csv-files in the directory will be parsed and # the values are written into the database. # # The database parameters are fixed in the license file, # and are customized by IfT. For getting a version with # a ceratin database connection, call IfT # # Supported database engines: # # - sqlite # - mysql, mariadb # - MSSql # - PostgreSql # # After a csv-file <xyz>.csv is processed, a file <xyz>.processed # is written, so that it is clear which files already are read in # and can be removed from the directory. # # # 3. Configuration # ----------------- # # The configuration of the parsing can be controled in the .rule file # (THIS file). # # A maXYmos csv-file has sections, separated by empty lines. # Each section starts with a header, followed by lines of data. # All empty lines followed by a single non-empty line are skipped. # # To address a certain value: # # V.<section>_<name> # # where <section> is the identifier of the section, and <name> the # name of the variable. # # The section name is the first cell of the section, without # spaces and special characters, in lower cases, # or even only a substring of it. # # Example 1: # # Process values - curve related; --> processvaluescurve # or cessvaluesc # or svaluescur # # Example 2: # # Process values - EO related; --> valueseo # or eor # # The first match will be found. # # The <name> is the name of a value in the csv file, without # spaces and special characters, in lower cases. # # Example 3: # # XMIN-X --> xminx # # Example 4: # # Peak-peak X --> peakpeakx # # For example, to address the process value BLOCK-X in the # section Process values - curve related, put: # # Example 5: # # V.processvaluescurve_blockx # # If there is no ambiguity, then you even can skip the # <name> part: V.processvaluescurve_blockx is also V.blockx # # If you skip the <name> part, you get the whole section: # # Example 6: # # V.processvaluescur delivers the section. # # You also can address the values of variables which many lines. # This affects variable names in the headline of sections, # for example in the EO related sections and the measuring # curve data section. The naming convention is the same, # but you get an array of values, due to the count of data # lines in the section. # # Example 7: # # V.objectsset_xreference # # returns an array of the X reference settings for each EO. # # Example 8: # # V.time_time # # returns the time column of the measuring data table # (be aware that the header of the data section is a # single non-empty line, so the following empty lines # are skipped). # # Example 9: # # V.time_xabsolute: # # returns the X (ABSOLUTE) column of the measuring data table # # # # 4. Mapping to database tables # ------------------------------ # # The values addressed by certain V.<section>_name, or # V.<section> or V.<name> entries can be mapped to certain # columns of one or more database tables. # # The tables have to be notated by entries like that: # # E.TABLE = "<table1>" # F.TABLE = "<table2>" # G.TABLE = "<table3>" # # at the beginning of the .rule file, one or more (up to ten) # entries like that, <tablex> is the certain name of the table. # # Values now can be assigned to single columns of the databases # by assignment statements like: # # E.<colname> = .... # # writes to the column <colname> of the table <table1>. # # All kind of python expressions are allowed here. # # If a value to be entered into the database is an array, # then there will be inserted for each array element one # dedicated table row. If an array has less values than # lines have to be filled, this cell will remain empty. # # To flatten an array (or any datastructure), use the # json-function. # # Example 10: # # json(V.eor_result) # # gives the results for all EOs as a json string. # # A hash function also is offered: # # Example 11: # # hash(V.sequence) # # All data entries come with a column CYCLEKEY with # an unique key to identity the cycle given by the csv file, # and a column CYCLENUMBER to count the lines in # the database table. It is possible to set CYCLEKEY in # the rule-file, then the CYCLEKEY will be overriden, # but stays unique. With this method a unique hash-table # of longer text fields can be provided. # # Example 12: # # E.CYCLEKEY = hash(V.sequence) # # For SQLite and MySQL/MariaSQL tables and columns, which # are requested, will be generated if they do not exist. # # # # END OF DOCUMENTATION # #===================================================================== # # Example: # Configuration: V._delete_csv = 1 V._store_days = 185 V._speed = 0 # speed up by doubling they cyclekeys V._keylen = 3 # byte-length of the keys # Table Names: E.TABLE = "processv" F.TABLE = "eov" G.TABLE = "measv" H.TABLE = "sequences" # Data assignemnts: # Process values: E.DATE = V.date E.TIME = V.time E.CYCLENR = V.cyclenumber E.RESULT = V.totalresult E.PARTNR = V.partserialnumber E.PROGNAME = V.measuringprogramname E.PROGNR = V.measuringprogramnumber E.IPNR = V.ipaddress E.NETWORK = V.networkname E.DEVICE = V.devicename E.COMPANY = V.companyname E.COMMENT = V.comment E.MEASFUNC = V.measuringfunc E.MEASPOINTS = V.numberofmeasuringpoints E.REFGRAPHON = V.refgraphon # EO values: F.EONR = V.evaluationobjectsset_evaluationobjectsset F.EOREACTION = V.evaluationobjectsset_reaction F.EOXREF = V.evaluationobjectsset_xref F.EOYREF = V.evaluationobjectsset_yref F.EOXMIN = V.evaluationobjectsset_xmin F.EOXMAX = V.evaluationobjectsset_xmax F.EOYMIN = V.evaluationobjectsset_ymin F.EOYMAX = V.evaluationobjectsset_ymax F.EOENTRY = V.evaluationobjectsset_entry F.EOEXIT = V.evaluationobjectsset_exit F.EOCURVEPART = V.evaluationobjectsset_curvepart # Measuring curve data: G.MEASTIME = V.time_time[1:] G.MEASX = V.time_xabs[1:] G.MEASY = V.time_y[1:] # Sequences: H.CYCLEKEY = hash(V.sequence) H.SEQUENCE = V.sequence