On Mon, 30 Dec 2002 21:23:35 +0100
 Arnt Karlsen <[EMAIL PROTECTED]> wrote:

..I propose (n-1) boolean bit settings for a n position rotary switch, translating Davids transponder example to 000 for OFF, 100 for SBY, 110 for ON and 111 for ALT.
Well, there is something to be said for bitfields (there is even an STL type for it). I am sort of the opinion that there should be a convention for specification of switch state, but I am ignorant enough of the property system and of future development plan and direction for panel/switch modeling that I don't feel compelled to make a personal policy statement on this (yet). The "switch state" function I am concerned with at the moment involves the JSBSim flight control system (FCS) generic modeling approach. As I mentioned, an FCS switch (a.k.a. a "note") can depend on several things or conditions - *including* actual panel switch positions. I have arrived at this definition for how "switches" should be defined in JSBSim (Tony: this is new):

<COMPONENT NAME="{name}" TYPE="SWITCH">
<TEST LOGIC="{AND|OR|DEFAULT}" VALUE="{property|value}">
{property} {conditional} {property|value}
...
</TEST>
<TEST LOGIC="{AND|OR|DEFAULT}" VALUE="{property|value}">
{property} {conditional} {property|value}
...
</TEST>
...
</COMPONENT>

This is a request for developer community comment :-)

Verbally, the JSBSim switch component can be described thusly:

The switch component is comprised of at least two TESTs, and has a VALUE corresponding to each TEST. If the TEST evaluates to TRUE, then the value of the component itself is the VALUE associated with that TEST. There can be as few as two TESTs (where one may be defined as a DEFAULT - and no conditional statements are required), or many TESTs (thus defining a rotary switch). Each test (except the DEFAULT) consists of one or more conditional statements, where the first operand is a property. The property operand is followed by a comparison operator (such as EQ, GT, etc.), which is followed by either another property or an actual value. If all or any of the conditionals evaluate to true, then the TEST evaluates to true. The decision on whether to use all depends on whether the TEST LOGIC attribute is set to AND or OR. I am working on how to set up grouped and complex TEST conditional statements, and I think I am very close. I'll post those changes when I get them.

For an example:

<COMPONENT NAME="PITCH_OVERRIDE" TYPE="SWITCH">
<TEST LOGIC="DEFAULT" VALUE="1.0">
</TEST>
<TEST LOGIC="AND" VALUE="4.0">
panel/pitch_override EQ true
</TEST>
</COMPONENT>

Jon

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to