User Manual, Developers Guide and API Documentation

Example for How to Build a FunctionalUnit

How to build a FunctionalUnit in Winprost

In order to be used by Winprost your functionalUnit or FU should be added in $TESTBED/modules/dll/WinProSt--main--0.2/pyconfigParser/winprost/Layer2.py Then it has to be created and connected with the other FU's, for example in the buildFUN() :
 newFunctionalUnit = Node( 'NewFunctionalUnit', self.newFunctionalUnit)
Then in .fuNet.setFunctionalUnits() your functionalUnit needs to be added:
 crc,
 newFunctionalUnit,
 lowerSAR,
and connected :
 crc.connect(newFunctionalUnit)
 newFunctionalUnit.connect(lowerSAR)
 lowerSAR.connect(padding)

Here the CRC-FU is connected with your newly created functionalUnit, which after that is connected to the lowerSAR-FU Also this lines schould exist:

 #
 # NewFunctionalUnit
 #
 newFunctionalUnit = wns.ldk.NewFunctionalUnit.NewFunctionalUnit()

The implementation of fun::FUN can be found in $TESTBED/wns/libwns--main--1.0/src/ldk/funFUN.cpp. Where one can find out how fun::FUN works, what kind of methods it has and so on.

For your help you can use $TESTBED/wns/libwns--main--1.0/src/ldk/NewFunctionalUnit/NewFunctionalUnit.cpp as a template to create your FunctionalUnit. After that you can create your *.cpp and *.hpp files and also the tests for them. You should include them in the namespace wns::ldk because in this way it can be used by any module.

As a template for the tests you can use $TESTBED/wns/libwns--main--1.0/src/ldk/NewFunctionalUnit/tests/NewFunctionalUnitTest.cpp. But there are some important things to be added like in NewFunctionalUnitTest::testUplink(), where you should add these line :

 newFU->activateCommand(compound->getCommandPool());
and thus activate the command in order to use it, e.g. write in it. All this is needed, because the commands are activated automatically only when a top FU wants to use them. When a compound comes from another fun::FUN the commands are not activated automatically.

For compiling first use the command ./playground.py --install=dbg This has to be written in order to create the so called sandbox. Then with Scons you can compile faster. In the file $TESTBED/wns/libwns--main--1.0/config/libfiles.py all the files that need to be compiled have to be checked in.

Everything that you need for the tests is in $TESTBED/tests/unitTests. For a final you have to made $TESTBED/wns/libwns--main--1.0/pyconfigParser/wns/NewFunctionalUnit.py which all in all contains the following important lines:

  __plugin__ =
 "wns.ldk.NewFunctionalUnit" name = "NewFunctionalUnit"
This is your configuration file.

Enjoy!!


Generated on Wed Feb 8 03:32:25 2012 for openWNS by  doxygen 1.5.5