Download presentation
1
Converting a Chemical Engineering Problem into Excel VBA Program
Problem Solving Converting a Chemical Engineering Problem into Excel VBA Program
2
Problem: Batch Reactor
A batch reactor is used to carry out a 1st order reaction: A B -r = k * [A] d[A]/dt = -r d[B]/dt = r Initial concentrations: [A]0, [B]0.
3
Program Requirements Calculation mode: User need to input:
Find the final concentrations and yield with given initial conditions, and given reaction time. User need to input: [A]0, [B]0, k, t, Δt ( iteration step size for solving the differential equations ) Above values are positive decimal numbers, Δt > 0. Expected output: [A]t, [B]t, Y = ([A]0 - [A]t ) / [A]0 Above values are positive decimal numbers.
4
Numerical Method for Solving Differential Equations
Simplest method – Euler method. Solving dx/dt = f(x). At time t, we have value xt. We can calculate the slope at time t as f(xt). The new value of x at t + Δt: xt+Δt = xt + f(xt) * Δt Repeat the above steps from t = 0 to the end.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.