Click here to Skip to main content
Click here to Skip to main content
Go to top

RFID Motion

, 22 Jul 2008
Rate this:
Please Sign up or sign in to vote.
BizTalk RFID component to detect directional movement of tags.

Introduction

This article demonstrates a sample BizTalk RFID component to detect the direction in which RFID tags are moving.

Background

While developing RFID solutions for applications like inventory management and asset tracking, one of the most common requirements is to find the direction in which the tags are moving. I initially developed a simple component using the BizTalk RFID framework for one of my simple demos. That component used simple memory structures to track tag movement.

Then I started getting inquiries from the field asking for an out-of-the-box component to do this. I personally believe that an out-of-the-box component will not fit all commercial requirements. However, it will be interesting to demonstrate how to implement something like this. Hence, this new generic and almost "out-of-the-box" solution to detect directionality of tag movement.

Using the code

The component has the following parts:

  1. EventHandler DLL that can be added to an RFID process
  2. SQL script to create the necessary database structures
  3. Process XML to create and import a test process into RFID Manager
  4. Test scripts to simulate TagReadEvents and TagListEvents to test the component
  5. Sample tag XML files
  6. Source code for the component

The Tag Motion Status is maintained using the following enumerated values:

public enum TAG_STATUS
{
    Error = 0,
    MovedIn,
    MovedOut,
    MovingIn,
    MovingOut
}
public enum MOTION_STATUS
{
    Normal = 0,
    DirectionReversed,
    LocationSkipped,
    NotMoving
}

Tag Status tells you about the directional movement of the tag. Tag is Moving Out, Tag has Moved Out etc. Motion Status is like a special status that tells you about some special motion situations like Not Moving or Direction Reversed.

Some of you might be thinking that the enumeration structures must be swapped. Motion Status should be Tag Status and Tag Status must be Motion Status. Call me and I will explain (anideswandikar@hotmail.com).

Next will be the EventHandler parameters. Two important parameters are Motion Sequence and Motion Timeout. Motion Sequence is a semicolon separated string of DeviceName/SourceName structures. A combination of DeviceName/SourceName defines a unique location at which a tag could be detected and, hence, each combination must be unique in the string. The location sequence is defined by the position of the location key. For example, Device1/Source1;Device1/Source2;Device2/Source1 would translate into:

Location Key Location Sequence Number (Loc#)
Device1/Source1 0
Device1/Source2 1
Device2/Source1 2

So Tag moving from Loc#0 to Loc#1 will be marked as "Moving out", from Loc#1 to Loc#2 will be marked as "Moved out", and from Loc#2 to Loc#1 will be marked as "Moving In". If a tag jumps from Loc#0 to Loc#2, then it will be marked as "Moved Out" and "Location Skipped" and so on and so forth.

Motion Timeout parameter, if set to > 0, indicates that if a Tag is continuously detected at a particular location for more than the Timeout minutes specified in this parameter, then the tag will be marked as "Not Moving".

The Tag and Motion status are stored in a database table called "TagMotion". The script for creating this table along with other lookup tables is provided with the code under the SQL folder. Currently the lookup tables mock the hard-coded values of the enumerations in the EventHandler code. Given enough motivation, I will write a version where these enumerations can be configured using the database tables.

To test the component, run EventHandlerSampleSetup.cmd to setup a RFIDMotionTest process. Ensure that the RFIDMotionTest process is created and started in the RFID Manager. Then run EventHandlerSampleTagListEvents.cmd or EventHandlerSampleTagReadEvents.cmd depending on what event you wish to test. Open SQL Server Management Studio, select the database under which you created the TagMotion and other tables, and execute the following query:

SELECT <dbname>..tagmotion.Id,<dbname>..tagmotion.TagID,
<dbname>..tagmotion.LastLocDevice,
<dbname>..tagmotion.LastLocSource,
<dbname>..tagmotion.RecordTime,
<dbname>..tagstatusmaster.StatusDescription,
<dbname>..motionstatusmaster.StatusDescription 
  FROM <dbname>..tagmotion, <dbname>..motionstatusmaster, <dbname>..tagstatusmaster 
where 
<dbname>..tagstatusmaster.StatusCode = <dbname>..tagmotion.TagStatus and 
<dbname>..motionstatusmaster.StatusCode = <dbname>..tagmotion.MotionStatus

You will see the results showing the Tag Status and the Motion Status for every tag detected. The RFIDMotionTest application is attached to a logical device. If you have a physical device, then bind the logical device to the physical device for tracking real tags.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication

Share

About the Author

anideswandikar
Architect Microsoft
Asia/Pacific Region Asia/Pacific Region
I currently work as a Technology Architect at the Microsoft Technology Center, Bangalore. I head the Application Platform Practice at the MTC, which includes .Net Migration, .Net Adoption, BizTalk, BizTalk RFID and such.
 
Before working for Microsoft I worked for Netflix as a Senior Software Engineer.

Comments and Discussions

 
GeneralConnect To RFID Reader PinmemberMember 413081515-Oct-09 10:44 
GeneralRe: Connect To RFID Reader PinmemberJ imran20-Feb-10 21:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 22 Jul 2008
Article Copyright 2008 by anideswandikar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid