Click here to Skip to main content
15,889,595 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: MS Word Automation - I get so far - now what? Pin
David Crow11-Apr-14 4:40
David Crow11-Apr-14 4:40 
QuestionList And iterator Pin
Hamza Bin Amin10-Apr-14 2:49
Hamza Bin Amin10-Apr-14 2:49 
AnswerRe: List And iterator Pin
Maximilien10-Apr-14 10:21
Maximilien10-Apr-14 10:21 
SuggestionRe: List And iterator Pin
David Crow10-Apr-14 15:49
David Crow10-Apr-14 15:49 
Questionavoiding or skipping Divide by zero showing junk values Pin
manoharbalu10-Apr-14 0:50
manoharbalu10-Apr-14 0:50 
AnswerRe: avoiding or skipping Divide by zero crashes Pin
Heng Xiangzhong10-Apr-14 1:00
Heng Xiangzhong10-Apr-14 1:00 
AnswerRe: avoiding or skipping Divide by zero crashes Pin
Heng Xiangzhong10-Apr-14 1:01
Heng Xiangzhong10-Apr-14 1:01 
GeneralRe: avoiding or skipping Divide by zero crashes Pin
manoharbalu10-Apr-14 1:51
manoharbalu10-Apr-14 1:51 
I am posting one of the functions used in the code. There are many functions similar to this in the entire application



int CONDENSER(float Fl,float Fv,float Rc,float Gain,float DesFp,float Htcfl,
float Htcmaxfl,float Tflsh,float Fc, float Cpcw,
float Cppl, float Cppv, float Cpov,float Cpol, float DesFc,
float Tcwi,float Tpfi,float Tc,float Lhpv,float Lhv,
float Condeff,float CondHtarea,float Ambhc,
float Ambhf, float Ambt,float Mhc, float Mhf,
float Tfmax, float Tcmax,float *Liquid, float *Vapor,int IL, int IV,int OV, int OL,int FN,int CN)
{
int J,N,K,TYPE;
float Fp,SYCOMP,SXCOMP,Heatin,Heatvap,Heatliq;
float Heatloss,Hg,Hc,DELT1,DELT2,A,B,DENOM,DELT,Heatout;
float DER,MAX,MIN,FLAG,P,I,PI;

// Amount of Vapor condensed [ L = ( 1 - V/F) * F ]

Fp = Fl + Fv;

*Liquid = Rc * Fp;

// By material balance

*Vapor = Fp - (*Liquid);

// Composition of Vapor in equilibrium with Liquid Y = K * X

SYCOMP = 1.0E-10;

for(J=Esim->COMPBEG;J<=Esim->COMPEND;J++)
{
Esim->SCOMP[J][OV] = Esim->NKVAL[J][FN]*Esim->NXS[J][FN];
SYCOMP = SYCOMP + Esim->SCOMP[J][OV];
}

// Condensation rate (PI Logic)

Esim->NS1DER[FN]= 1 - (SYCOMP);
P = Gain*Esim->NS1DER[FN];
I = Esim->NS1S[FN];
I = LIMIT01(I+Esim->NODEK7[FN]*Esim->NS1DER[FN]);
PI = LIMIT01(P+I);
Esim->NS1S[FN] = LAG(PI,Esim->NS1S[FN],0.05);
Esim->NS1S[FN] = LIMIT01(Esim->NS1S[FN]);

// Condensed Liquid Composition

// FEED * Yi - VAP * Yi - LIQ * Xi = ACC * (d(Xi)/dt)*dt
// d(Xi) = (FEED * Yi - VAP * Yi - LIQ * Xi)/(ACC * dt)

SXCOMP = 1.0E-10;

for(J=Esim->COMPBEG;J<=Esim->COMPEND;J++)
{
Esim->SCOMP[J][OV] = Esim->SCOMP[J][OV]/SYCOMP;
Esim->NXDER[J][FN] = (Fl*Esim->SCOMP[J][IL]+Fv*Esim->SCOMP[J][IV] -(Fv)*Esim->NXS[J][FN]
-(Fl)*Esim->NXS[J][FN])/(10 + MAXI(Fp-(*Vapor),100.0)
*Esim->STPSIZEH/10000);

Esim->NXS[J][FN] = EULER( N, K, TYPE, DER, MAX, MIN, FLAG);

SXCOMP = SXCOMP + Esim->NXS[J][FN];

}

for(J=Esim->COMPBEG; J<=Esim->COMPEND; J++)
{
Esim->NXS[J][FN] = Esim->NXS[J][FN]/SXCOMP;
Esim->SCOMP[J][OL] = Esim->NXS[J][FN];
}

Hg = power((Fp/DesFp),0.5);

// Efficiency of the condenser

Esim->NS2[FN] = Condeff*MAXI(Htcfl*Hg,Htcmaxfl);
Esim->NHTR[FN] = Esim->NS2[FN]*(Tflsh - Tc);

if(Fc>0) // Cooling water side calculations
{

// From McCabe & Smith h=K*(Fc)**(-1/3)

Hc = power((Fc/DesFc),-0.33);

// Accounting for the overall Heat transfer coefficient
// 1/U = 1/Hg + 1/Hc

Esim->NS2[FN] = Condeff*CondHtarea*(Hg * Hc)/(Hg + Hc);

// Energy balance across the cooling node to find out temperature
// F*CP*(I/T-AMB)+HTRAN-F*CP*(O/T-AMB)-HLOSS = ACC*CP*(dT/dt)*dt

Esim->NTDER[CN]=(Heatin-Heatout)/(Mhc*Cpcw*Esim->STPSIZEH/10000);

} // Cooling water side calculations


Esim->STEMP[OV] = Esim->NTEMP[FN];
Esim->STEMP[OL] = Esim->NTEMP[FN];

Esim->SMFLOW[OV] = *Vapor;
Esim->SMFLOW[OL] = *Liquid;


return 0;

}

