#include <FGSwitch.h>
Inherits FGFCSComponent.
property conditional property|value
e.g.
qbar ge 21.0
or,
roll_rate == pitch_rate
Within a test, additional tests can be specified, which allows for complex groupings of logical comparisons. Each test contains additional conditions, as well as possibly additional tests.
<switch name="switch1"> <default value="{property|value}"/> <test logic="{AND|OR}" value="{property|value}"> {property} {conditional} {property|value} <test logic="{AND|OR}"> {property} {conditional} {property|value} ... </test> ... </test> <test logic="{AND|OR}" value="{property|value}"> {property} {conditional} {property|value} ... </test> ... [<output> {property} </output>] </switch>
Here's an example:
<switch name="roll a/p autoswitch"> <default value="0.0"/> <test value="fcs/roll-ap-error-summer"> ap/attitude_hold == 1 </test> </switch>
Note: In the "logic" attribute, "AND" is the default logic, if none is supplied.
The above example specifies that the default value of the component (i.e. the output property of the component, addressed by the property, ap/roll-ap-autoswitch) is 0.0. If or when the attitude hold switch is selected (property ap/attitude_hold takes the value 1), the value of the switch component will be whatever value fcs/roll-ap-error-summer is.
Definition at line 134 of file FGSwitch.h.
Public Types | |
| enum | eComparison { ecUndef = 0, eEQ, eNE, eGT, eGE, eLT, eLE } |
| enum | eLogic { elUndef = 0, eAND, eOR, eDefault } |
Public Member Functions | |
| FGSwitch (FGFCS *fcs, Element *element) | |
| Constructor. | |
| bool | Run (void) |
| Executes the switch logic. | |
| ~FGSwitch () | |
| Destructor. | |
Classes | |
| struct | test |
| fcs | a pointer to the parent FGFCS class | |
| element | a pointer to the Element (from the config file XML tree) that represents this switch component |
Definition at line 75 of file FGSwitch.cpp.
| bool Run | ( | void | ) | [virtual] |
Reimplemented from FGFCSComponent.
Definition at line 153 of file FGSwitch.cpp.
1.5.5