plcopen/iec_std.csv
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Apr 2016 13:05:57 +0300
changeset 1507 d7f474d10210
parent 1390 0f4d32a033e0
child 2496 39049d615c0d
permissions -rw-r--r--
fix issue with sometimes wrong return code of ProcessLogger


As a result of wrong return code Beremiz gives folowing traceback:
Traceback (most recent call last):
File "./Beremiz.py", line 850, in OnMenu
getattr(self.CTR, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 925, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 568, in _Generate_SoftPLC
return self._Compile_ST_to_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 661, in _Compile_ST_to_SoftPLC
C_files.remove("POUS.c")
ValueError: list.remove(x): x not in list

The problem is that both threads (for reading stdout and stderr) call self.Proc.poll(),
that updates internal returncode field. This call is done without any locking and the first thread gets correct result,
but other gets 0 as retval. If 0 gets thread, that afterwards calls callback finish, then wrong return code is returned
to the parent. Now only the thread with a callback polls for the return code, other thread just checked local value.

Additionally function spin() waits now until all threads finish reading their pipes, so the results are always correct.
Standard_functions_variables_types;name;type;comment;;;;
;N;ANY_INT;Number of bits to be shifted;;;;
;L;ANY_INT;Left position within character string;;;;
;P;ANY_INT;Position within character string;;;;
;G;BOOL;Selection out of 2 inputs (gate);;;;
;K;ANY_INT;Selection out of n inputs;;;;
;MN;ANY;Minimum value for limitation;;;;
;MX;ANY;Maximum value for limitation;;;;
;;;;;;;
;;;;;;;
;;;;;;;
;;;;;;;
;;;;;;;
;;;;;;;
Standard_functions_type;name;baseinputnumber;inputs;outputs;comment;extensible;filter
_("Type conversion");*_TO_**;1;(ANY);ANY;_("Data type conversion");no;ANY_TO_ANY
;TRUNC;1;(ANY_REAL);ANY_INT;_("Rounding up/down");no;
;BCD_TO_**;1;(ANY_BIT);ANY_INT;_("Conversion from BCD");no;BCD_TO_ANY
;*_TO_BCD;1;(ANY_INT);ANY_BIT;_("Conversion to BCD");no;ANY_TO_BCD
;DATE_AND_TIME_TO_TIME_OF_DAY;1;(DT);TOD;_("Conversion to time-of-day");no;
;DATE_AND_TIME_TO_DATE;1;(DT);DATE;_("Conversion to date");no;
_("Numerical");ABS;1;(ANY_NUM);ANY_NUM;_("Absolute number");no;
;SQRT;1;(ANY_REAL);ANY_REAL;_("Square root (base 2)");no;
;LN;1;(ANY_REAL);ANY_REAL;_("Natural logarithm");no;
;LOG;1;(ANY_REAL);ANY_REAL;_("Logarithm to base 10");no;
;EXP;1;(ANY_REAL);ANY_REAL;_("Exponentiation");no;
;SIN;1;(ANY_REAL);ANY_REAL;_("Sine");no;
;COS;1;(ANY_REAL);ANY_REAL;_("Cosine");no;
;TAN;1;(ANY_REAL);ANY_REAL;_("Tangent");no;
;ASIN;1;(ANY_REAL);ANY_REAL;_("Arc sine");no;
;ACOS;1;(ANY_REAL);ANY_REAL;_("Arc cosine");no;
;ATAN;1;(ANY_REAL);ANY_REAL;_("Arc tangent");no;
_("Arithmetic");ADD;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Addition");yes;
;MUL;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Multiplication");yes;
;SUB;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Subtraction");no;
;DIV;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Division");no;
;MOD;1;(ANY_INT, ANY_INT);ANY_INT;_("Remainder (modulo)");no;
;EXPT;1;(ANY_REAL, ANY_NUM);ANY_REAL;_("Exponent");no;
;MOVE;1;(ANY);ANY;_("Assignment");no;
_("Time");ADD;1;(TIME, TIME);TIME;_("Time addition");no;
;ADD_TIME;1;(TIME, TIME);TIME;_("Time addition");no;
;ADD;1;(TOD, TIME);TOD;_("Time-of-day addition")+" "+_("DEPRECATED");no;
;ADD_TOD_TIME;1;(TOD, TIME);TOD;_("Time-of-day addition");no;
;ADD;1;(DT, TIME);DT;_("Date addition")+" "+_("DEPRECATED");no;
;ADD_DT_TIME;1;(DT, TIME);DT;_("Date addition");no;
;MUL;1;(TIME, ANY_NUM);TIME;_("Time multiplication")+" "+_("DEPRECATED");no;
;MULTIME;1;(TIME, ANY_NUM);TIME;_("Time multiplication");no;
;SUB_TIME;1;(TIME, TIME);TIME;_("Time subtraction");no;
;SUB;1;(TIME, TIME);TIME;_("Time subtraction");no;
;SUB;1;(DATE, DATE);TIME;_("Date subtraction")+" "+_("DEPRECATED");no;
;SUB_DATE_DATE;1;(DATE, DATE);TIME;_("Date subtraction");no;
;SUB;1;(TOD, TIME);TOD;_("Time-of-day subtraction")+" "+_("DEPRECATED");no;
;SUB_TOD_TIME;1;(TOD, TIME);TOD;_("Time-of-day subtraction");no;
;SUB;1;(TOD, TOD);TIME;_("Time-of-day subtraction")+" "+_("DEPRECATED");no;
;SUB_TOD_TOD;1;(TOD, TOD);TIME;_("Time-of-day subtraction");no;
;SUB;1;(DT, TIME);DT;_("Date and time subtraction")+" "+_("DEPRECATED");no;
;SUB_DT_TIME;1;(DT, TIME);DT;_("Date and time subtraction");no;
;SUB;1;(DT, DT);TIME;_("Date and time subtraction")+" "+_("DEPRECATED");no;
;SUB_DT_TIME;1;(DT, DT);TIME;_("Date and time subtraction");no;
;DIV;1;(TIME, ANY_NUM);TIME;_("Time division")+" "+_("DEPRECATED");no;
;DIVTIME;1;(TIME, ANY_NUM);TIME;_("Time division");no;
_("Bit-shift");SHL;1;(ANY_BIT, N);ANY_BIT;_("Shift left");no;
;SHR;1;(ANY_BIT, N);ANY_BIT;_("Shift right");no;
;ROR;1;(ANY_NBIT, N);ANY_NBIT;_("Rotate right");no;
;ROL;1;(ANY_NBIT, N);ANY_NBIT;_("Rotate left");no;
_("Bitwise");AND;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise AND");yes;
;OR;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise OR");yes;
;XOR;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise XOR");yes;
;NOT;1;(ANY_BIT);ANY_BIT;_("Bitwise inverting");no;
_("Selection");SEL;0;(G, ANY, ANY);ANY;_("Binary selection (1 of 2)");no;
;MAX;1;(ANY, ANY);ANY;_("Maximum");yes;
;MIN;1;(ANY, ANY);ANY;_("Minimum");yes;
;LIMIT;1;(MN, ANY, MX);ANY;_("Limitation");no;
;MUX;0;(K, ANY, ANY);ANY;_("Multiplexer (select 1 of N)");yes;
_("Comparison");GT;1;(ANY, ANY);BOOL;_("Greater than");yes;
;GE;1;(ANY, ANY);BOOL;_("Greater than or equal to");yes;
;EQ;1;(ANY, ANY);BOOL;_("Equal to");yes;
;LT;1;(ANY, ANY);BOOL;_("Less than");yes;
;LE;1;(ANY, ANY);BOOL;_("Less than or equal to");yes;
;NE;1;(ANY, ANY);BOOL;_("Not equal to");no;
_("Character string");LEN;1;(STRING);INT;_("Length of string");no;
;LEFT;1;(STRING, L);STRING;_("string left of");no;
;RIGHT;1;(STRING, L);STRING;_("string right of");no;
;MID;1;(STRING, L, P);STRING;_("string from the middle");no;
;CONCAT;1;(STRING, STRING);STRING;_("Concatenation");yes;
;CONCAT_DAT_TOD;1;(DATE, TOD);DT;_("Time concatenation");no;
;INSERT;1;(STRING, STRING, P);STRING;_("Insertion (into)");no;
;DELETE;1;(STRING, L, P);STRING;_("Deletion (within)");no;
;REPLACE;1;(STRING, STRING, L, P);STRING;_("Replacement (within)");no;
;FIND;1;(STRING, STRING);INT;_("Find position");no;