Problem Statement
The user interface to check the availability of a library asset in the general pool is to be built using LabVIEW software. The user interface must provide a Check-IN and Check-OUT interface for library assets in the library general pool. The solution provided here is for the library books.
General Pool
The library users are required to get permission from their respective departments to get a book from the library. Library has some books in access to the department requirement, these books can be made available to the students of other departments. Hence the students do not need to get permission from their department in order to get a book from the library general pool.
Library Management System
A library management system is built with a record for every book in the library. The book record structure is as follows:
The following functional interfaces are required in the user interface:
- Display the ‘Book Counter’ for a given ‘Book Number’.
- CHECK-OUT button, that will decrement the counter if book is issued.
- CHECK-IN button that will increment the counter if book is returned.
It is assumed in a RFID enabled library the user will not need ‘CHECK-OUT’ and ‘CHECK-IN’ interface, the RFID reader installed at the library gate/counter will automatically update the ‘Book Counter’. For this project the user is expected to perform the following functions:
- Enter the ‘Book Number’ of the book to be issued/returned.
- Click on either of ‘CHECK-OUT/CHECK-IN’ buttons.
LabVIEW Interface
Front Panel
The user interface of the Library Management System is the front panel built with the LabVIEW software. The front panel has the following controls and indicators:
- Book Number – Numeric Control: To get user input.
- Book Counter – Numeric Indicator: To display ‘Book Counter’ for the given ‘Book Number’.
- CHECK-IN button – Boolean Control: To receive a ‘Check-IN’ trigger from the user.
- CHECK-OUT button – Boolean Control: To receive a ‘Check-OUT’ trigger from the user.
- STOP button – Boolean Control: To stop the LabVIEW program.
Block Diagram
The LibraryCounter.vi is the main program of the Library Management System implemented with LabVIEW software. The program takes ‘Book Number’ as user input and displays the ‘Book Counter’ for this book. User can perform three actions:
- Check-IN
- Check-OUT
- STOP
- The algorithm of the program is described as follows:
{ flat-sequence–1
{ frame-1
Initialize the ‘Library System’ by a call to libraryBooks.vi
} frame-1
{ frame-2
while (TRUE OR STOP)
} frame-1
{ frame-2
do{
Get ‘Book Record’ for given ‘Book Number’
Read ‘Book Counter’
}while (TRUE OR STOP)
} frame-2
{ frame-3
do{
if CHECK-OUT decrement the counter;
if CHECK-IN increment the counter;
}while(TRUE OR STOP)
} frame-3
} flat-sequence-2
} while (STOP)
} frame-2
} flat-sequence–1
The flat-sequence–1is used to perform ‘Library System’ initialization outside the main program loop. The ‘Library System’ is initialized only once. The do-while loop is used in flat-sequence–2, frame-2 to break from the loop when record is found. The loop continues until the complete ‘Library System’ has been checked.
Please refer the files for the complete block diagram.
Subroutine
The Library Management System uses two sub-VIs:
- LibrarySystemGVar.vi – This sub-VI creates a global array ‘Library System’.
- LibraryBooks.vi – This sub-VI initializes the global array ‘Library System’ with 5 records.
The algorithm of this sub-VI is described as follows:
{ flat-sequence-1
{ frame-1
Initialize the ‘Library System’ records. Constant value 5 is used for the length of array. Book Name is initialized to empty string (“”), Book Number and Book Counter are initialized to zero.
} frame-1
{ frame-2
for{
{ flat-sequence-2
{ frame-1
Insert the Book Records in Library System. String constant “Book” is assigned for book title, sequential numbers 1 to 5 are assigned to Book Numbers and random number generator is used for ‘Book Counter’.
} frame-1
}
}
} frame-2
} flat-sequence-1
The flat-sequence-1, frame-1 can be deleted from the block diagram and hence flat-sequence-1 can be removed. This frame has been added to allow dynamic initialization of ‘Library System’ at a later stage.
The flat-sequence-2, frame-2 can be deleted from the block diagram and hence flat-sequence-2 can be removed. This frame has been added to debug the block diagram. Thus the only required code is: flat-sequence-1, frame-2, flat-sequence-2, frame-1 inside the ‘for’ loop.
Test Plan
The LabVIEW code has not been unit tested. Some functionality has been tested with debugger.
The following test cases can be executed to confirm the functionality of the program.
References
LabVIEW Tutorial. Web.