# HG changeset patch # User etisserant # Date 1181046721 -7200 # Node ID cd0133ed377b449acf8a7b8bbee3a9601ff551cf # Parent 69075340d6a9174dff0c28e8442cf23175b017ca Standard IEC functions declaration now made from iec_std.csv file for easier maintainance. diff -r 69075340d6a9 -r cd0133ed377b plcopen/iec_std.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plcopen/iec_std.csv Tue Jun 05 14:32:01 2007 +0200 @@ -0,0 +1,84 @@ +Standard_functions_variables_types;name;comment;type;;;; +;N;Number of bits to be shifted;UINT;;;; +;L;Left position within character string;UINT;;;; +;P;Position within character string;UINT;;;; +;G;Selection out of 2 inputs (gate);BOOL;;;; +;K;Selection out of n inputs;ANY_INT;;;; +;MN;Minimum value for limitation;ANY;;;; +;MX;Maximum value for limitation;ANY;;;; +;;;;;;; +;;;;;;; +;;;;;;; +;;;;;;; +;;;;;;; +;;;;;;; +Standard_functions_type;name;baseinputnumber;inputs;outputs;comment;overloaded;extensible +Type conversion;*_TO_**;1;(ANY);ANY;Data type conversion;yes;no +;TRUNC;1;(ANY_REAL);ANY_INT;Rounding up/down;yes;no +;BCD_TO_**;1;(ANY_BIT);ANY;Conversion from BCD;yes;no +;*_TO_BCD;1;(ANY_INT);ANY_BIT;Conversion to BCD;yes;no +;DATE_AND_TIME_TO_TIME_OF_DAY;1;(DT);TOD;Conversion to time-of-day;no;no +;DATE_AND_TIME_TO_DATE;1;(DT);DATE;Conversion to date;no;no +Numerical;ABS;1;(ANY_NUM);ANY_NUM;Absolute number;yes;no +;SQRT;1;(ANY_REAL);ANY_REAL;Square root (base 2);yes;no +;LN;1;(ANY_REAL);ANY_REAL;Natural logarithm;yes;no +;LOG;1;(ANY_REAL);ANY_REAL;Logarithm to base 10;yes;no +;EXP;1;(ANY_REAL);ANY_REAL;Exponentiation;yes;no +;SIN;1;(ANY_REAL);ANY_REAL;Sine;yes;no +;COS;1;(ANY_REAL);ANY_REAL;Cosine;yes;no +;TAN;1;(ANY_REAL);ANY_REAL;Tangent;yes;no +;ASIN;1;(ANY_REAL);ANY_REAL;Arc sine;yes;no +;ACOS;1;(ANY_REAL);ANY_REAL;Arc cosine;yes;no +;ATAN;1;(ANY_REAL);ANY_REAL;Arc tangent;yes;no +Arithmetic;ADD;1;(ANY_NUM, ANY_NUM);ANY_NUM;Addition;yes;yes +;ADD;1;(TIME, TIME);TIME;Time addition;yes;no +;ADD;1;(TOD, TIME);TOD;Time-of-day addition;yes;no +;ADD;1;(DT, TIME);DT;Date addition;yes;no +;MUL;1;(ANY_NUM, ANY_NUM);ANY_NUM;Multiplication;yes;yes +;MUL;1;(TIME, ANY_NUM);TIME;Time multiplication;yes;no +;SUB;1;(ANY_NUM, ANY_NUM);ANY_NUM;Subtraction;yes;no +;SUB;1;(TIME, TIME);TIME;Time subtraction;yes;no +;SUB;1;(DATE, DATE);TIME;Date subtraction;yes;no +;SUB;1;(TOD, TIME);TOD;Time-of-day subtraction;yes;no +;SUB;1;(TOD, TOD);TIME;Time-of-day subtraction;yes;no +;SUB;1;(DT, TIME);DT;Date and time subtraction;yes;no +;SUB;1;(DT, DT);TIME;Date and time subtraction;yes;no +;DIV;1;(ANY_NUM, ANY_NUM);ANY_NUM;Division;yes;no +;DIV;1;(TIME, ANY_NUM);TIME;Time division;yes;no +;MOD;1;(ANY_NUM, ANY_NUM);ANY_NUM;Remainder (modulo);yes;no +;EXPT;1;(ANY_NUM, ANY_NUM);ANY_NUM;Exponent;yes;no +;MOVE;1;(ANY_NUM, ANY_NUM);ANY_NUM;Assignment;yes;no +Bit-shift;SHL;1;(ANY_BIT, N);ANY_BIT;Shift left;yes;no +;SHR;1;(ANY_BIT, N);ANY_BIT;Shift right;yes;no +;ROR;1;(ANY_BIT, N);ANY_BIT;Rotate right;yes;no +;ROL;1;(ANY_BIT, N);ANY_BIT;Rotate left;yes;no +Bitwise;AND;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise AND;yes;yes +;OR;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise OR;yes;yes +;XOR;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise EXOR;yes;yes +;NOT;1;(ANY_BIT, ANY_BIT);ANY_BIT;Bitwise inverting;yes;no +Selection;SEL;0;(G, ANY, ANY);ANY;Binary selection (1 of 2);yes;no +;SEL;0;(G, ENUM, ENUM);ENUM;Binary selection (1 of 2);no;no +;MAX;1;(ANY, ANY);ANY;Maximum;yes;yes +;MIN;1;(ANY, ANY);ANY;Minimum;yes;yes +;LIMIT;1;(MN, ANY, MX);ANY;Limitation;yes;no +;MUX;0;(K, ANY, ANY);ANY;Multiplexer (select 1 of N);yes;yes +;MUX;0;(K, ENUM, ENUM);ENUM;Multiplexer (select 1 of N);no;no +Comparison;GT;1;(ANY, ANY);BOOL;Greater than;yes;yes +;GE;1;(ANY, ANY);BOOL;Greater than or equal to;yes;yes +;EQ;1;(ANY, ANY);BOOL;Equal to;yes;yes +;EQ;1;(ENUM, ENUM);BOOL;Equal to;no;no +;LT;1;(ANY, ANY);BOOL;Less than;yes;yes +;LE;1;(ANY, ANY);BOOL;Less than or equal to;yes;yes +;NE;1;(ANY, ANY);BOOL;Not equal to;yes;no +;NE;1;(ENUM, ENUM);BOOL;Not equal to;no;no +Character string;LEN;1;(STRING);INT;Length of string;no;no +;LEFT;1;(STRING, L);STRING;string left of;yes;no +;RIGHT;1;(STRING, L);STRING;string right of;yes;no +;MID;1;(STRING, L, P);STRING;string from the middle;yes;no +;CONCAT;1;(STRING, STRING);STRING;Concatenation;no;yes +;CONCAT;1;(DATE, TOD);DT;Time concatenation;no;no +;INSERT;1;(STRING, STRING, P);STRING;Insertion (into);yes;no +;DELETE;1;(STRING, L, P);STRING;Deletion (within);yes;no +;REPLACE;1;(STRING, STRING, L, P);STRING;Replacement (within);yes;no +;FIND;1;(STRING, STRING);INT;Find position;yes;no +;;;;;;; diff -r 69075340d6a9 -r cd0133ed377b plcopen/structures.py --- a/plcopen/structures.py Wed Apr 18 16:39:28 2007 +0200 +++ b/plcopen/structures.py Tue Jun 05 14:32:01 2007 +0200 @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import string, os, sys + #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor #based on the plcopen standard. # @@ -44,197 +46,7 @@ - The default modifier which can be "none", "negated", "rising" or "falling" """ -BlockTypes = [{"name" : "Numerical functions", "list": - [{"name" : "ADD", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], - "outputs" : [("OUT","ANY_NUM","none")], - "comment" : "Addition,\nresult := I1 + I2 + ..."}, - {"name" : "MUL", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], - "outputs" : [("OUT","ANY_NUM","none")], - "comment" : "Multiplication,\nresult := I1 * I2 * ..."}, - {"name" : "SUB", "type" : "function", "extensible" : False, - "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], - "outputs" : [("OUT","ANY_NUM","none")], - "comment" : "Substration,\nresult := I1 - I2"}, - {"name" : "DIV", "type" : "function", "extensible" : False, - "inputs" : [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")], - "outputs" : [("OUT","ANY_NUM","none")], - "comment" : "Division,\nresult := I1 / I2\n(with integer division, any fractional remainder is truncated)"}, - {"name" : "MOD", "type" : "function", "extensible" : False, - "inputs" : [("IN1","ANY_INT","none"),("IN2","ANY_INT","none")], - "outputs" : [("OUT","ANY_INT","none")], - "comment" : "Modulus,\nresult := I1 MOD I2\n(only valid with integer values)"}, - {"name" : "EXPT", "type" : "function", "extensible" : False, - "inputs" : [("IN1","ANY_REAL","none"),("IN2","ANY_INT","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Exponential,\nresult := I1 ^ I2\n(can only take integer exponents)"}, - {"name" : "ABS", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_NUM","none")], - "outputs" : [("OUT","ANY_NUM","none")], - "comment" : "Absolute value (negative values become positive)"}, - {"name" : "SQRT", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Square root"}, - {"name" : "LOG", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Logarithm"}, - {"name" : "LN", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Natural logarithm"}, - {"name" : "EXP", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Natural exponential"}, - {"name" : "SIN", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Sine of input as radians"}, - {"name" : "COS", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Cosine of input as radians"}, - {"name" : "TAN", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Tangent of input as radians"}, - {"name" : "ASIN", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Principal arc-sine, result in radians"}, - {"name" : "ACOS", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Principal arc-cosine, result in radians"}, - {"name" : "ATAN", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_REAL","none")], - "outputs" : [("OUT","ANY_REAL","none")], - "comment" : "Principal arc-tangent, result in radians"} - ]}, - {"name" : "Boolean and bit functions", "list": - [{"name" : "AND", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY_BIT","none"),("IN2","ANY_BIT","none")], - "outputs" : [("OUT","ANY_BIT","none")], - "comment" : "Result := I1 & I2 & ..."}, - {"name" : "OR", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY_BIT","none"),("IN2","ANY_BIT","none")], - "outputs" : [("OUT","ANY_BIT","none")], - "comment" : "Result := I1 OR I2 OR ..."}, - {"name" : "XOR", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY_BIT","none"),("IN2","ANY_BIT","none")], - "outputs" : [("OUT","ANY_BIT","none")], - "comment" : "Result := I1 XOR I2 XOR ..."}, - {"name" : "NOT", "type" : "function", "extensible" : False, - "inputs" : [("IN","BIT","none")], - "outputs" : [("OUT","BIT","none")], - "comment" : "Result := NOT I1"}, - {"name" : "SHL", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], - "outputs" : [("OUT","ANY_BIT","none")], - "comment" : "Shift bit-string n bit positions left, zero fill on the right."}, - {"name" : "SHR", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], - "outputs" : [("OUT","ANY_BIT")], - "comment" : "Shift bit-string right n bit positions, zero fill on the left."}, - {"name" : "ROR", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], - "outputs" : [("OUT","ANY_BIT","none")], - "comment" : "Shift bit-string right, rotate by n bit positions."}, - {"name" : "ROL", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY_BIT","none"),("N","ANY_INT","none")], - "outputs" : [("OUT","ANY_BIT","none")], - "comment" : "Shift bit-string left, rotate by n bit positions."} - ]}, - {"name" : "Selection functions", "list": - [{"name" : "SEL", "type" : "function", "extensible" : False, - "inputs" : [("G","BOOL","none"),("IN0","ANY","none"),("IN1","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Selection\nIf G = TRUE then\nResult := IN1 else\nResult := IN2"}, - {"name" : "MAX", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Maximum\nResult := maximum value of all inputs"}, - {"name" : "MIN", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("","ANY","none")], - "comment" : "Minimum\nResult := minimum value of all inputs"}, - {"name" : "LIMIT", "type" : "function", "extensible" : False, - "inputs" : [("MN","ANY","none"),("IN","ANY","none"),("MX","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Limit\nResult is the value of IN limited between a minimum value of MN and a maximum value of MX."}, - {"name" : "MUX", "type" : "function", "extensible" : True, - "inputs" : [("K","ANY_INT","none"),("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Multiplexer\nResult is the value of the input selected by the value of K."} - ]}, - {"name" : "Comparison functions", "list": - [{"name" : "GT", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Greater than\nResult := IN1 > IN2"}, - {"name" : "GE", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Greater than or equal\nResult := IN1 >= IN2"}, - {"name" : "EQ", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Equality\nResult := IN1 = IN2"}, - {"name" : "LE", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Lesser than or equal\nResult := IN1 <= IN2"}, - {"name" : "LT", "type" : "function", "extensible" : True, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Lesser than\nResult := IN1 < IN2"}, - {"name" : "NE", "type" : "function", "extensible" : False, - "inputs" : [("IN1","ANY","none"),("IN2","ANY","none")], - "outputs" : [("OUT","ANY","none")], - "comment" : "Not equal\nResult := IN1 <> IN2"} - ]}, - {"name" : "Character string functions", "list": - [{"name" : "LEFT", "type" : "function", "extensible" : False, - "inputs" : [("IN","STRING","none"),("L","ANY_INT","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Extract left string\nResult is the string formed from L characters from the leftmost character of string IN."}, - {"name" : "RIGHT", "type" : "function", "extensible" : False, - "inputs" : [("IN","STRING","none"),("L","ANY_INT","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Extract right string\nResult is the string formed from L characters from the rightmost part of string IN."}, - {"name" : "MID", "type" : "function", "extensible" : False, - "inputs" : [("IN","ANY","none"),("L","ANY_INT","none"),("P","ANY_INT","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Extract mid string\nResult is a string extracted from the input string IN starting at character position P, and L characters long."}, - {"name" : "CONCAT", "type" : "function", "extensible" : True, - "inputs" : [("IN1","STRING","none"),("IN2","STRING","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Concatenate strings\nResult is a string formed by joining the input strings together. This is an extensible function that can take two or more input strings."}, - {"name" : "INSERT", "type" : "function", "extensible" : False, - "inputs" : [("IN1","STRING","none"),("IN2","STRING","none"),("P","ANY_INT","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Insert string\nThe result is formed by the string IN2 being inserted into string IN1, P character positions from the start of IN1."}, - {"name" : "DELETE", "type" : "function", "extensible" : False, - "inputs" : [("IN","STRING","none"),("L","ANY_INT","none"),("P","ANY_INT","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Delete string\nThe result is formed by a string of characters L in length, being deleted from the input string IN, starting from character position P."}, - {"name" : "REPLACE", "type" : "function", "extensible" : False, - "inputs" : [("IN1","STRING","none"),("IN2","STRING","none"),("L","ANY_INT","none"),("P","ANY_INT","none")], - "outputs" : [("OUT","STRING","none")], - "comment" : "Replace string\nThe result is formed by replacing L characters in string IN1, starting at position P, with character string in IN2."}, - {"name" : "LEN", "type" : "function", "extensible" : False, - "inputs" : [("IN","STRING","none")], - "outputs" : [("OUT","INT","none")], - "comment" : "Length\nResult is length of the input string."}, - {"name" : "FIND", "type" : "function", "extensible" : False, - "inputs" : [("IN1","STRING","none"),("IN2","STRING","none")], - "outputs" : [("OUT","INT","none")], - "comment" : "Find string\nResult is the position where string IN2 is first found in string IN1.\nIf string IN2 is not found in IN1, the result is 0."}, - ]}, - {"name" : "Standard function blocks", "list": +BlockTypes = [{"name" : "Standard function blocks", "list": [{"name" : "SR", "type" : "functionBlock", "extensible" : False, "inputs" : [("S1","BOOL","none"),("R","BOOL","none")], "outputs" : [("Q1","BOOL","none")], @@ -377,7 +189,124 @@ test = TypeHierarchy[test] return False - +def GetSubTypes(reference): + return [ typename for typename in TypeHierarchy.iterkeys() if typename[:3] != "ANY" and IsOfType(typename, reference)] + + + + + +def csv_file_to_table(file): + return [ map(string.strip,line.split(';')) for line in file.xreadlines()] + +def find_section(section_name, table): + fields = [None] + while(fields[0] != section_name): + fields = table.pop(0) + return fields[1:] + + +def get_standard_funtions_input_variables(table): + variables = find_section("Standard_functions_variables_types", table) + standard_funtions_input_variables = {} + fields = [True,True] + while(fields[1]): + fields = table.pop(0) + variable_from_csv = dict([(champ, val) for champ, val in zip(variables, fields[1:])]) + standard_funtions_input_variables[variable_from_csv['name']] = variable_from_csv['type'] + return standard_funtions_input_variables + +#"(ANY_NUM, ANY_NUM)" ---> [("IN1","ANY_NUM","none"),("IN2","ANY_NUM","none")] +def csv_input_translate(str_decl, variables, base): + decl = str_decl.replace('(','').replace(')','').replace(' ','').split(',') + param_types = [] + param_names = [] + modifiers = [] + if len(decl)>1 : suffix = str(base) + else: suffix = '' + + for param_type in decl: + predifined_variable_param_type = variables.get(param_type,None) + if predifined_variable_param_type : + param_types.append(predifined_variable_param_type) + param_names.append(param_type) + else: + param_types.append(param_type) + param_names.append("IN"+suffix) + base+=1 + suffix = str(base) + + modifiers = ["none"]*len(param_types) + return zip(param_names,param_types,modifiers) + +def decl_function(dico_from_table, variables): + Function_decl = { "type" : "function" } + for field, val in dico_from_table: + translate = { + "baseinputnumber" : lambda x:int(x), + "extensible" : lambda x: {"yes":True, "no":False}[x], + "inputs" : lambda x:csv_input_translate(x,variables,Function_decl.get("baseinputnumber",1)), + "outputs":lambda x:[("OUT",x,"none")]} + Function_decl[field] = translate.get(field,lambda x:x)(val) + #Function_decl.pop("baseinputnumber") + Function_decl.pop("overloaded") + return Function_decl + + +def get_standard_funtions(table): + + variables = get_standard_funtions_input_variables(table) + + fonctions = find_section("Standard_functions_type",table) + + Standard_Functions_Decl = [] + Current_section = None + for fields in table: + if fields[1]: + # If function section name given + if fields[0] : + if Current_section: + Standard_Functions_Decl.append(Current_section) + Current_section = { "name" : fields[0], "list" : [] } + Function_decl_list = [] + + dico_from_table = zip(fonctions, fields[1:]) + Function_decl = decl_function(dico_from_table,variables) + + if Function_decl["name"].startswith("*"): + input_types = GetSubTypes(Function_decl["inputs"][0][1]) + else: + input_types = [None] + if Function_decl["name"].endswith("**"): + output_types = GetSubTypes(Function_decl["outputs"][0][1]) + else: + output_types = [None] + + funcdecl = Function_decl["name"] + for intype in input_types: + if intype != None: + decl_tpl = Function_decl["inputs"][0] + Function_decl["inputs"] = [decl_tpl[:1] + (intype,) + decl_tpl[2:]] + Function_decl["inputs"][1:] + funcdeclin = funcdecl.replace("*_", intype + '_') + Function_decl["name"] = funcdeclin + + for outype in output_types: + if outype != None: + decl_tpl = Function_decl["outputs"][0] + Function_decl["outputs"] = [decl_tpl[:1] + (outype,) + decl_tpl[2:]] + Function_decl["outputs"][1:] + funcdeclout = funcdeclin.replace("_**", '_' + outype) + Function_decl["name"] = funcdeclout + Current_section["list"].append(Function_decl.copy()) + + return Standard_Functions_Decl + + +to_append=get_standard_funtions(csv_file_to_table(open(os.path.join(sys.path[0], "plcopen/iec_std.csv")))) +import pprint +pp = pprint.PrettyPrinter(indent=4) +pp.pprint(to_append) +BlockTypes.extend(to_append) +pp.pprint(BlockTypes) #------------------------------------------------------------------------------- # Test identifier #-------------------------------------------------------------------------------