Sign in to follow this  
Followers 0
Hoobs

NJ function blocks like PIDAT reentrant?

3 posts in this topic

NJ501-1300, with a pile of TS3101 analog input modules and OD5256 digital output modules.

First, a general question: Are NJ function blocks reentrant as a rule?  No?  Sometimes?

Second, a specific question:  I am setting up this NJ-based system to perform multiple (42, for now) temperature control loops.  Each control loop must obviously be able to run independently.  As I am intending to use the PIDAT function block to handle PID duties, it raises a question: Is the PIDAT function block reentrant?  If so, how would it keep track of different sets of PID coefficients, and everything else it would need to keep multiple invocations straight?  I don't see how it can do this, but maybe I'm missing something.

My current belief is that it doesn't do this, and that I will need one instance of PIDAT for each control loop, i.e., 42 instances, with distinct sets of variables for each one.  Is this correct?

Thanks!
--Hoobs

Share this post


Link to post
Share on other sites

PIDAT is a function block.  Each time that you create a new instance of a FB, a chunk of memory is carved out that is specific to that instance of the FB.  It is necessary to create a separate instance of the PIDAT FB for each of your loops.  Function blocks (as a general statement) require a unique instance each time that you add a function block in order for the function block to work properly.  Functions on the other hand reuse the same memory over and over and do not have instance names.  

In the toolbox in Sysmac Studio, Functions are indicated by a small icon with an 'F' in it and Function blocks say 'FB'.

Share this post


Link to post
Share on other sites

Perfect, that's what I believed looking at the docs, thanks!  It's not a problem, as I can keep all my fb_PIDATxx instances in an array indexed by loop number, so they are easy to get to.

Al

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0