Commit f3fd0bfc authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Flow Processor. COM_pump water (without air) flow rate determination.

parent 5c6c1d8b
Pipeline #101262 passed with stages
in 2 minutes and 32 seconds
......@@ -39,6 +39,60 @@ def get_flow_timeseries(dataset: DatasetReader):
pass
def get_bubble_density(dataset: DatasetReader):
pump_df = get_bubble_density_from_pump(dataset)[["com_water_pump"]]
compump_df = get_bubble_density_from_conduct(dataset)
comp_df = pump_df.merge(compump_df["com_water_conduct"], left_index=True, right_index=True, how="outer").fillna(
method="ffill")
smooth_df = comp_df.merge(comp_df.ewm(alpha=0.01).mean(),
left_index=True, right_index=True,
suffixes=["_orig", "_smooth"])
smooth_df[["com_water_pump_orig", "com_water_pump_smooth"]].plot()
smooth_df[["com_water_conduct_orig", "com_water_conduct_smooth"]].plot()
smooth_df[["com_water_pump_smooth", "com_water_conduct_smooth"]].plot()
plt.show()
pass
def get_bubble_density_from_pump(dataset: DatasetReader):
colpump_df = pump.get_mlmin_df(dataset, "COLPUMP")
compump_df = pump.get_mlmin_df(dataset, "COMPUMP")
picpump_df = pump.get_mlmin_df(dataset, "PICPUMP")
pump_df = pd.concat([colpump_df, compump_df, picpump_df], join='outer', axis=1).fillna(method='ffill')
pump_df.columns = ["col", "com", "pic"]
pump_df["com_water_pump"] = pump_df["col"] + pump_df["pic"]
# pump_df.plot()
# plt.show()
return pump_df
def get_bubble_density_from_conduct(dataset: DatasetReader):
first_datetime = "2020-12-23 14:35:08"
last_datetime = "2020-12-23 15:02:49"
conduct_df = dataset.get_timeseries("CONDUCTI_periodic")[["C1", "C2"]]
c1 = conduct_df[first_datetime:last_datetime]["C1"]
c2 = conduct_df["C2"]
c2.index = c2.index + datetime.timedelta(seconds=-11)
c2 = c2[first_datetime:last_datetime]
c2 = c2 - 0.05
conduct_df = pd.merge(c1, c2, left_index=True, right_index=True, how="outer").fillna(method="ffill")
conduct_df["density"] = conduct_df["C1"] / conduct_df["C2"]
compump_df = pump.get_mlmin_df(dataset, "COMPUMP")
compump_df = compump_df.merge(conduct_df["density"], left_index=True, right_index=True, how="outer").fillna(method="ffill")
compump_df["com_water_conduct"] = compump_df["mlmin"] * compump_df["density"]
# compump_df.plot()
# plt.show()
return compump_df
def get_datetime_out(datetime_in: pd.Series, mlmin_df: pd.DataFrame, tube_volume_ml: float, parallel: bool = True) -> pd.Series:
"""Get the date/time the fluid reaches the end of the tube.
......
......@@ -81,3 +81,18 @@ class TestFlow(TestCase):
ps.print_stats()
self.assertIsInstance(encoder_df, pd.DataFrame)
def test_get_bubble_density_from_pump(self):
dataset_name = "20201223_mock_core"
dataset = DatasetReader(self.base_path, dataset_name)
flow.get_bubble_density_from_pump(dataset)
def test_get_bubble_density_from_conduct(self):
dataset_name = "20201223_mock_core"
dataset = DatasetReader(self.base_path, dataset_name)
flow.get_bubble_density_from_conduct(dataset)
def test_get_bubble_density(self):
dataset_name = "20201223_mock_core"
dataset = DatasetReader(self.base_path, dataset_name)
flow.get_bubble_density(dataset)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment