BasicAirData / AirDataComputer

Air Data Computer
https://www.basicairdata.eu/projects/airdatacomputer/
Other
33 stars 23 forks source link

Implement the $DTS command in order to remotely set some data fields before computation #63

Open GrazianoCapelli opened 6 years ago

GrazianoCapelli commented 6 years ago

With the $DTS string we could set some useful data, like the external temperature. The firmware could use the status matrix to choose between two behaviors (in acquisition phase):

GrazianoCapelli commented 6 years ago

Implementation started (commit 315e132). Now it is possible to disable the external temperature sensor (using $STS,-1,-1,-1,0,-1,-1,-1,-1,-1) and then force the External Temperature value (using $DTS,0,0,0,0,0,0,0,0,300,0 to force 300 [K] for example).

GrazianoCapelli commented 6 years ago

The implementation now includes the absolute and the differential pressure, with their relative temperatures (commit 0255e11). The overall character to leave fields as is is changed, now is the =. Thus, we can use $DTS,=,=,=,=,=,=,=,=,300 to force the external temperature to 300 [K].

GrazianoCapelli commented 6 years ago

One observation about the external temperature:

When the temperature sensor is not present, the value can be regularly updated via the $DTS command. But the assignment can also be a one-time operation, in case there are no devices that can keep updated the value.

In the second case we could compensate with the altitude drop considering the standard ISA Environmental lapse rate of 6.49 [K/km]? Maybe it will be a better approximation (in a good range and with a given initial value) than leave the temperature constant.

JLJu commented 6 years ago

Right, and the possibility of transfer data between the ADC and the attached devices is useful.

ISA altitude(with standard troposphere temperature lapse) can be calculated using AirDC::ISAAltitude(int mode=1). That calculation, as standard, does not use temperature as input data. This attitude is considered as a baseline.

On the other hand, ground pressure and ground temperature can be used to obtain a better altitude measurement.

ISAAltitude(int mode=2) uses ground pressure(#60) to get better altitude readings. See https://www.basicairdata.eu/projects/barometric-altimeter/ (Altitude compensated by pressure at sea level). This method is used on full-size aircraft.

Mode=3 includes temperature and pressure correction; I will paste the method into the code as soon as possible

The use of outside temperature impacts directly on the calculation of the true airspeed

JLJu commented 6 years ago

The idea to handle temporary or permanent measurements unavailability is good too. We can also think of cope with basic sensor failure detection and reconfiguration. However, I rather postpone that kind of task until implementation and test of basic features are completed.

GrazianoCapelli commented 6 years ago

It would be a great task to implement more sophisticated and accurate way to calculate the altitude using the temperature and the pressure too.

However, I would now to bring the focus on the temperature in input:

The external temperature could be measured by the ADC using the external temperature sensor. As alternative it could be set by the $DTS command, as yet implemented.

In the second case, the temperature should be kept updated at a good rate, but this is not always possible. In the extreme case, the user could set the external temperature once at the start (let me say, once every flight).

Thus, if we consider the following known data:

I wondered if it could be a good idea (in case the sensor is not present) to compensate the external temperature in input this way (when a new value is not available):

_TAT = _Tinput - (ISAAltitude - ISAAltitude_old) * 6.49e-3

This could be a very easy job to do for the main sketch before every computation.

JLJu commented 6 years ago

Of course that can be implemented into the main sketch Within the standardized troposphere the temperature lapse rate is -6.5°K/1000 m. You formula will provide a way to get a verosimile value of temperature when there is no available a local measurement temperature.