# openCN-New PLC addition - user space file path

**URL:** <http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405>\
**Category:** OpenCN Framework\
**Created:** [August 15, 2023, 3:40pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405 "2023-08-15T15:40:06Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 15, 2023, 3:40pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/1 "2023-08-15T15:40:06Z")

</div>

Hi, I was referring this document to understand each and every component of openCN:  
[https://mecatronyx.gitlab.io/opencnc/opencn/components/plc/plc.html#new-plc-creation](https://mecatronyx.gitlab.io/opencnc/opencn/components/plc/plc.html#new-plc-creation)

While i was going to the documentation of I cam across adding a new PLC component in openCN.

The path mentioned in the document to add a new PLC component in user space is → Inserted the new `plc` in the `supported_cfg` array (`usr/target/include/components/plc/plc.c` file).

- I cannot find the file at this given path

- I found another file at below path with same name  
usr/target/components/plc/plc.c

It took me a lot of time to find the file manually. If someone can confirm this is same file then i can keep a note of this and we can later update in the document.

Regards  
NRK

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [August 16, 2023, 7:21am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/2 "2023-08-16T07:21:46Z")

</div>

Hi Nadim,

You’re right. The correct path is `usr/target/components/plc/plc.c`

Thanks to point it out.

Have a nice day  
J-P

---

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 18, 2023, 11:45am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/3 "2023-08-18T11:45:53Z")

</div>

Hi @jmi

While i was going through the documentations of PLC, further I could not find anywhere so have a question

whether the PLC runs on realtime CPU#1 or non realtime CPUs?

In linux cnc there is a plc ladder programming tool, can we plan of making similar kind of functionality in openCN for user programmable logic? [Classicladder Programming](http://linuxcnc.org/docs/2.5/html/ladder/classic_ladder.html#_classic_ladder_gui)

Since I am studying openCN and once I understand it i would also like to contribute to feature additions in openCN.

Regards  
NRK

---

<div class="post-metadata">

**Author:** ![Raoul](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/raoul/32/21_2.png) [@Raoul](http://discourse.heig-vd.ch/u/Raoul)\
**Post date:** [August 18, 2023, 2:04pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/4 "2023-08-18T14:04:17Z")

</div>

Hi Nadim,

it would indeed be very useful having a PLC component in OpenCN.  
I believe the “PLC ladder” tool in LinuxCNC is old-fashioned and should be replaced by something newer with a graphical user interface.

I know that there are existing opensource PLC proojects in Linux.  
We should evaluate and look what efforts are needed to integrate in OpenCN.

In my opinion this is a BIG project for the future, but I encourage you to do so.

best regards,

Raoul

---

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 18, 2023, 2:21pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/5 "2023-08-18T14:21:28Z")

</div>

Hi @Raoul ,

Thanks for the encouragement. Yes indeed the PLC Ladder tool is very old fashioned.

Since I have worked many years on PLC systems, I will compile a list of basic functionalities present in PLC system which are needed by user. I will also compile a with a list of open source PLC projects.  
We should add those functionalities step by step. I will comeup with a document for suggestions from forum users.

Since I am a learning developer, Big projects will only help me learn and contribute.

Regards  
NRK

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [August 18, 2023, 2:37pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/6 "2023-08-18T14:37:16Z")

</div>

Hi Nadim,

The PLC component is a standard _OpenCN_ component. Its functionality runs in RT CPU.

Yes, having support for real PLC apps will be great and any help on this topic will be appreciated.

As Raoul said it is a big project and then to be well specified before starting its implementation/integration.

Regards  
J-P

---

<div class="post-metadata">

**Author:** ![Raoul](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/raoul/32/21_2.png) [@Raoul](http://discourse.heig-vd.ch/u/Raoul)\
**Post date:** [August 18, 2023, 2:55pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/7 "2023-08-18T14:55:22Z")

</div>

Hi J-P and Nadim,

for me it’s not so clear if we really need RT CPU (kernel space) for PLC.  
Typically we are talking about maybe 100 Hz refresh rate.

Our EtherCAT Master needs of course hard real time and runs in kernel space.  
Maybe this is not necessary for PLC functionalities.

To be discussed …

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [August 18, 2023, 3:02pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/8 "2023-08-18T15:02:18Z")

</div>

Hi Raoul,

The **current** PLC component is an _OpenCN_ component. So its functionality is implemented in a RT function.  
This component was created to put “not generic” code somewhere during Micro5 implementation as we have no real PLC support yet.

For the implementation, a full specification has to be made before implementation to deal with all PLC aspect. One of the question is “should PLC code runs in RT domain”.

J-P

---

<div class="post-metadata">

**Author:** ![Raoul](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/raoul/32/21_2.png) [@Raoul](http://discourse.heig-vd.ch/u/Raoul)\
**Post date:** [August 18, 2023, 3:51pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/9 "2023-08-18T15:51:50Z")

</div>

J-P, I fully agree with you !

---

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 19, 2023, 3:56am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/10 "2023-08-19T03:56:00Z")

</div>

Hi @Raoul and @jmi

A study can be done to try out the functionality in both Realtime and non realtime cpu one by one and note the significant differences practically.

As per my experience, I will prepare a document on full specification with also a point about RT domain or not.

Do we have a way to attach docs on this forum? How to share docs?

Regards  
NRK

---

<div class="post-metadata">

**Author:** ![Raoul](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/raoul/32/21_2.png) [@Raoul](http://discourse.heig-vd.ch/u/Raoul)\
**Post date:** [August 19, 2023, 5:56pm UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/11 "2023-08-19T17:56:23Z")

</div>

pdf files can be attached on this forum.  
But I believe that another solution would be better.  
@jmi : what do you suggest ?

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [August 22, 2023, 6:37am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/12 "2023-08-22T06:37:12Z")

</div>

Hi Nadim, Raoul,

I think it is better do make the spec in a Google doc. It is easier to work together this way.  
I will prepare a PLC folder where the doc and image (we use [draw.io](http://draw.io) generally) can be place.

Is it OK for you ?

Have a nice day  
J-P

---

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 22, 2023, 7:46am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/13 "2023-08-22T07:46:05Z")

</div>

Ok for me.

Thanks  
NRK

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [August 23, 2023, 6:35am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/14 "2023-08-23T06:35:35Z")

</div>

Perfect, can you share your google user name (or email) ?

Thanks  
J-P

---

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 23, 2023, 10:13am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/15 "2023-08-23T10:13:59Z")

</div>

My email id is  
[nadim4114@gmail.com](mailto:nadim4114@gmail.com)

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [August 23, 2023, 11:45am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/16 "2023-08-23T11:45:43Z")

</div>

I’ve sent you an initiation.

The folder contains empty Gdoc and [draw.io](http://draw.io) documents.

---

<div class="post-metadata">

**Author:** ![NRK](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@NRK](http://discourse.heig-vd.ch/u/NRK)\
**Post date:** [August 24, 2023, 1:17am UTC](http://discourse.heig-vd.ch/t/opencn-new-plc-addition-user-space-file-path/405/17 "2023-08-24T01:17:55Z")

</div>

Thanks @jmi ,

I have checked and put in some very basic details. Need details from openCN users to help segregatewhat all is available in openCN and what we have to work on. Later we can decide the roadmap.

I will prepare a [draw.io](http://draw.io) file about architecture soon and update you
