On Mon, 30 Dec 2002 12:52:13 -0600, "Jon S Berndt" <[EMAIL PROTECTED]> wrote in message <[EMAIL PROTECTED]>:
> On Mon, 30 Dec 2002 13:23:53 -0500 > David Megginson <[EMAIL PROTECTED]> wrote: > > >Jon S Berndt writes: > > > > > How are switches usually handled in the property system? > > >When possible, it's nice to abstract the input more. For example, > >lets say that you have a transponder with a rotary switch labelled > > > >- OFF > >- SBY > >- ON > >- ALT > > Well, here's what I am trying to do. For a flight control > system (including an autopilot), there are various switch > positions that affect operation, of course. I am fleshing > out our FGSwitch class so that a flight control diagram > can be fully implemented in JSBSim. Several types of > characteristics can cause an "FCS switch" tp take on a > particular setting. For instance, if the dynamic pressure > is greater than some set value, a switch can be true; if > the landing gear handle is down AND you have WOW for the > main gear, another switch might be true; if the two > just-mentioned switches are both true, then a third switch > might be true (illustrating a situation where one switch > depends on the state of another). In the same vein, if a > hypothetical panel "pitch override switch" is activated > (true), then a corresponding FCS "switch" component that > depends on the panel switch will evaluate to true, and > control law evaluation will reflect that. > > Since the idea is to generalize this, I need to know only > if a switch has "completed the circuit" (true), or not > (false). Or, in the case of a situation where the specific > aircraft in question has an autopilot rotary switch and > can select (for example) OFF, Altitude, Attitude Hold, or > whatever, then I would need to know which of the settings > is currently selected. It seems to me that the simplest > thing for generic code to parse is 0, 1, 2. OTOH, if > there is a specific boolean property for each setting, > that probably eases the situation very much. Whatever the > case, all that is really required is that the panel > designer and the control law designer communicate. I just > needed to learn a little more about the property system > and its handling of switches, be they rotary or boolean. > ..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. ..ditto for (n-2) could be 00, 01, 10 and 11. I find (n-2) etc less usable, as they require unwarrantedly tricky logics, such as "turning off the standby power". ;-) -- ..med vennlig hilsen = with Kind Regards from Arnt... ;-) ...with a number of polar bear hunters in his ancestry... Scenarios always come in sets of three: best case, worst case, and just in case. _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
