EXCEL VBA for Mass Balance

meschackime

New Member
Joined
Nov 5, 2018
Messages
3
[h=4]Good day community,

Would you help to write a vba code for following Mass balance & Data Reconciliation[/h]The data reconciliation problem is solved using the method of Lagrange Multipliers.
Let’s denote the vector of measurements as M, whose elements are the measurements of each mass variable. And let’s denote the corresponding vector of percent uncertainties as UP. Then, the vector of absolute uncertainties UA is given by equation 4:
UA = UP⊗M
where the operator “⊗” means an element-wise multiplication.
The reconciliation matrix is given by equation 5:
H(Nm + Nc) x (Nm + Nc) = [ DCT
C0 ]

where: D is a Nm×Nm diagonal matrix whose k-th diagonal element is given by: dkk = 2/(UA(k))2. C is the Nc×Nmnodal matrix. 0 is a Nc×Nc null matrix.



The solution is given by equation 6:
S = H-1 x M
where the first Nm elements of the vector S are the reconciled measurements given by equation 7:
R(k) = S (k) ǀ 1 ˂ k ˂ Nm
and the remaining elements in S are the Lagrange multipliers given by equation 8:
L(k) = S(k) ǀ Nm + 1 ˂ k ˂ Nm + Nc

The vector of reconciliation adjustments, which are the corrections made on the original values, are given by equation 9:
A = R – M
Best regards,

Meschac
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Welcome to the Board!

This looks like homework or some other type of class assignment. Note that it is the policy of the board not to do your homework/assignments for you, but we may be willing to give you some hints and nudge in the right direction.

What don't you show us what you have done so far on it, and let us know what part is giving you trouble, and maybe someone can help point you in the right direction?
 
Upvote 0
This is not part of any class assignment. It personal work that I am doing and thought I could do it using VBA. I will submit next the code that I cam with.

Thanks
 
Upvote 0
OK, its just that we do see that a bit, and since the font was different than your font at the top, it looked like it was copied and pasted from somewhere else.

You probably can do it with VBA, though it will probably take a bit of work. For most of us here, the obstacle would be understanding the math behind it. So unless someone very familiar with these concepts stumble upon this question, your best bet for getting help may be to break it down into small components, do what you can, and post specific, individual questions. Try to explain it in such a way that the person helping does not need to understand all the concepts behind it to help you. If you can provide the knowledge, we may be able to provide the VBA.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top