What language to choose for my brand PLC?

I perfectly understand. Fortunately, I know ST pretty much well.
My 320 pages book to learn ST, right now in the publishing process.
There is a lot of difference between knowing ST and writing a lexer, parser and code generator.

еhat is why I want to convert it to something like Phyton. Then Phyton will make all errors of compilation and I do not need to do that. Slower? Yes but my PLC will run on big CPU machines like XEON, i7 and such. So I can sacrifice little bit of performance.
Do you know how python handles bits, BYTEs, WORDs, structures, unions etc? I suggest you look up structures and unions for python.

Are you going to embed python?

If you are going to generate byte code I would chose something more flexible like generating byte codes for Mono. The Mono part is already done. Actually, that is a good idea for me.
 
There is a lot of difference between knowing ST and writing a lexer, parser and code generator.

I know, but at least I know ST right? In any case, it is one problem less :)

Do you know how python handles bits, BYTEs, WORDs, structures, unions, etc? I suggest you look up structures and unions for python.

Are you going to embed python?

If you are going to generate byte code I would choose something more flexible like generating byte codes for Mono. The Mono part is already done. Actually, that is a good idea for me.

It is not necessary to follow types. I can convert all `ANY_NUM`, `ANY_INT` and `ANY_REAL` types into a single integer in Python. Since I do not create machine code I do not work with bits so I do not care actually. It is not necessary to access exact memory locations by address.

Look ST is only an expression of what developer what CPU to do. It does not matter if bytes really in the exact order in the memory. If the user uses %MW0 and then %MW1 for user those are byte after byte, but in reality, I can simulate this but store it with automatic location when declare var in Python but in fact, return correct result when developer access %MD0.

And also I will not embed anything. My PLC will run on Linux actually it is a PC. I think that I could create programs for PLC on Python from start, but I want everyone who knows IEC 61131-3 could utilize it quickly.

And it is not Зернещт but maybe another language. I am looking into Mono. 10 minutes did not give me anything. I'll study it later today and see what it is.
 
Look ST is only an expression of what developer what CPU to do. It does not matter if bytes really in the exact order in the memory. If the user uses %MW0 and then %MW1 for user those are byte after byte, but in reality, I can simulate this but store it with automatic location when declare var in Python but in fact, return correct result when developer access %MD0.


Are you looking to make a transpiler? Something that takes source code in ST and converts it to usable Python?
 
Hmmm, one reason not to use python is perhaps
https://github.com/thiagoralves/OpenPLC_Editor/issues/9

Differences between python 2 and 3 include:
"In Python 3, 5 / 2 == 2.5 and not 2; all division between int values result in a float."

What changes will they then make in python 4?

I guess it is hardly a problem, you just need a good test script... But if that too is written in python...

I'll have total control over Python versions installed if I choose it. That does not concern be a bit.
 
Hmmm, one reason not to use python is perhaps
https://github.com/thiagoralves/OpenPLC_Editor/issues/9

Differences between python 2 and 3 include:
"In Python 3, 5 / 2 == 2.5 and not 2; all division between int values result in a float.". ...

Code:
$ echo "python -c 'import sys;print((sys.version,5//2,))'" | ssh ...

('3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) \n[GCC 7.3.0]', 2)


$ echo "python -c 'import sys;print((sys.version,5//2,))'" | bash

('2.7.16 (default, Mar 20 2019, 12:15:19) \n[GCC 7.4.0]', 2)
 
Dear Herr Doktor Bitboy, what are you trying to say? I speak only train station.

In anyway it is a silly comment by me. Of course you test things before making changes, like a major rev of your compiler.

That said, reading the comments by the maintainer thiagoralves, it seems as though they may be interested in collaborating with our own OP.
 
What you all think about nodejs?

I know it is completely different. It is asynchronous (none-blocking), unlike ST, Python, C/C++. But when I look at possibilities for PLC it looks promising, isn't it?
 
What you all think about nodejs?

I know it is completely different. It is asynchronous (none-blocking), unlike ST, Python, C/C++. But when I look at possibilities for PLC it looks promising, isn't it?

Yes. Node is pretty quick, and there is a package, called Async.io or something like that, that takes any pain out of doing things in series vs. parallel. And when you write the web server for the PLC, the backend and frontend can be supported by the the same people.

Not the wrong forum: there are a few of us that have thought about it, then realized it would be akin to an obsession, and are probably jealous of the enthusiasm.

9, 11! (hah, I snuck in two tabs;-)
 
Something like this

Code:
class PLC_PRG {
    run() {
        var st = new Date().getTime();

        var foo = [];
        for (var i = 1; i <= 100000; i++) {
            foo.push(i + 5 * 10);
        }

        console.log(new Date().getTime() - st + "ms");
    }
}

var main = new PLC_PRG();
setInterval(main.run, 1000);

This shows only 3ms average time. Pretty much consistent. And possible to create times with resolution to (N)ms.

The good thing about it, that communication function will be triggered asynchronously. It will not interrupt but will resolve.
 

Similar Topics

Hello Friends I have 2 languages in my app, en-US, es-MX. I need to send CurrentLanguage to PLC, I am trying with Macro in Global Connections...
Replies
5
Views
165
So, I'm new to the PLC world (fresh graduate) and at my job I've been pretty much only helping out the other programmers with simpler tasks while...
Replies
1
Views
610
Hello, I was wondering if anyone could let me know how to change the audit trail messages language on Factory Talk ME. I am currently working...
Replies
0
Views
453
Good morning, I have a project coming up that will require my HMI runtime to toggle from English to Spanish via selector switch. What is the...
Replies
0
Views
449
So I am sure many of you have run into this problem over the years. I know I have.... The customer has a machine that was built outside the...
Replies
14
Views
2,546
Back
Top Bottom