Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [4diac-dev] [LUA] Dynamic type loader test evaluation

Hello Martin!
Please excuse my late reply.
I will try to change my test according the information you gave me. I think i made some mistakes with the datatypes, as i thought of them more like c operators, as you mentioned. I will update you, if the tests do change.
Thank you and best regards,
Gesendet: Dienstag, 11. Juni 2019 um 22:25 Uhr
Von: "Martin Melik-Merkumians" <Melik-Merkumians@xxxxxxxxxxxxxxxxx>
An: "4diac developer discussions" <4diac-dev@xxxxxxxxxxx>
Betreff: Re: [4diac-dev] [LUA] Dynamic type loader test evaluation

Hi Jan,


I have gone through your spreadsheet. Its great what you already analyzed since starting.


I also have seen, that you differentiate between logical and bitwise operators (and/or/xor). Although such a distinction exists in C/C++ and LUA (as far as I remember), the IEC 61131 does not know this distinction, because there is a dedicated bool data type, which is part of the ANY_BIT types.


Some examples to perhaps better visualize what I mean here.

So a <WORD> AND <WORD> results in a <WORD> (abbreviated with => from now on)

Resulting in a C-like bitwise AND operation


<BOOL> AND <WORD> => <WORD> as the bool will be implicitly cast to the larger type

Again resulting in a bitwise AND


For <BOOL> AND <BOOL> => <BOOL> - this will produce a C-like logical AND


So for e.g. an IF condition _expression_, the resulting type must always be a BOOL type in IEC 61131, which means the line  “IF <BOOL> AND <WORD> THEN” is invalid code in the context of IEC 61131, where the same combination of types would be valid in C-like languages (with values different from zero treated as true, and false otherwise).


So to make a long story short, in IEC 61131 there is no distinction between logical and bitwise operations, as all Boolean operations are always treated as bitwise, but with a distinct BOOL data type with no implicit or explicit casts to it. The only way to get a BOOL value is that the _expression_ must result in a BOOL.


If there are further questions to that, feel free to contact me.


Best regards,




Dipl.-Ing. Martin Melik-Merkumians

Advanced Mechatronic Systems

Automation and Control Institute (ACIN)

Vienna University of Technology

DVR-Number: 0005886


Gusshausstr. 27-29, room CA-05-38

1040 Vienna, Austria

Phone: +43 (0)1 588 01 37688

Fax: +43 (0)1 588 01 937688

Email: melik-merkumians@xxxxxxxxxxxxxxxxx





Von: 4diac-dev-bounces@xxxxxxxxxxx <4diac-dev-bounces@xxxxxxxxxxx> Im Auftrag von Jan Holzweber
Gesendet: Dienstag, 11. Juni 2019 15:57
An: 4diac-dev@xxxxxxxxxxx
Betreff: [4diac-dev] [LUA] Dynamic type loader test evaluation




I finihsed the first evaluation of the tool. I summarized everything in the wiki and also in more detail in a google sheet.
wiki: wiki

google spread sheet: spreadsheet


For question, as awlays, i am easily reachable on mattermost or here with the mailinglist.




_______________________________________________ 4diac-dev mailing list 4diac-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top