modified 10-Apr-14 8:26am.

GeneralRe: e: avoiding or skipping Divide by zero crashes Pin
Richard MacCutchan10-Apr-14 2:22
mveRichard MacCutchan10-Apr-14 2:22 
AnswerRe: avoiding or skipping Divide by zero showing junk values Pin
Munchies_Matt10-Apr-14 5:53
Munchies_Matt10-Apr-14 5:53 
AnswerRe: avoiding or skipping Divide by zero showing junk values Pin
User 5924111-Apr-14 19:07
User 5924111-Apr-14 19:07 
QuestionCDHtmlDialog: Changing HTML File Dynamically Pin
Don Guy9-Apr-14 11:31
Don Guy9-Apr-14 11:31 
QuestionSetWindowText() style question Pin
econy9-Apr-14 4:24
econy9-Apr-14 4:24 
AnswerRe: SetWindowText() style question Pin
jeron19-Apr-14 5:06
jeron19-Apr-14 5:06 
AnswerRe: SetWindowText() style question Pin
Maximilien9-Apr-14 8:30
Maximilien9-Apr-14 8:30 
GeneralRe: SetWindowText() style question Pin
econy9-Apr-14 10:11
econy9-Apr-14 10:11 
GeneralRe: SetWindowText() style question Pin
Richard MacCutchan9-Apr-14 23:21
mveRichard MacCutchan9-Apr-14 23:21 
AnswerRe: SetWindowText() style question Pin
leon de boer22-Apr-14 22:16
leon de boer22-Apr-14 22:16 
Questionhow to Convert MFC based Windows application to web application Pin
manoharbalu8-Apr-14 23:53
manoharbalu8-Apr-14 23:53 
AnswerRe: how to Convert MFC based Windows application to web application Pin
CPallini9-Apr-14 1:52
mveCPallini9-Apr-14 1:52 
AnswerRe: how to Convert MFC based Windows application to web application Pin
Munchies_Matt9-Apr-14 4:58
Munchies_Matt9-Apr-14 4:58 
AnswerRe: how to Convert MFC based Windows application to web application Pin
Richard MacCutchan9-Apr-14 6:24
mveRichard MacCutchan9-Apr-14 6:24 
GeneralRe: how to Convert MFC based Windows application to web application Pin
Munchies_Matt9-Apr-14 10:54
Munchies_Matt9-Apr-14 10:54 
Questionvisual c++ code to read number of characters in the string entered in a text box Pin
Member 107151068-Apr-14 16:14
Member 107151068-Apr-14 16:14 
AnswerRe: visual c++ code to read number of characters in the string entered in a text box Pin
David Crow8-Apr-14 16:48
David Crow8-Apr-14 16:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.