-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuncertainty_tools.py
690 lines (589 loc) · 26.2 KB
/
uncertainty_tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
"""
UncertaintyTools Module
This module provides a collection of tools for uncertainty calculation and manipulation.
Classes:
UncertaintyTools: A class containing methods for gathering data from an Excel sheet,
performing various uncertainty calculations, and more.
The main goal of multiple functions is to calculate the uncertainty
at a given flowrate, by using reccomended linear interpolation methods.
Functions:
None
"""
import math
import numpy as np
from hrs_config import HRSConfiguration
from flow_calculations import FlowProperties
from correction import Correction
class UncertaintyTools:
"""
A class containing methods for uncertainty calculation and manipulation.
"""
def __init__(self, hrs_config: HRSConfiguration, correction: Correction):
"""
Initialize UncertaintyTools object.
"""
self.flow_properties = FlowProperties()
self.correcter = correction
self.hrs_config = hrs_config
self.std_uncertainty_zo_m_factor = 0.0261
def convert_std_to_confidence(self, std_uncertainty, k):
"""
Converts standard uncertainty to confidence interval based on coverage factor 'k'.
Args:
std_uncertainty (float): The standard uncertainty value.
Returns:
float: The confidence interval value.
Raises:
ValueError: If the provided std_uncertainty is not a positive number.
"""
if std_uncertainty <= 0:
raise ValueError("Standard uncertainty must be a positive number.")
return k * std_uncertainty
def linear_interpolation(self, flowrate, uncertainty):
"""
Performs linear interpolation to estimate uncertainty for a given flowrate.
Args:
flowrate (float): The flowrate value for which to perform interpolate.
uncertainty (array): The uncertainty data corresponding to the flowrates_kg_min array.
Returns:
float: The interpolated value for the given flowrate.
"""
return np.interp(flowrate, self.hrs_config.flowrates_kg_min, uncertainty)
def calculate_sum_variance(self, *args):
"""
Calculates the combined variance by summing the squared deviations of provided arguments.
Args:
*args: Variable number of arguments representing contributing uncertainties.
Returns:
float: The combined variance value.
Raises:
ValueError: If no arguments are provided.
"""
if not args:
raise ValueError("At least one argument (uncertainty) is required.")
# Square each argument and sum them
squared_variances = sum(arg**2 for arg in args)
# Return the square root of the sum (combined variance)
return math.sqrt(squared_variances)
def convert_relative_to_absolute(self, uncertainty, reference):
"""
Converts relative uncertainty to absolute uncertainty.
Parameters:
- Relative uncertainty (%)
- Reference measurement (unit)
Returns:
- Absolute uncertainty (unit)
"""
absolute_uncertainty = (uncertainty) * reference
return absolute_uncertainty
def get_field_condition_std(self, flowrate):
"""
Retrieve the interpolated field condition standard uncertainty for the given flowrate.
Args:
flowrate (float): The flowrate for which to retrieve the field condition standard
uncertainty.
Returns:
float: The interpolated field condition standard uncertainty for the given
flowrate [kg/min].
"""
if self.hrs_config.multiple_field_condition_bool:
relative_uncertainty = self.linear_interpolation(
flowrate, self.hrs_config.get_field_condition()
)
else:
relative_uncertainty = self.hrs_config.get_field_condition()
return self.convert_relative_to_absolute(relative_uncertainty, flowrate)
def get_field_repeatability_std(self, flowrate):
"""
Retrieve the interpolated field repeatability standard uncertainty for the given flowrate.
Args:
flowrate (float): The flowrate for which to retrieve the field repeatability standard
uncertainty.
Returns:
float: The interpolated field repeatability standard uncertaint [kg/min].
"""
if self.hrs_config.multiple_field_repeatability_bool:
relative_uncertainty = self.linear_interpolation(
flowrate, self.hrs_config.get_field_repeatability()
)
else:
relative_uncertainty = self.hrs_config.get_field_repeatability()
return self.convert_relative_to_absolute(relative_uncertainty, flowrate)
def get_calibration_deviation_std(self, flowrate):
"""
Retrieve the interpolated calibration deviation standard uncertainty for the given flowrate.
Args:
flowrate (float): The flowrate for which to retrieve the calibration deviation standard
uncertainty [kg/min].
Returns:
float: The interpolated absolute calibration deviation standard uncertainty [kg/min]
"""
if self.hrs_config.multiple_calibration_deviation_bool:
relative_uncertainty = self.linear_interpolation(
flowrate, self.hrs_config.get_calibration_deviation()
)
else:
relative_uncertainty = self.hrs_config.get_calibration_deviation()
# print(f"relative_cal_dev uncertainty: {relative_uncertainty}")
return self.convert_relative_to_absolute(relative_uncertainty, flowrate)
def get_calibration_reference_std(self, flowrate):
"""
Retrieve the interpolated calibration reference standard uncertainty for the given flowrate.
Args:
flowrate (float): The flowrate for which to retrieve the calibration reference standard
uncertainty.
Returns:
float: The interpolated absolute calibration reference standard uncertainty [kg/min].
"""
if self.hrs_config.multiple_calibration_reference_bool:
# print(self.hrs_config.get_calibration_reference())
reltive_uncertainty = self.linear_interpolation(
flowrate, self.hrs_config.get_calibration_reference()
)
else:
reltive_uncertainty = self.hrs_config.get_calibration_reference()
# print(f"relative_cal_dev uncertainty: {reltive_uncertainty}")
return self.convert_relative_to_absolute(reltive_uncertainty, flowrate)
def get_calibration_repeatability_std(self, flowrate):
"""
Retrieve the interpolated calibration repeatability standard uncertainty for the given
flowrate.
Args:
flowrate (float): The flowrate for which to retrieve the calibration repeatability
standard uncertainty.
Returns:
float: The interpolated calibration repeatability standard uncertainty [kg/min]
"""
if self.hrs_config.multiple_calibration_repeatability_bool:
unc_rel = self.linear_interpolation(
flowrate, self.hrs_config.get_calibration_repeatability()
)
return self.convert_relative_to_absolute(unc_rel, flowrate)
else:
return self.hrs_config.get_calibration_repeatability()
def calculate_total_combined_unc(self, uncertainties_abs_std, formatting):
"""
Calculate the total combined uncertainty.
Args:
- uncertainties_abs_std: Array containing absolute uncertainties [kg/min] per second.
Returns:
- Uncertainty_mass: The total combined uncertainty of mass measured by the CFM [kg].
"""
uncertainty_mass = 0
for uncertainty in uncertainties_abs_std:
uncertainty_mass += uncertainty * formatting
return uncertainty_mass
def calculate_std_vol_flowrate_unc(self, qvo, qm, uqm, z0m, uz0m):
"""
Calculate the standard uncertainty for the standard volumetric flow rate.
Args:
qvo (float): The standard volumetric flow rate.
qm (float): The mass flow rate.
uqm (float): The standard uncertainty of the mass flow rate.
z0m (float): gas compressibility.
uz0m (float): The standard uncertainty of gass compressibility.
Returns:
float: The standard uncertainty of the volumetric flow rate.
"""
return math.sqrt((uqm / qm) ** 2 + (uz0m / z0m) ** 2) * qvo
def calculate_cfm_abs_unc_std(self, flowrate):
"""
Calculate the CFM absolute uncertainty of the current flowrate.
This method calculates the relative uncertainty of the flowrate measurement based on
the provided flowrate value. It retrieves interpolated uncertainties for calibration
deviation, calibration repeatability, calibration reference, field repeatability,
and field condition, and then calculates the sum of variances using these uncertainties.
Args:
flowrate (float): The flowrate for which to calculate the relative uncertainty.
Returns:
float: The absolute standard uncertainty of the flowrate measurement [kg/min].
"""
if flowrate == 0:
return 0
calibration_deviation = self.get_calibration_deviation_std(flowrate)
calibration_repeatability = self.get_calibration_repeatability_std(flowrate)
calibration_reference = self.get_calibration_reference_std(flowrate)
field_repeatability = self.get_field_repeatability_std(flowrate)
field_condition = self.get_field_condition_std(flowrate)
var = self.calculate_sum_variance(
calibration_deviation,
calibration_repeatability,
calibration_reference,
field_condition,
field_repeatability,
)
return var
def calculate_total_abs_unc_std(self, flowrate, temperature, pressure):
"""
Calculate the CFM absolute uncertainty of the current flowrate.
This method calculates the relative uncertainty of the flowrate measurement based on
the provided flowrate value. It retrieves interpolated uncertainties for calibration
deviation, calibration repeatability, calibration reference, field repeatability,
and field condition, and then calculates the sum of variances using these uncertainties.
Args:
flowrate (float): The flowrate for which to calculate the relative uncertainty.
Returns:
float: The absolute standard uncertainty of the flowrate measurement [kg/min].
"""
if flowrate == 0:
return 0
calibration_deviation = self.get_calibration_deviation_std(flowrate)
calibration_repeatability = self.get_calibration_repeatability_std(flowrate)
calibration_reference = self.get_calibration_reference_std(flowrate)
field_repeatability = self.get_field_repeatability_std(flowrate)
field_condition = self.get_field_condition_std(flowrate)
# print(f"flowrate: {flowrate}, temp: {temperature}, pres: {pressure}")
# Henter absolutt verdi for temp, konverterer rel trykk og årlig deviasjon.
abs_temp = self.calculate_abs_temp_per_sample(temperature)
abs_pres = self.calculate_absolute_pressure_unc(pressure, flowrate)
abs_annual = self.calculate_absolute_annual_dev(flowrate)
print(
f"abs_temp_cont: {abs_temp} kg/s, abs_pres_cont: {abs_pres} kg/s, abs_annual: {abs_annual} kg/s \n"
)
var = self.calculate_sum_variance(
calibration_deviation,
calibration_repeatability,
calibration_reference,
field_condition,
field_repeatability,
abs_temp,
abs_pres,
abs_annual,
)
return var
def calculate_cfm_rel_unc_k(self, flowrate, temperature, pressure, k, string=None):
"""
Calculate the relative uncertainty of the CFM to the current flowrate.
This method calculates the relative uncertainty of the flowrate measurement based on
the provided flowrate value. It retrieves interpolated uncertainties for calibration
deviation, calibration repeatability, calibration reference, field repeatability,
and field condition, and then calculates the sum of variances using these uncertainties.
Based on NFOGM gas metering handbook.
Args:
flowrate (float): The flowrate for which to calculate the relative uncertainty [kg/min]
Returns:
float: The relative uncertainty of the flowrate measurement.
"""
if flowrate == 0:
return 0
calibration_deviation = (
self.get_calibration_deviation_std(flowrate) / flowrate
) * 100
calibration_repeatability = (
self.get_calibration_repeatability_std(flowrate) / flowrate
) * 100
calibration_reference = (
self.get_calibration_reference_std(flowrate) / flowrate
) * 100
field_repeatability = (
self.get_field_repeatability_std(flowrate) / flowrate
) * 100
field_condition = (self.get_field_condition_std(flowrate) / flowrate) * 100
if string == None:
temp_unc = self.calculate_relative_temperature_uncertainty(
flowrate, temperature
)
press_unc = self.calculate_relative_pressure_uncertainty(pressure)
annual_dev_unc = self.calculate_relative_annual_dev()
elif string == "CFM":
temp_unc = 0
press_unc = 0
annual_dev_unc = 0
var = self.calculate_sum_variance(
calibration_deviation,
calibration_repeatability,
calibration_reference,
field_condition,
field_repeatability,
temp_unc,
press_unc,
annual_dev_unc,
)
return self.convert_std_to_confidence(var, k)
def calculate_density_abs_unc_std(self, pressure, temperature):
"""
Calculates the density uncertainty based off: (n * m) / V, where n is the ideal
gas law. Utilizes propagation of uncertainty and partial derivation to reach
the uncetainty.
Parameters:
- Pressure [Pa]
- Temperature [K]
Returns:
- Density uncertainty [kg/m3]
"""
unc_pressure_abs = self.hrs_config.get_pressure_uncertainty(pressure)
unc_temp_abs = self.hrs_config.get_temperature_uncertainty(temperature)
m = self.flow_properties.molar_mass_m
r = self.flow_properties.gas_constant_r
drho_dp = (m) / (r * temperature)
drho_dt = (pressure * m) / (r * temperature**2)
return self.calculate_sum_variance(
(drho_dp * unc_pressure_abs), (drho_dt * unc_temp_abs)
)
def calculate_depress_abs_unc(self, pressure, temperature):
"""
Calculates the uncertainty of the depressurization. The mass depressurized
is vented to the environment, and is consecutively given as M = p*V.
The uncertainty calculation is found by utilizing error propagation by
partial derivation.
Parameters:
- Pressure [Pa]
- Temperature [Kelvin]
Returns:
- Uncertainty of the mass depressurized [kg]
"""
if self.hrs_config.correct_for_depress_bool:
vent_volume = (
self.hrs_config.get_depressurization_vent_volume()
) # 0.0025 m3
vent_uncertainty = self.hrs_config.get_depressurization_vent_volume_unc()
density = self.flow_properties.calculate_hydrogen_density(
pressure, temperature
)
density_uncertainty = self.calculate_density_abs_unc_std(
pressure, temperature
)
dm_dp = vent_volume
dm_dv = density
return self.calculate_sum_variance(
(dm_dp * density_uncertainty), (dm_dv * vent_uncertainty)
)
else:
return 0
def caclulate_dead_volume_abs_unc(
self, pre_press, pre_temp, post_press, post_temp, volume=None
):
"""
Calculates the dead volume uncertainty based on partial derivation and error
propagation.
Args:
- Pre-fill-pressure: Previous filling pressure [Pa]
- Pre-fill-temperature: Previous filling temperature [K]
- Post-fill-pressure: Current filling pressure [Pa]
- Post-fil-temperature: Current filling temperature [K]
"""
if volume is None:
dead_volume = self.hrs_config.get_dead_volume()
else:
dead_volume = volume
if self.hrs_config.correct_for_dead_volume_bool:
dead_volume_unc = self.hrs_config.get_dead_volume_uncertainty()
prev_density = self.flow_properties.calculate_hydrogen_density(
pre_press, pre_temp
)
current_density = self.flow_properties.calculate_hydrogen_density(
post_press, post_temp
)
prev_density_unc = self.calculate_density_abs_unc_std(pre_press, pre_temp)
current_density_unc = self.calculate_density_abs_unc_std(
post_press, post_temp
)
dm_dv = current_density - prev_density
dm_p2 = dead_volume
dm_p1 = dead_volume
return self.calculate_sum_variance(
(dm_dv * dead_volume_unc),
(dm_p1 * prev_density_unc),
(dm_p2 * current_density_unc),
)
else:
return 0
def calculate_total_system_rel_unc_k(
self,
mass_delivered,
uncertainties,
pre_fill_press,
pre_fill_temp,
post_fill_press,
post_fill_temp,
k,
):
"""
This method calculates the total uncertainty to the mass correction, given in relative
expanded uncertainty, for k = 2. It uses three methods to calculate it. CFM uncertainty
returns totaled uncertainty from measurements, in kg.Mass vented uncertainty in kg, and
the uncertainty in change in mass from dead volume in kg.
Parameters:
- Mass delivered: Calculated corrected mass delivered [kg]
- Uncertainties: CFM absolute std uncertainties [kg/min]
- Pre-fill-pressure: Previous filling pressure [Pa]
- Pre-fill-temperature: Previous filling temperature [K]
- Post-fill-pressure: Current filling pressure [Pa]
- Post-fil-temperature: Current filling temperature [K]
"""
cfm_uncertainty = self.calculate_total_combined_unc(uncertainties, 1 / 60)
# -> Returnerer kalkulert abs suikkerhet til CFM målinger [kg].
depress_vent_uncertainty = self.calculate_depress_abs_unc(
post_fill_press, post_fill_temp
)
# -> Returnerer kalkulert abs usikkerhet til depress [kg]
dead_volume_uncertainty = self.caclulate_dead_volume_abs_unc(
pre_fill_press,
pre_fill_temp,
post_fill_press,
post_fill_temp,
)
print()
# -> returnerer kalkulert abs usikkerhet til dødvolum [kg]
#print(
# f"CFM uncertainty: {cfm_uncertainty}kg Depressurized vent uncertainty: {depress_vent_uncertainty}kg Dead volume uncertainty: {dead_volume_uncertainty}kg"
#)
rel_unc = self.calculate_sum_variance(
(cfm_uncertainty / mass_delivered),
(depress_vent_uncertainty / mass_delivered),
(dead_volume_uncertainty / mass_delivered),
)
expanded_relative_uncertainty = self.convert_std_to_confidence(rel_unc, k)
return expanded_relative_uncertainty
def return_total_system_uncs(
self, mass_delivered, cfm_uncertainties, dvs, vvs, tes, pes, ltds
):
"""
Calculates and returns the total relative uncertainties over the filling process.
#TODO: kanskje få inn i kap 4.
Parameters:
- Mass delivered: Total corrected mass delivered [kg]
- cfm_uncertainties: List containing absolute cfm uncertainties [kg/min]
- dvs: Absolute uncertainty due to corrececting dead volume [kg]
- vvs: Absolute uncertainty due to crorected vented mass [kg]
- tts: List containing absolute uncertainties from temperature effect [kg/min]
- tts: List containing absolute uncertainties from pressure effect [kg/min]
- tts: List containing absolute uncertainties from long term drift [kg/min]
"""
# print(mass_delivered, cfm_uncertainties, dvs, vvs, tts, pps, ans)
tot_abs_cfm = self.calculate_total_combined_unc(cfm_uncertainties, 1 / 60)
tot_abs_temp = self.calculate_total_combined_unc(tes, 1 / 60)
tot_abs_press = self.calculate_total_combined_unc(pes, 1 / 60)
tot_abs_ltd = self.calculate_total_combined_unc(ltds, 1 / 60)
rel_tt = (tot_abs_temp / mass_delivered) * 100
rel_pp = (tot_abs_press / mass_delivered) * 100
rel_ltd = (tot_abs_ltd / mass_delivered) * 100
rel_vv = (vvs / mass_delivered) * 100
rel_dv = (dvs / mass_delivered) * 100
rel_cfm = (tot_abs_cfm / mass_delivered) * 100
return (
rel_tt,
rel_pp,
rel_ltd,
rel_vv,
rel_dv,
rel_cfm,
tot_abs_cfm,
tot_abs_temp,
tot_abs_press,
tot_abs_ltd,
)
def calculate_relative_pressure_uncertainty(self, pressure):
"""
Returns the relative uncertainty associated to increasing pressure.
Parameters:
- Pressure [bars]
Return:
- Relative uncertainty associated to pressure.
"""
return self.hrs_config.pressure_contribution * pressure * (-1)
def calculate_absolute_pressure_unc(self, pressure, flowrate):
"""
Returns the absolute uncertainty due to pressure uuncertainty.
Parameters:
- Pressure: The current measured pressure [bars]
- Flowrate: THe current measured flowrate [kg/min]
Returns:
- Absolute uncertainty [kg/min]
"""
rel_pres_cont = self.calculate_relative_pressure_uncertainty(pressure)
abs_pres_cont = rel_pres_cont * flowrate / 100
return abs_pres_cont
def calculate_abs_temp_per_sample(self, temperature):
"""
Calculate and return the absolute uncertainty due to temperature
effect.
Parameters:
- Temperature: Current measured temperature.
Returns:
- Absolute temperature effect uncertainty [kg/min]
"""
prev_temp = self.hrs_config.previous_temperature
if temperature != prev_temp:
abs_temp_kg_min = self.hrs_config.temperature_contribution # 7.5E-5 kg/min
else:
abs_temp_kg_min = 0
return abs_temp_kg_min
def calculate_relative_temperature_uncertainty(self, flowrate, temperature):
"""
Returns the relative uncertainty associated to increasing temperature.
If this module is to be utilized in a different program, the temp_init
must be set as the starting temperature.
Parameters:
- flowrate [kg/min]
- Temperature [C]
Return:
- Relative uncertainty associated to temperature the temperature effect.
"""
abs_temp_kg_min = self.calculate_abs_temp_per_sample(temperature)
rel_unc = (abs_temp_kg_min / flowrate) * 100
return rel_unc
def calculate_relative_annual_dev(self):
"""
Returns the annual deviation relative uncertainty based on flowrate.
Parameters:
- None
Returns:
- Relative uncertainty for current flowrate [%]
"""
annual_deviation = (
self.hrs_config.annual_deviation * self.hrs_config.years_since_calibration
)
return annual_deviation
def calculate_absolute_annual_dev(self, flowrate):
"""
Calculate and return the absolute uncertainty due to the
yearly drift.
Parameters:
- Flowrate: Current measured flowrate [kg/min].
Returns:
- Absolute temperature effect uncertainty [kg/min]
"""
rel_annual_deviation = (
self.hrs_config.annual_deviation * self.hrs_config.years_since_calibration
)
abs_an_dev = (rel_annual_deviation * flowrate) / 100 # kg / min
return abs_an_dev
def return_misc_press_data(self, flowrate, pressure, temperature):
"""
This method returns the relative uncertainty of the pressure, temperature,
and annual deviation - for plotting purposes.
"""
rel_temp_unc = self.calculate_relative_temperature_uncertainty(
flowrate, temperature
)
rel_press_unc = self.calculate_relative_pressure_uncertainty(pressure)
rel_annual_dev_unc = self.calculate_relative_annual_dev()
abs_temp_unc = self.calculate_abs_temp_per_sample(temperature)
abs_press_unc = self.calculate_absolute_pressure_unc(pressure, flowrate)
abs_annual_dev_unc = self.calculate_absolute_annual_dev(flowrate)
return (
rel_temp_unc,
rel_press_unc,
rel_annual_dev_unc,
abs_temp_unc,
abs_press_unc,
abs_annual_dev_unc,
)
def return_abs_error_data(
self, pre_fill_press, pre_fill_temp, post_fill_press, post_fill_temp
):
"""
Calculate and returns absolute uncertainty data
"""
depress_vent_uncertainty = self.calculate_depress_abs_unc(
post_fill_press, post_fill_temp
)
# -> Returnerer kalkulert abs usikkerhet til depress [kg]
dead_volume_uncertainty = self.caclulate_dead_volume_abs_unc(
pre_fill_press,
pre_fill_temp,
post_fill_press,
post_fill_temp,
)
return depress_vent_uncertainty, dead_volume_uncertainty