CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Calling super^() in extended SFC?
https://forum.codesys.com/viewtopic.php?f=11&t=8698
Page 1 of 1

Author:  somlioy [ Wed Mar 14, 2018 2:41 pm ]
Post subject:  Calling super^() in extended SFC?

Hello

I got two function blocks programmed in SFC where one extends the other.

How can I call SUPER^(); without placing it in every action-step?

Author:  jmintra [ Wed Mar 14, 2018 5:18 pm ]
Post subject:  Re: Calling super^() in extended SFC?

Hello,

I have FB_A and FB_B, and FB_B extends FB_A.

I call FB_B countinuosly from one task, but inside FB_B I have to write on his body super^() to get the base functionality of FB_A running.

Then When I call the FB_B methods from some point of the program, all the code is able to work.

Question is, maybe there is another way to achieve this without access the super pointer.

Someone know another way ?

Thanks.

Author:  rickj [ Thu Mar 15, 2018 2:30 pm ]
Post subject:  Re: Calling super^() in extended SFC?

Quote:
I have to write on his body super^() to get the base functionality of FB_A running.

Put the desired functionality into a FB_A method, which is inherited by FB_B. Then simply call the method, from FB_B. No need for ^super.

Author:  jmintra [ Thu Mar 15, 2018 2:54 pm ]
Post subject:  Re: Calling super^() in extended SFC?

Yes, but what if the funtionality needs more than one scan cycle ? most of the time you need call another FBs and need several cycles.

My point is, seems that, on the contrary of OOP standar languages, in Codesys you have to call explicitly super function to execute the base code.

Author:  Josep M. Rams [ Thu Mar 15, 2018 9:59 pm ]
Post subject:  Re: Calling super^() in extended SFC?

Hi. Somlioy.

Create in extended fb an action where you will implements the sfc.

From the main program you can call the action with the grafcet, super, and any other action you want run parallel to sfc.

Be healty!

Author:  somlioy [ Thu Mar 15, 2018 11:46 pm ]
Post subject:  Re: Calling super^() in extended SFC?

I'm not quite sure I understand what you mean.

To clarify I have two fbs; FB_A and FB_B, both programmed with SFC where FB_B extends FB_A,
and I need to have FB_A running cyclically.

Do you mean I should create an action in FB_A with SUPER^() as content, and run that action in main program?

Author:  Josep M. Rams [ Fri Mar 16, 2018 7:22 am ]
Post subject:  Re: Calling super^() in extended SFC?

Hi.

Not.

Fb extends from Fa. And Fb will be programed in st.

Create in Fb an action to be programed in sfc mode.

From the main of fb call super^() and call his sfcAction...

Author:  somlioy [ Fri Mar 16, 2018 4:32 pm ]
Post subject:  Re: Calling super^() in extended SFC?

Oh I see.
Thought it didnt work with SFC in actions but turned out that's only the case if the fb is programmed in sfc.

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/