Difference between revisions of "Best Practice for Designing a Rifidi APP"

From RifidiWiki

Jump to: navigation, search
(Created page with "''Example: Northwind''' Congratulations! You are the proud new founder of Northwind Shipping Inc. -- "delivering packages faster than a caffeinated lightning bug"™. One of...")
 
(Design)
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
''Example: Northwind'''
 
  
Congratulations! You are the proud new founder of Northwind Shipping Inc. -- "delivering packages faster than a caffeinated lightning bug"™. One of your core business strategies is to out perform your competitor -- Pony Express Shipping Inc. -- by capitalizing on increased efficiencies gained by your innovative use of technology. You have heard all the hype about RFID and want to employ in it your new, state-of-the-art distribution center. You have decided to use the Rifidi Edge Server to run the RFID applications you will need in your distribution center.  This tutorial will show you how to set up an application and use all the various features provided by the Rifidi Edge application API. 
+
Here is an overview on the best practices for How to Approach designing a Rifidi Application
  
==Northwind Business Rules==
+
==The Goal==
The Northwind distribution center's current process looks like this: 
+
First ask your self what is the goal of the application such as automation of a business process, increased productivity/efficiency, tracability of an asset, security, visibility into the supply chain etc..
* 1. Boxes (fitted with RFID tags) are loaded onto a pallet, which are transported via forklift (also outfitted with RFID tags) to a dock door. From the dock door, an inventory is taken. 
+
* 2. The forklift will then take the packages to a weigh station, where the packages would be weighed. 
+
* 3. After the weigh station, the packages would be sent out for shipping.   RFID can add value to this workflow by monitoring whenever a tag enters or leaves an area (either the dock door or the weigh station), and do extra processing based on what happens when it enters and leaves an area.
+
  
A message should be printed when...
 
* 1. a tag enters or leaves an area. 
 
* 2. a tag moves from the dock door to the weigh station. 
 
* 3. tags are seen with their forklift tag.
 
  
Occasionally, something can go wrong and an item will do something unexpected. Error messages should be printed if...
 
* 1. Tags move from the weigh station to the dock door, stating that the tag moved backwards.
 
* 2. Tags are seen on the weigh station which was not seen at the dock door. 
 
* 3. Item tags are seen without an accompanying forklift tag.   
 
  
More documentation on how this was accomplished is given in the Esper documentation, as well as the
+
==Problems to be solved==
 +
Once you have a clearer understanding of the Goal then ask your self what problems are you looking to solve such as Asset Tracking, Inventory Control, Inventory Management, Automation of a business process through sensors/RFID, Work in Progress (WIP). Defnitions of these can be found in the business solutions offered by Transcends using the Rifidi Platform [http://www.transcends.co/solutions/business-solutions Transcends Sensor Business Solutions]
  
==Setting up and running the Northwind Example==
+
==Setup==
* 1. Set up the eclipse workspace and import the SDK. 
+
* Ensure you have setup your Rifidi development environment - [[Edge_Server_Development_Environment | Edge_Server_Development_Environment]]
* 2. Import the plugin from the “examples” directory in the SDK plugin. 
+
* 3. Go to Run > Run Configurations and click on “Edge Server” under “OSGi Framework” on the left.
+
* 4. Select the package “org.rifidi.edge.northwind” in the “bundles” tab.  Press “Apply”. Now either close and run the “Edge Server” launch framework or just press “run”. 
+
* 5. Type in “apps” and make sure the Northwind Application has started.  
+
  
If you don't see the Northwind app at all, make sure the plugin is set to Auto-Start in the run configuration.  If you see it but it is stopped, you will have to manually start it.  Check the Applications section of the documentation for more help debugging problems starting applications.    After you know the application is working, stop the edge server and open the org.rifidi.edge.northwind plugin.  Copy the “Northwind” folder and paste it into the “Rifidi-SDK/RifidiHome/applications” folder.  Then open the folder, and open the “Northwind.properties” file.  This shows all of the properties that can be adjusted for this application (see the application documentation for more on the properties files).  You might need to adjust the names of the readers for the dock door and weigh station, depending on what the names of the readers are in Rifidi Edge.  A more thorough explanation of each of the properties is in the file itself.  The properties files for both the dock door and weigh station ReadZones are also in this folder.   
+
==Design==
After the properties files are set up correctly, run the program and create the readers you want to use.  If you want, you can use the included Prototyper file with an already set up dock door reader (127.0.0.1:20000), and an already set up weigh station reader (127.0.0.1:30000).  If you like, you can use any physical readers you have access to, or you can use Emulator to create the readers of your choice and then use edge to connect to them.    After you have connected to the readers set in the Northwind properties file, you can begin adding and removing tags from the field of view of the readers.  Here is a sample of what you can do: 
+
  
* 1. Create 1 GID tag and 2 SSCC tags (this assumes that the “ForkliftPrefix” property is set to the default “35”). 
 
* 2. As a group, move all 3 tags into the field of view of the Dock Door reader.  You should see 3 “tag arrived” messages for the dock door, plus a message telling you that a forklift was seen with the other tags.
 
* 3. Delete all the tags from the field of view.  You should get 3 “tag departed” messages for the dock door. 
 
* 4. Move the same 3 tags onto the weigh station reader.  You should see 3 “tag arrived” events for the weigh station, as well as 3 events telling you that the tags have moved from the dock door to the weigh station.  You should also get output telling you that a forklift was seen.    This is only one example of what you can do; only some of the rules were used for it.  Invoking the rules given above on your own, as well as studying the Esper used to create these rules will help you greatly when you are writing your own application.     
 
  
==Northwind Application Architecture ==
+
*Design Framework Overview
The Northwind application contains three parts: 
+
* 1. The application class: NorthwindApp.java is where the program is set up, and all of the logic is implemented.  Setting up the ReadZones, Subscribers, properties, and Esper all happens in this class. Check out the file itself for a more detailed explanation of how the application works. 
+
* 2. The event classes:  These are simply shell classes that are created to be passed into Esper.  They contain no information except for the ID of the tag that they represent, but any events you make can contain any information. 
+
* 3. The subscriber classes: These classes represent two different kinds of subscriber: one is a regular ReadZoneSubscriber, which will subscribe to ReadZones that we create and fire events based on certain criteria.  The other is a StableSetSubscriber that will look for forklift tags and print output depending if a forklift is present when tags are read.  For more information on how these classes work, check their respective files.
+
  
The Northwind files themselves are well-commented, and should help you get a better understanding of how applications are built and runOther application plugins, such as the diagnostic tools (org.rifidi.edge.app.diag) should give you more examples of what you can do with applications, should you need more examples. Finally, if you need any more help with your application, go to our forums:http://forums.rifidi.net/viewforum.php?f=35
+
**Application properties are used to set Global (for a application group) and Application specific prioperties such as timeouts, database connection strings etc..
 +
**Applications use reader zones - Defined in readzone - proeprties file
 +
**Read zone properties map to one to many readers in rifidi.xml
 +
**Readers in defined rifidi.xml (or using workbench UI) map to the physical reader/sensor(s)
 +
 
 +
*What Hardware (readers and sensors) are you looking to use?
 +
**Do these sensors come out of the box with Rifidi? (LLRP, Motorola, Impinj, Alien, ThingMagic, CSL, Thinkify, any handheld vis Generic Reader Adapter, Opticon Bar Code)
 +
***Yes - Follow the user's guide [[User%27s_Guide]] and/or [http://www.transcends.co/www/docs/Rifidi_Edge_Server_Quick_Start_Guide_2.1.pdf quick start guide ] the sensor/reader adapter can be configured to start reading
 +
***No - One can be developed using the Sensor API - [[How_to_create_a_sensor_plugin | How_to_create_a_sensor_plugin ]] - Also refer to existing sensor adapter source code as examples
 +
*The Application Design - Basically a Rifidi APP has access to any configured sensor/reader
 +
**1 What are you integrating with? (Such as MySQL database, Messaging Queue, ERP/CRM system via WebServices, Cloud/AWS)
 +
***Example Jumpstart Rifidi Applications for those integrations mentioned can be found here [[Development_Jumpstarts | Rifidi APP Jumpstarts]]
 +
**2 Are there any library's being used NOT included by default in Rifidi? (such as database drivers (MYSQL is provided by default), cloud drivers etc..) [[Adding_Third_Party_Libraries | How to Add Third_Party_Libraries]]
 +
**3 What are the sensor business rules such as asset have arrived/departed, a group of tags have been identified, which asset is seen based on signal (RSSI) strength  - An example application for capturing which a asset arrived can be found in the [[HelloWorld_App_Jumpstart | HelloWorld Application]].
 +
***Are the business rules out of the box via Rifidi Services?
 +
***Yes - A list of out of the box Rifidi Services addressing these design challenges can be found in the [[Developer%27s_Guide | Developer's guide] or [[Rifidi_Services_Jumpstart]]
 +
***No - A custom business rule can be developed using Esper (Esper is a trademark of EsperTech Inc) An example of custom Esper to create a work in progress business rule can be found in the [[Northwind_Example_Application_-_Advanced_Development_Topic | Northwind Example Application]] - Note: A more advanced topic once familiar with developing a basic application such as [[HelloWorld_App_Jumpstart | HelloWorld Application]].
 +
**4 Define the read zones required  - This defines the relations the readers/sensors have to each other within the application such as 1 to 1 relationship, 1 to many, many to 1 (Note The readzone configurations also support regular expressions in the event you use a naming convention when defining read adapters to potentially represent relationships - How to define readzones can be found in the [[Developer%27s_Guide | Developer's guide]] Note: The serviceid for a given reader factory adapter instance in the rifidi.xml is used to map to a readerID in teh readzone property files
 +
 
 +
**5 Are there any application properties required? Such as database parameters, Queue Names, Webservice Endpoints/URL, Rifidi services parameters (timeouts, thresholds) -Note: All teh Rifidi Jumpstart Applications provide examples on how these are defined and used within an application
 +
 
 +
==Other Topics (Monitoring/Logging/Management/Deployment)==
 +
* Is there a need to Dynamically/Remotely manage the Edge Server such as stopping/starting sessions, configuring sensors, managing applications etc.. A list of how to use these Edge management services can be found [[Edge_Management | Edge Management]]
 +
* Is there a need to Monitor the Edge Server such as JVM, Configured Readers/Sensors, OSGI, Applications (anything exposed via JMX). A list of how to use these Edge management services can be found [[Edge_Monitoring | Edge Monitoring]]
 +
* Any additional logging needs can be configured here [[Use_org.rifidi.logging | Rifidi Logging Configuration]]
 +
* Any changes to Edger Server configuration such as changing default port, RMI, production mode [[Edge_Server_Configuration | Edge_Server_Configuration]]
 +
* Are there any OSGI Bundles you need to add to Edge Server required by your application? such as the Oracle database driver [[How_to_add_OSGI_Bundles| How_to_add_OSGI_Bundles]]
 +
* Performance Tuning Tips [[Performance_Tuning_Tips |Performance_Tuning_Tips]]
 +
* Complete steps to export and deploy a app you designed/developed [[How_to_export_your_custom_Rifidi_application| How_to_export_your_custom_Rifidi_application]]

Latest revision as of 18:45, 5 September 2014

Here is an overview on the best practices for How to Approach designing a Rifidi Application

The Goal

First ask your self what is the goal of the application such as automation of a business process, increased productivity/efficiency, tracability of an asset, security, visibility into the supply chain etc..


Problems to be solved

Once you have a clearer understanding of the Goal then ask your self what problems are you looking to solve such as Asset Tracking, Inventory Control, Inventory Management, Automation of a business process through sensors/RFID, Work in Progress (WIP). Defnitions of these can be found in the business solutions offered by Transcends using the Rifidi Platform Transcends Sensor Business Solutions

Setup

Design

  • Design Framework Overview
    • Application properties are used to set Global (for a application group) and Application specific prioperties such as timeouts, database connection strings etc..
    • Applications use reader zones - Defined in readzone - proeprties file
    • Read zone properties map to one to many readers in rifidi.xml
    • Readers in defined rifidi.xml (or using workbench UI) map to the physical reader/sensor(s)
  • What Hardware (readers and sensors) are you looking to use?
    • Do these sensors come out of the box with Rifidi? (LLRP, Motorola, Impinj, Alien, ThingMagic, CSL, Thinkify, any handheld vis Generic Reader Adapter, Opticon Bar Code)
  • The Application Design - Basically a Rifidi APP has access to any configured sensor/reader
    • 1 What are you integrating with? (Such as MySQL database, Messaging Queue, ERP/CRM system via WebServices, Cloud/AWS)
      • Example Jumpstart Rifidi Applications for those integrations mentioned can be found here Rifidi APP Jumpstarts
    • 2 Are there any library's being used NOT included by default in Rifidi? (such as database drivers (MYSQL is provided by default), cloud drivers etc..) How to Add Third_Party_Libraries
    • 3 What are the sensor business rules such as asset have arrived/departed, a group of tags have been identified, which asset is seen based on signal (RSSI) strength - An example application for capturing which a asset arrived can be found in the HelloWorld Application.
      • Are the business rules out of the box via Rifidi Services?
      • Yes - A list of out of the box Rifidi Services addressing these design challenges can be found in the [[Developer's_Guide | Developer's guide] or Rifidi_Services_Jumpstart
      • No - A custom business rule can be developed using Esper (Esper is a trademark of EsperTech Inc) An example of custom Esper to create a work in progress business rule can be found in the Northwind Example Application - Note: A more advanced topic once familiar with developing a basic application such as HelloWorld Application.
    • 4 Define the read zones required - This defines the relations the readers/sensors have to each other within the application such as 1 to 1 relationship, 1 to many, many to 1 (Note The readzone configurations also support regular expressions in the event you use a naming convention when defining read adapters to potentially represent relationships - How to define readzones can be found in the Developer's guide Note: The serviceid for a given reader factory adapter instance in the rifidi.xml is used to map to a readerID in teh readzone property files
    • 5 Are there any application properties required? Such as database parameters, Queue Names, Webservice Endpoints/URL, Rifidi services parameters (timeouts, thresholds) -Note: All teh Rifidi Jumpstart Applications provide examples on how these are defined and used within an application

Other Topics (Monitoring/Logging/Management/Deployment)

  • Is there a need to Dynamically/Remotely manage the Edge Server such as stopping/starting sessions, configuring sensors, managing applications etc.. A list of how to use these Edge management services can be found Edge Management
  • Is there a need to Monitor the Edge Server such as JVM, Configured Readers/Sensors, OSGI, Applications (anything exposed via JMX). A list of how to use these Edge management services can be found Edge Monitoring
  • Any additional logging needs can be configured here Rifidi Logging Configuration
  • Any changes to Edger Server configuration such as changing default port, RMI, production mode Edge_Server_Configuration
  • Are there any OSGI Bundles you need to add to Edge Server required by your application? such as the Oracle database driver How_to_add_OSGI_Bundles
  • Performance Tuning Tips Performance_Tuning_Tips
  • Complete steps to export and deploy a app you designed/developed How_to_export_your_custom_Rifidi_application
Personal tools