Implementing Algorithm

All questions related to the usage of Rifidi TagStreamer

Moderators: Matt, kyle, Moderators

mraman2006
Posts: 9
Joined: Sun Aug 23, 2009 9:42 am
Organization: AU

Implementing Algorithm

Post by mraman2006 » Sun Aug 23, 2009 9:45 am

Hi,

Can i implement my algorithm in RFID Tag Streamer?
If so how to implement it?


Regards,
Ramanathan M

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Implementing Algorithm

Post by kyle » Sun Aug 23, 2009 11:51 am

Ramanathan,

Tag Streamer was intended to allow some form of limited load testing of RFID middleware. Have you seen the information on our wiki at http://wiki.rifidi.org/index.php/Tag_St ... _Guide_1.1? Perhaps the best thing to look at is the Sample scenarios. If you have some questions in regards to that I can try to help you out.

Since we released Tag Streamer a couple of years ago, we have realized a more powerful way to do load testing would be to hook up a scripting engine to our emulation layer. We are currently using this internally and will hopefully be releasing this soon (within the next month or so). What we've done is to hook groovy (a scripting engine, something like Ruby) on top of our emulation layer so a developer can more easily write flexible scripts that emulate a complete scenario. The code for this is currently in our repository and you can run it from source if you are interested. Please let me know, and I can assist you on checking it out.

-Kyle

mraman2006
Posts: 9
Joined: Sun Aug 23, 2009 9:42 am
Organization: AU

Re: Implementing Algorithm

Post by mraman2006 » Mon Aug 24, 2009 11:32 am

I am much interested in knowing about it..
We are doing a project on it.
It would be better if we implement algorithm in RFID.
Can you explain me about the scripting engine...


Regards
Ramanathan M

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Implementing Algorithm

Post by kyle » Mon Aug 24, 2009 6:53 pm

Ramanathan,
After a large commit today, you should be able to run the scripting from source.

To be clear about our scripting engine: It allows you to define RFID scripts in groovy -- a scripting language that is something like ruby. You can do things like define a set of tags, create some virtual readers (alien, llrp, symbol, etc. Anything that our emulator supports), and add and remove the tags from the virtual reader. You can also set the GPI lines high and low, and test the GPO lines from the reader. This allows you to sort of make a "virtual RFID lab".

To run our code from source, you need to follow the instructions on this page: http://wiki.rifidi.org/index.php/Rifidi:Source_Code. When it comes time to check out projects from our external svn, check these projects out:
  • org.rifidi.binary
  • org.rifidi.emulator
  • org.rifidi.emulator.scripting.groovy.console
  • org.rifidi.emulator.target3.5
  • org.rifidi.log4j.developer
  • org.rifidi.ui.ide
After you have everything checked out, you should be able to run it by right clicking on "scripting.launch" in the scripting.groovy.console project, and selecting runAs->OSGi application.

Now everything should load up. You can load a script by typing 'loadscript [pathToScript]' into the console window in eclipse.

Here is an example script

Code: Select all

byte[] pass = [0x00, 0x00, 0x00, 0x00 ];
byte[] access = [0x00, 0x00, 0x00, 0x00 ];

tagSet = new HashSet();
tagSet.add(readerManager.createGen2Class1Tag((byte[])[53, -24, -98, -23, -7, -67, 93, 53, 5, 43, 58, 115],pass,access));
tagSet.add(readerManager.createGen2Class1Tag((byte[])[53, 98, -102, -105, -79, 81, 55, -29, 100, 12, 113, 118],pass,access));
tagSet.add(readerManager.createGen2Class1Tag((byte[])[53, -73, 8, 85, -64, -65, 88, 119, 7, 2, 53, 38],pass,access));
tagSet.add(readerManager.createGen2Class1Tag((byte[])[53, 85, -57, 38, -7, 101, 95, 86, 74, 102, 36, 11],pass,access));
tagSet.add(readerManager.createGen2Class1Tag((byte[])[53, 109, -86, 39, -4, 84, -111, 46, -115, -123, 54, 44],pass,access));
tagSet.add(readerManager.createGen2Class1Tag((byte[])[53, -102, -23, 53, 121, -89, -62, 60, -13, 26, 57, 40],pass,access));


