Thursday, February 24, 2011

LABVIEW software designed for large three-tier architecture

 LABVIEW software designed for large three-tier architecture
usually if a VI contains thirty or forty or more subVI (not included in the Functions in LabVIEW itself, provided VI), the can be considered a medium to large accounting software (software project ). Though a number of software engineering than the operating environment software (such as the Windows family) or large-scale application software (such as Word, Excel) and so on still be a small project, but its complexity is also to some extent above, without prior to Fortunately, a number of written procedures and methods of planning and want to complete these in large software is definitely not a simple matter. In particular, such software is usually not one person, but by a team together to complete, so the whole software structure, will allow the team can have a clear understanding of each member, but also simple enough to be considered as a good software architecture. The following will refer to such person by the Rick Bitter with lLabVIEW Advanced Programming Techniquesr in the 4 Part of the chapter introduces the software program in the so-called three-tier structure (the Three-Tiered Structure) concept and its advantages.
need software structure was mainly attributable to the development of software when the software staff to a certain stage, if there is no plan or no intention of creating a lot of subVI, but between the subVI is repeated in many parts of writing; or call each other when the VI is not a certain discipline, so in the VI Hierarchy seen in between the VI line is complex, like Pan Sidong general, this will probably make more than the software development plan to increase the time spent and the possible chance of error, reducing the effectiveness of the procedure and to increase the difficulty when debugging. In order to improve the situation Therefore, to promote the concept of three-tier structure.
three-tier structure from top to bottom were: Main Level, Test Level and Driver Level, this structure is derived from the experience, in many developing software program seems simple, when you can write a program in accordance with this structure, this structure can be fully reveals its advantages.
that the three classes in the end how the difference? to popular metaphor , assuming that if we are to organize a basketball team to participate in national competitions, each player to practice the basic movements and physical, how to run, how to jump, how to place the hands and feet is the correct location, which is equivalent to the system made Driver Level things; Next, the players practice a combination of a defensive or offensive tactics, such as two or three zone defense, man to man defense, each person in any position to the right of the collusion and so on, are like an entry in the Test Level The test was; and the last game, the strategic use of the field, including when to use any combination of tactics, how to replace the players, when calling suspend before the whistle is not to intentionally foul or to adopt delaying tactics, etc., control over, As in the Main Level, how to Test Level of the test can make the most effective combination, integration and alignment work.
simple terms, Driver Level contains the procedures and all equipment, components, motors or other application communication, control of the lower order of things, so that it can complete a certain basic actions, such as initialization, the motor went home position, the laser energy and frequency to set the emission beam and so on. may be noted We are here talking to the driver, not as generally elsewhere, that the alleged driver, then the low-level driver, the real work of the lowest order or the existing VI should be to help it; in Test Level, then Driver VI is how to connect all the basic movements to be done out of a continuous, meaningful process, to perform a test, for example, the arm came from the A point B point, down the folder take a screw if it tries to C points fitted to a panel, and then back to A point of waiting, a process similar to the conduct of such control is the Test VI content of the work; Main Level contains the user interface (User Interface), or known human-machine interface (Man -Machine Interface), the purpose is to integrate the test and exception handling (Exception Handling), etc. and put them in the proper order and process composition, it is easy to allow users to operate.
When a software program strictly in accordance with the above three-tier structure to the time of writing, the biggest advantage is that program code can then use (code reuse) to maximize, in a different Test VI, you can reuse the same Driver VI; and in the Main Level of the different procedures, can also reuse the same Test VI, which will make program maintenance or modification significantly reduced the time and effort; the same time when we already have a program model (template), the increased speed of the software version updates. Another very important advantage is that when we write programs in a certain level, it does not need to care about what is in another level of how the implementation of other programs, and as long as the focus of this level in their program on it, which made by the team together to complete the work of a large project much easier.
the following will depend Driver Level, Test Level, Main Level order to introduce the writing program at the level of principles and experience:
( 1) Driver Level:
usually written in the Driver Level program is relatively low, its function is to some of the most basic I / O operation by a sequence of connected together to form the basic action, divided into three Category:
a. configuration (configuration): open or close links with the instrument, the instrument such as initialization and configuration settings.
b. Measurement (measurement): measured by the instrument reading or specific information.
c. Action / Status (action / status): initiation of a process or end of action, such as checking for errors.
Simply put, Driver Level by some of the content is the interface (card ), the digital I / O or analog I / O devices made by the some of the voltage sensor, or out of a number of voltage values to control the machines, motors and other equipment or the configuration and motion, making the instrument or machine settings can be correctly and make some basic moves. In addition procedures and equipment or in the transmission of information between the computer's access to its own action, the provisions of file formats and access, etc., all belong to Driver Level of matters that should be done. But really the lowest order work was still required to provide the VI for NI, we write Driver VI is still a higher-order.
plans to develop a large program, a very important concept: Driver Level VI in the entire software program The most important part, they have a direct decision of the success of this software program and the completion of quality, like to build high-rise buildings, foundations, cement shoes, and basic material is good or bad decision is a good building The most important place bad, if not part of the basis, no matter how magnificent or beautiful appearance of the building, if the earthquake a result, there may be collapsed. Driver VI without first planning procedures often result in reduced efficiency and duplication of the code too much and so on. Although the main program runs in the final and can not see the Driver VI, but they are the unsung heroes, but most important, so needed in the design of Driver VI have more to mind Oh!
(2) Test Level:
in Test Level VI in here tentatively called Test VI, it can call the Driver Level of VI, but only in the Main Level VI is called. there is a unwritten rule: Test VI is not between call each other; otherwise it would be three-tier structure has been destroyed. But in the writing program, and sometimes find it difficult to avoid, or to the first moment of convenience would like to call yourself, if this situation occurs, it would have to ask re-examine how the Driver Level VI, whether or not to rewrite or write portions of the new Driver VI, in order to avoid the above situations.
an important principle, as long as the arrangement within a Test VI a complete The test can not in the same Test VI to complete the two (or more) of the test, otherwise the future if the entire program to be modified, Test VI may have to change it. a complete course contains Test VI equipment initialization, configuration, etc., it is an individual implementation VI, that is, even if not into the Main Level Test VI below, it will also be able to complete the implementation of a test alone. Another important concept is that each Test VI is not between what is related, because when the Main Level of a Test VI is executed, it does not determine the end of the previous Test VI determining whether the machine state on demand, so To reset, or to re-check, can not be performed in order to avoid unexpected situation or occurrence.
flow chart for us to write the Test Level VI is particularly useful in, because that is precisely the concept of flow LabVIEW, the concept of the so-called data flow, so when a test of the flow chart clearly drawn and can explain the process, even if we have not started writing process, we can almost say that the Test VI program design has been completed more than 60% , and this is no exaggeration, because the rest will flow in each box is the connection, replace the function VI in LabVIEW or Driver VI connection only.
(3) Main Level:
Main Level also known as the man-machine interface (Man-Machine Interface, MMI), the center of the design concept of Main Level program is not only able to complete testing, and operation to the more user-friendly as possible, because when users operate the instrument equipment, he actually does not seem very concerned about some of the details of how it works, he may just want to be relaxed and happy to complete the work and then go home relaxed and happy. For example, users want to go to a particular arm position to take a screw clip, preferably press a button on the screen like, as long as everything looked normal message on the screen, maybe he can have time to do a leisurely cup of coffee!
usually Main Level VI design often use continuous loop while polling, most of the time is not only a while loop. its content to include several key points:
a) allows the operator to set or change the operating parameters: for example, choose What tests and the execution order, the interface addresses, the file path, etc., but please note that the option must be set not possible, the options are too many people are likely to be distracted and prone to error. < br> b) In certain circumstances using the appropriate Control: Control is sometimes thought to add some points to be changed to indicate the importance of the different, the most simple of course, is the size, color to distinguish, of course, may also be in the implementation of using property node in the flash to emphasize the effect, but generally, the importance of Control is usually used on the Front Panel button on the prominent place; and less commonly used Control, usually used on the cluster or the tab control, the use of invisible function or change to other pages do not appear to normal on the Front Panel. less frequently used buttons, but also in the form of buttons than not, and may Controls> Classic Controls> Boolean choose to use the Radio Button or Checkbox. Please remember a principle can be seen on the Front Panel of Control as little as possible, because there the more Control, set the parameters of the more likely change due to carelessness and cause an error, to avoid this situation, can be Control with Indicator on the other, after put in the Front Panel Indicator can display its value.
c) Control and Indicator to the many functional classification according to use and appropriate use of the page to switch to display.
d) in the implementation of a program can choose to cancel or abort: It is very important in terms of the operator, but it is easy to be ignored by programmers, for programmers inadvertently assume the operator is well aware of the program he wrote , and very skilled, and certainly not according to press the wrong key step in the right. but in fact the operator may not be skilled or very careless, and so, sometimes if you press a button once will not regret it, the tragedy is likely to result beyond redemption . Please note that the program designers to join in the program must be running out of program approach, and try to avoid by the operator to press the toolbar on the abort (the red circular button) to jump out of programs.
e) in the Front Panel on the greater use of graphics, text or data to avoid too much.
f) in the Main Level of uniform treatment of all the exception massage:
this part of the programming, also known as exception handling, but also in software engineering need specialized courses to discuss the same time, this part of the commercialization of the product is very important in this narrative only briefly, after which there will be a special topic to discuss.
to talk about the benefits of establishing exception handling mechanism: it can tell the operator where there is wrong, or need to pay attention, so that the novice is not a very skilled operator to reduce the chance of occurrence of the situation; also facilitate manufacturers and process designers to debug and troubleshooting easy to do the action, making the whole system development and maintenance can be more effective and the short period of time.
exception handling can we hope to achieve the following functions: When testing an error occurs, the program can automatically fix errors and continue the test or re-test once; or when an error condition occurs during testing, and this error can not be repaired, the program can automatically skip the part in question, and continue to complete the test; or testing process an error occurs, the program will suspend or end the whole system and inform the operator by the error occurred. described above it seems simple, but in fact it requires programmers to see the results after the actual operation, then one by one to the whole process, and then deliberate errors to test, but also because of this It can be regarded as the entire software program development process is very time-consuming part. If the above mentioned loan is written off State Machine will make the exception handling procedure for simplicity, because State Machine error in the original there are arranged a state, allows the programmer to write a unified treatment where all exception / error message, and then be judged in the error state is back to the original test, or come close state to end this test. is therefore strongly recommended State Machine is written using.
above simple three-tier software architecture describes the design concept, and each level should be included in the focus, here to write some personal combat experience: it is a three-tier structure principle, not an absolute requirement, but be sure to learn from his spirit, the spirit of it is: the one belonging to each level VI is to distinguish clearly between the VI with a level not to call each other, the program's code reuse to the maximum of. This way, when you want to maintain or modify the software will be relatively easy; the same time, members of the team even if there is a sudden change into the work can get started quickly understand the overall architecture.
actually using three-tier structure, by Main Level of the VI Hierarchy diagram, see if you have under such an approach is usually to look good reasons, different level of VI the icon we are used to distinguish different colors. For example the next two map, left alone to standard procedures, it is clear three-tier structure, the structure of the entire software project at a glance. right are more good, because in Test 1, he also calls the same level of the Test 2, The Main is directly call the VI to use the Driver 2, thus creating a level originally belong to different boundaries between the VI is not obvious, this will not achieve the purpose of three-tier structure, but also a show of its advantages.
might argue that the program can be written anyway, the implementation can also achieve the correct result is not good, but the two plans is just an example of a smaller program only, in fact familiar with the three-tier structure of such an approach objective of it is easier to program development and maintenance of large-scale program, it usually written in smaller programs will be more practice and a habit was not to small programs to address immediate to meet, not to practice and experience it the spirit. Please be assured that the three-tier structure is not only beautiful to VI Hierarchy Chart only, it can really improve the speed and efficiency of the design process, the more large-scale program to show its advantages more.
in practice three-tier structure of the writing, sometimes a situation occurs, only three to choose from, it is all of the VI can not be divided into three level, then only how to do?
three-tier structure would be designed to uphold the spirit of , in the end requires careful planning about layers, four? five? in personal experience, it is used in some four, yet useful to the five examples, for example, the Driver Level and divided into Upper Driver Level Lower Driver Level (This is my own name, for reference), so the structure into a four-style. Please remember to adhere to the same level VI in principle not to call each other, so that even if divided into four or five I think they can be very easy and clear understanding of the structure of the entire software program.

No comments:

Post a Comment