Previous | Index | Next |
7.4 Program Routing
Routing Statements are defined in this section. Routing statements are used to control the operation of the program. They specify how each step will terminate and what will happen when the termination occurs. Up to 32 Routing statements can be specified. Specifying a Routing Statement does not mean that it will be used. In order to use the Routing Statement it must be assigned to a particular step in the Steps section. Routing Statements can be assigned in more that 1 step. The Routing Statement defines a decision that the device will repeatedly examine and execute whenever it happens to be true. There are 3 types of Routing Statements:
- Termination: Used to generate a step termination. All termination statements are examined by the micro controller approximately once per second. When a termination statement is true the step will terminate. This same termination statement will also specify the next step the routine should execute. It will also specify if a counter should be incremented and if the accumulated data should be preserved.
- Conditional: Conditional routing statements are only used by the routine when a step terminates based on a termination statement. Once a termination has occurred then all conditional statements assigned to the step are also examined. The first conditional statement found to be true will over-ride the GoTo, Counter and Preserve values specified in the termination statement that caused the termination. The termination will still occur, but these other items that specify the action to take are changed. Conditional statements are examined from the lowest statement number to the highest. The first conditional statement found to be true is the one that takes effect.
- Message: Message routing statements specify which text message will be displayed in the console Results Data area. A message is very useful because it can examine the numerical data from the terminating and provide a text answer to the results. For example you can have the message statement calculate if a parameter is within range or defined threshold and give the user a meaningful message such: Pass, Fail, Good, Bad, Marginal etc. etc. There is a wide range of messages to select from. See Program Messages section for detail.
When the Program listing is Opened & Previewed in Battery Console, the format for Routing Statements will look like:
- n – Routing Statement number
- type – Defines type of routine statement. Must be: spare, term, cond, mess
- parameter – One of the available operational parameters. See list.
- operator – Operator used to determine if routing statement is true/false. See list.
- value – numerical value the parameter is compared to
- step – For term & cond types this is the step number the program will route to when statement is true. For mess types this is the message number.
- preserve – This optional item will appear in the preview listing only if preserve=yes otherwise preserve=no is assumed.
- Inc CountX – This optional item will appear if a Counter is assigned to this routing statement.
Build these routing statements by specifying items in this Routing section of the xml file.
Routing_Note |
This is just any helpful comment used to document the statement. |
Type |
Select from: spare, term, cond, mess
|
If |
This is the parameter that gets compared to the specified value using the specified operator. Use all lower case and observe proper syntax. Select from:
|
Operator |
Select from: =, <>, >, >=, <, <= |
Value |
Numerical value that parameter is compared to. Note: A value of 0 will disable the term statement. |
Go_To |
For term or cond statement types this is the next step that will execute when this step terminates. For mess statements this is the message number to be associated and displayed with the Results Data. Using Go_To = 0 will mean advance to the next step. This is very useful because it means the termination statement is generic and can be used many times in multiple steps. This will reduce the number of routing statements required because you can use the same one in many different steps. Statements assigned in multiple steps must be of the same Type |
Counter |
There are 7 internal counters available. They can be used for information or to control advanced program routing. Putting a counter number from 1 to 7 will cause the counter to increment when the step terminates. Note: when a step is terminated the Results Data is saved to memory before the counters are incremented. This means when using Counter 1 as a cycle counter you have to increment Counter 1 before beginning the step that will eventually correspond to Counter 1. This way Counter 1 (#) in Results Data will correspond correctly to the right step. This may mean inserting an extra step for the sole purpose of getting the counter to increment before a new step begins.
|
Preserve |
In some cases it may be desirable to keep accumulated values, such as mAH, StepTime, etc. when advancing to another step. This allows the new step to just continue on. Normally you would always clear these values. However the data can be preserved when using an algorithm that is still continuing the same task with different parameters. Use 1 of 2 possible values:
|
Routing Notes:
- Any step that does not have a method of termination defined will never advance to another step, unless, of course, it is forced with a vector command such as the software “Restart” or the hardware “Vector” push button.
- Any Routing statement that is not assigned in some step is simply ignored. Leaving unused Routing Statements in the listing for possible future use is fine.
- When preparing custom routines be aware that you must Save the data for any step that is to appear in the Results Data. Do this by setting Save=yes for the desired steps in the xml program file. Also note that Counter 1 is a special counter that gets saved with the Results Data and is used to assign a number(#) to the Result Data row. Results Data is saved to memory before counters are incremented. Therefore it is necessary to increment Counter1 before beginning the step that will eventually correspond to Counter 1. Keep this in mind when programming custom routines to ensure that Counter1(#) will match with the correct Results Data row.
- If a statement is assigned in more that one step, it must always be assigned as the same type: term, cond, mess.