Building generic function blocks

8 views
Skip to first unread message

recob...@hotmail.com

unread,
Mar 6, 2009, 4:00:57 AM3/6/09
to FBDK
Dear Dr James,

We have managed to make the function block work with a sample tank
application.
Till now we have made a lot of modifications within the Service
Interface Function Block programme to enable the SIFB call the .dll
file. However, we are not sure whether we are doing it in a right
way.
My question is that, is it possible to leave the SIFB (say SIFB_1)
programme as it was, but to build another SIFB (say SIFB_2) or even
normal function block that can call SIFB_1 to make the hardware work.
We want to design in such a way that SIFB_1 is a generic SIFB that
contain every function of the hardware, while SIFB_2 is a customized
SIFB that can enable some specific functions that we want to use on
the hardware. If it is possible, we shall simply build different
versions of SIFB_2 instead of modifying SIFB_1 every time.
I am looking foward to your reply. Many thanks!

Best Regards

Jim Christensen

unread,
Mar 6, 2009, 9:15:39 AM3/6/09
to FBDK
Sure, just build SIFB_2 as a composite function block type containing
an instance of SIFB_1 type. Then give SIFB_2 just the event and data
inputs that you need for the particular function and connect them to
the appropriate internal SIFB_1 inputs and outputs, and set the
parameters of the internal SIFB_1 instance to implement just the
function that you want. You can even include some signal processing as
necessary to condition the inputs or process the outputs of SIFB_1,
using the available library FBs.

This is assuming, of course, that your implementation supports
multiple instances of SIFB_1. If you have a set of common services
that must be initialized only once, you will have to associate them
with a static variable of the SIFB_1 class and share them among all
instances, checking to see if they have already been initialized when
you process the INIT event of each instance.

Best regards,
Jim Christensen

recob...@hotmail.com

unread,
Mar 9, 2009, 9:16:23 PM3/9/09
to FBDK
Dear Dr James,

Thank you for your reply.
Now we are considering building such a composite function block. Could
you please provide or suggest us some source code for building
composite function blocks that we can refer to?
Many thanks.

Best Regards

On Mar 6, 10:15 pm, Jim Christensen <james.h.christen...@gmail.com>
wrote:
> > Best Regards- Hide quoted text -
>
> - Show quoted text -

Jim Christensen

unread,
Mar 10, 2009, 9:45:42 AM3/10/09
to FBDK
Click on the "How To..." link under the FBEditor's Help menu, then
click on the "Composite FBs" button when the How To page opens in your
browser.

The same information is online at http://www.holobloc.com/doc/fbdk/howto.htm
.

Best regardsm
Jim Christensen

recob...@hotmail.com

unread,
Apr 1, 2009, 12:43:06 AM4/1/09
to FBDK
Dear Dr James,

We are trying to build such SIFB now.

Currently I am reading the book "IEC 61499 Function Blocks for
Embedded and Distributed Control Systems Design". The book mentioned
that it is normal method to put in code in last part of
ServiceInterface.java for service_INIT, service_REQ and service_RSP.
For our purpose, is it possible to leave all these areas blank in
ServiceInterface.java and move corresponding algorithms to the
function block that link to the generic SIFB (SIFB_1)?

Best Regards

On Mar 10, 9:45 pm, Jim Christensen <james.h.christen...@gmail.com>
wrote:
> Click on the "How To..." link under the FBEditor's Help menu, then
> click on the "Composite FBs" button when the How To page opens in your
> browser.
>
> The same information is online athttp://www.holobloc.com/doc/fbdk/howto.htm
> > > - Show quoted text -- Hide quoted text -

Jim Christensen

unread,
Apr 1, 2009, 11:07:16 AM4/1/09
to FBDK
I've received additional information as noted below; the file
attachment is in this group's files as SIFB.bmp.

This looks like a possible application for Adapter interfaces. Do
other members of the group wish to comment or supply examples?

- Jim C

=====Message sent with SIFB.bmp file=======
Dear Dr James,

Here I attached a picture to explain our idea.

SIFB_1 is a generic SIFB that provided by FBDK and we want to leave it
untouched. TANK is a SIFB that link to SIFB_1. Basically TANK SIFB is
build for TANK application and can be modified to fulfill requirement
for other applications. These two SIFB constitute a composite function
block that can link to the actual TANK application system. In order to
do this, we may need to move all the service_INIT, service_REQ and
service_RSP code into TANK SIFB algorithm.

However we are still wondering whether this kind of design is feasible
or not and therefore want to seek help from you.

Best Regards

===========================================

recob...@hotmail.com

unread,
Apr 20, 2009, 10:37:58 PM4/20/09
to FBDK
Dear Dr James,

We have managed to make a basic function block call system.load
function to load a .dll file.

Now we are trying to add in more statement but it seems that the basic
function block does not allow us to define variables inside REQ
algorithm. Basically we create a user defined basic function block and
edit the REQ code. Could you please provide us some coding to define
new variables inside REQ or we are not able to define new variables
inside REQ? Many thanks.

Best Regards

On Apr 1, 11:07 pm, Jim Christensen <james.h.christen...@gmail.com>

Jim Christensen

unread,
Apr 22, 2009, 11:19:58 AM4/22/09
to FBDK
If you want to define *local* variables *inside* the REQ algorithm,
you can do that in the normal way with Java code in the REQ algorithm
(assuming that you have chosen "Java" as the programming language for
the algorithm). For instance,

String someString = "FOO";

If you want to define internal instance variables that are accessible
to other methods in the class, you should do that using the New ==>
Variable ==> Internal popup menu on the FB. Then you access the
contents of the variable in Java using the ".value" field. For
instance if you declare a variable SOME_STRING of IEC 61131-3 type
WSTRING, then you can do things in Java like:

String someString = SOME_STRING.value;
SOME_STRING.value = someString + " another string";

Another example: if you declare SOME_DINT of type DINT, then in Java
you can do stuff like:

DINT.value += 2;

Best regards,
Jim Chriatensen
Reply all
Reply to author
Forward
0 new messages