NOP0 / rustmatic

PLC programming in Rust!
Apache License 2.0
35 stars 2 forks source link

Should Process be Task? #18

Open NOP0 opened 4 years ago

NOP0 commented 4 years ago

I know this is a bit nitpicking, but on the other hand I guess this is the time if it should be changed. Just wondering if the Process in the runtime should be called Task in order to align with 61131? See link.

61131-3 software model

NOP0 commented 4 years ago

From diagram in the link, it might even be that Process = Program. I guess Runtime::poll() might be thought of as the "cyclic" task? Maybe

NOP0 commented 4 years ago

Here's an example Configuration

Configuration MyConfig
    Resource MyCPU
        Task MyTask(Interval t#100ms);
        Program MyProgram WITH MyTask: PlcMain.entry_point();
    End_Resource;
End_Configuration;
Michael-F-Bryan commented 4 years ago

That's a nice link! We're definitely going to need it when executing IEC programs and implementing our "compiler" (compiler in the sense that it takes in source code and turns it into something that is executable, whether that is x86 machine code or WASM or custom bytecode, or whatever).

Do you think we'll want to incorporate the IEC 61131-3 software model into how the runtime is designed? Or should it just be a "user-space" thing and our compiler generates all the necessary processes/tasks/programs and makes sure they are set up and communicate using whatever mechanism is provided by the runtime?

NOP0 commented 4 years ago

Do you think we'll want to incorporate the IEC 61131-3 software model into how the runtime is > > designed?

Good question and remarks. When I think about it now, one might argue that we should not call processes programs, because program is an IEC definition that comes with some certain expectations regarding behavior etc., that we might not want to be bound by in the runtime?