properties = readerManager.getDefault("AlienALR9800");
properties.setReaderName("alien1");
properties.setProperty("inet_address","127.0.0.1:30000");
readerName = readerManager.createReader(properties);
readerManager.start(readerName);

Thread.start{
	while(true){
			readerManager.addTags(readerName,0,tagSet);
			sleep(1000);
			readerManager.removeTags(readerName,0,tagSet);
			sleep(1000);
		};
};
This script basically creates a few tags, creates a new virtual alien reader with an IP address of 127.0.0.1:3000, and cycles through adding the tag, waiting a second, removing the tags, waiting a second.

Since this is really new, we don't have any documentation yet, so that will be coming soon on our wiki. In the meantime, you can look at a few classes to help you get a better idea of what you can do: ReaderManager in the org.rifidi.emulator project (you will need to check this one out) has methods in it that let you control readers. GeneralReaderPropertyHolder in org.rifidi.emulator project will allow you to define parameters when creating readers. Finally the methods that start with an underscore in GroovyConsole are commands that you can type into the console (such as loadscript). Finally, you may find it useful to adjust the debug output using the log4j.properties file in org.rifidi.log4j.developer.

I know this is alot of information. Hopefully we will have some better examples soon.

mraman2006
Posts: 9
Joined: Sun Aug 23, 2009 9:42 am
Organization: AU

Re: Implementing Algorithm

Post by mraman2006 » Sun Sep 20, 2009 1:34 pm

Hi,

I got this error while checking out org.rifidi.emulator.scripting.groovy.console

RA layer request failed
svn: OPTIONS of 'https://svn.rifidi.org/svn/rep-external ... ing.launch': could not connect to server (https://svn.rifidi.org)

I didn't get the option run as when i right click on the scripting.launch 1107 file in org.rifidi.emulator.scripting.groovy.console.

What to do? Help me out..

Regards,
Ramanathan M

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Implementing Algorithm

Post by kyle » Wed Sep 23, 2009 1:49 pm

I don't know why this happens. Sometimes, the subclipse plugin messes up, and you have to check out the project again. Also, are you sure you have the eclipse for plug-in developers? You also need to make sure that you are following all the instructions on that page, including clicking the set target platform button.

mraman2006
Posts: 9
Joined: Sun Aug 23, 2009 9:42 am
Organization: AU

Re: Implementing Algorithm

Post by mraman2006 » Sun Oct 04, 2009 1:20 pm

kyle,

I am happy to see the console at last.

osgi> loadscript d:\first.txt

I gave this command. But not able to see the output. I pasted the example contents into file first.txt.
When i typed help, i was not able to see the loadscript command in it..
What has to be done?


Regards,
Ramanathan M

kyle
Posts: 220
Joined: Tue Apr 22, 2008 10:12 pm
Name: Kyle
Organization: Pramari
Location: Hartford, CT
Contact:

Re: Implementing Algorithm

Post by kyle » Sun Oct 04, 2009 1:54 pm

Ramanathan,
I think the command is there, but may not have an entry in the help menu yet. If you want to see if the groovy script is really working, try making a groovy script like this:

Code: Select all

println 'Hello World!'
Now run that. If that prints, groovy (and the loadscript command) is working. Now the next thing is to actually write a script that will allow you to simulate RFID. The object to use is ReaderManager. If you look at the methods for that interface, you will see how to script rfid scenarios using Rifidi (for example, getDefault, addTags, removeTags, start, stop, etc.). I'm sorry none of this is documented yet, it's just so new.
-Kyle

mraman2006
Posts: 9
Joined: Sun Aug 23, 2009 9:42 am
Organization: AU

Re: Implementing Algorithm

Post by mraman2006 » Mon Oct 05, 2009 10:22 pm

I pasted the following line in a text file:

println 'Hello World !!'

in the command prompt: loadscript d:\sample.txt

this lists out all the commands, the case when i type a wrong command.

What to do?


Regards,
Ramanathan M

mraman2006
Posts: 9
Joined: Sun Aug 23, 2009 9:42 am
Organization: AU

Re: Implementing Algorithm

Post by mraman2006 » Mon Oct 05, 2009 10:29 pm

exec loadscript d:\sample.txt

has shown some error. I think the command is working.. How will be the output...

Will the output be shown in the terminal itself or else i need to start the rifidi tag streamer exe.


Regards,
Ramanathan M

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests