> Not really my area of expertise, but I'd far prefer to use real volts, > and have the aircraft electrical system define globally what it > considers nominal to be to, i.e what John proposed with: > > For designers who prefer real volts: > /systems/electrical/nominal = 12 > /systems/electrical/subnominal = 7 Doing it that way requires a definition of absolute values in each system and for every possible operating voltage. Using a normalized value allows us to define systems independent of the operating voltage and to make a single definition of the nominal value. > > Also, wearing my C++ refactoring hat, I do NOT want to see the > electrical behaviour logic being copied into each C++ instrument class Strongly seconded!
> - let's create one or a couple of 'ElectricalInstrument' bases > (probably one for digital instruments that are either on or off, and > one for anagloue instruments that can do 'something' as supply voltage > drops below nominal, down to a threshold) > > DigitalInstrument would have an update() hook (called by the derive > instrument's update()) that did the voltage and supply checks, and > checked a standard on/off state for the instrument (this would also > help with writing auto-start nasal scripts for aircraft...). In the > future, it could also handle current draw on the electrical bus in a > standard way. I don't see any need for a "digital" Instrument, it is just a special case of on "analog" instrument. And the functionality is not limited to instruments. All electrical "consumers" may and probably should use this class. There are electrically driven flaps, hydraulic pumps and even some propellers change pitch electrically. There is probably a better name for the class than ElectricalInstrument - maybe "PoweredDevice" is the most abstract name I can think of. It could be used for a light bulb as well as for a hydraulic actuator and any "thing" that follows the rules: - Needs some kind of power/force/energy - Refuses to work when the powerlevel is below a certain level - Breaks when the powerlevel is above a certain level - Provides a load to the powering system. (Hey - that's even true for myself!) > > I'm assuming there would be a DigitialInstrument::init() method where > the derived class defines its minimum supply voltage to operate, > current draw, and any other properties. I can imagine in the future > defining a standby mode where some behaviour exists while the > instrument is 'off', but again that's for the future. > > For analog instruments, we'd still define a minimum voltage, and > probably a maximum clamp (assuming the instrument regulates input > voltage to a reference), but within the min < supply < max range, we'd > expose a 'percentage-of-nominal' value to the derived class. The gyro > code could already use this to model spin up/down, and radios or > anything else could use it in the future. Now that you name the gyro - this is a perfect example for using normalized values. It gets a normalized power as input and does not care, if it is volts or air pressure or suction or hydraulic pressure. No need for a ElectricGyro.cxx, PneumaticGyro.cxx, HydraulicGyro.cxx. Torsten ------------------------------------------------------------------------------ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel