Hello everyone,
Since Cadet version 4.3.0 allows modelling of dynamic flow rates i am trying to implement a dynamic volume flow rate via time step from a dataset.
My profil data is stored in a “.csv” file. The first column are time points and the second column is the volume flow rate. Via the cubic function in the “CONNECTION GROUP” i want to evaluate the volume flow at a given time as well as linear interpolate values between timepoints by the “LINEAR FLOW RATE COEFFICIENT”.
Here is the part of the sourcecode:
####### Sections and Switches #######
volume_flow_profile = np.loadtxt('D:path_to_/volume_flow_profile.csv', delimiter=',')
time = volume_flow_profile[:,0]
volume_flow = volume_flow_profile[:,1]
n_sections = len(time)-1
section_times = [time[0]]
for i in range(n_sections):
switch_index = 'switch_{0:03d}'.format(i)
flow = volume_flow[i]
slope = (volume_flow[i+1] - volume_flow[i]) / (time[i+1] - time[i])
model.root.input.model.connections[switch_index].section = i
model.root.input.model.connections[switch_index].connections = [
0, 1, -1, -1, flow, slope, 0, 0,
1, 2, -1, -1, flow, slope, 0, 0
]
section_times.append(time[i+1])
model.root.input.model.connections.connections_include_dynamic_flow = 1
model.root.input.solver.sections.nsec = n_sections
model.root.input.solver.sections.section_times = section_times model.root.input.solver.sections.section_continuity = [0]
model.root.input.model.connections.nswitches = n_sections-1
The simulation is running without error but the result is not correct and I want to ask if:
- Maybe the ‚CONNECTIONS_INCLUDE_PORTS‘ should be active or
- Probably there is something wrong with the ‚valve configuration‘ ?
Furthermore the Inlet concentration (c_feed) should be conctant:
model.root.input.model.unit_000.sec_000.const_coeff = c_feed
Because of nsec = n_sections (>1), i tried to replace the inlet concentration by:
model.root.input.model.unit_000[switch_index].const_coeff = c_feed
and inserting it in the for loop. But the result seems to be the same.
I would really appreciate it if someone could help me.
Thanks in advance.