lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks for replies.

2013/8/9 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>
... tell us more about the problem
you're trying to solve.


I'm writing components for CEMS system.
I don't want to paste code, because names of variables, etc. are in Polish.
I try to explain what this code calculates.

For example, one of the component calculate/normalize SO2 (sulfur dioxide) concentration measurment. 

Besides I have measurments: O2 (oxygen), H2O (humidity), T (temperature), P (pressure), which are located in the separate components.

On input I have measurment value (SO2_in) and I must normalize this value to the reference conditions: O2_r = 11 %, H2O_r = 0, T_r = 273.15, P_r = 1013.25.

Formula for this calculation is the following:

Correction factor:
O2_cf = (20.95 - 11) / (20.95 - O2)
H2O_cf = (100 - H2O_r) / (100 - H2O)
T_cf = (T + T_r) / T_r
P_cf = P_r / P

Normalized value:
SO2 = SO2_in / (O2_cf * H2O_cf * T_cf * P_cf)

For now, where is necessery, I'm using tostring function.
Taking into account the accuracy of the measurements, I think this should be sufficient.

If I'm wrong, please correct me.