CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 1995|Reply: 8

C programme...sapa expert yg bleh tolong...

[Copy link]
Post time 19-10-2007 02:59 PM | Show all posts |Read mode
i kena buat programme dalam C..(more on engineering).Anyone yang expert bleh tolong tak...nnt i bg details skit.
Reply

Use magic Report


ADVERTISEMENT


Post time 19-10-2007 06:29 PM | Show all posts
apa masalahnya? bagi la details.
Reply

Use magic Report

Post time 21-10-2007 10:30 AM | Show all posts
yup bg detail sikit.. nk wat camner tuh..
Reply

Use magic Report

 Author| Post time 22-10-2007 05:05 PM | Show all posts
I have to write a programs which i have to add code to calculate /interpolate the loss density from the flux density.

Can anyone help me...

These are the sample of Pseudocode of my program (as below):


# Find the modulus flux density

Bmod = sqrt(Bx*Bx + By*By)

# Find the angle of the field in the element with respect to the x-axis

FieldAngle = atan(By/Bx)

# Find the angle of the field in the element with respect to the rolling direction

Angle = mod(FieldAngle - RollingAngle)
if ( Angle > 90 ) Angle = 180 - Angle


# Find the loss density according to the particular case

if ( 0 =< Angle < 22.5 ) then

if ( Bmod =< 1 ) then
LossLower = Case_0_Loss(0) * Bmod
LossUpper = Case_22.5_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_0_Loss )
LossUpper = interpolate( Bmod, Case_22.5_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_0_Loss )
LossUpper = extrapolate( Bmod, Case_22.5_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 0)*LossUpper + (22.5 - Angle)*LossLower ) / 22.5

endif


if ( 22.5 =< Angle < 45 ) then

if ( Bmod =< 1 ) then
LossLower = Case_22.5_Loss(0) * Bmod
LossUpper = Case_45_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_22.5_Loss )
LossUpper = interpolate( Bmod, Case_45_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_22.5_Loss )
LossUpper = extrapolate( Bmod, Case_45_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 22.5)*LossUpper + (45 - Angle)*LossLower ) / 22.5

endif


if ( 45 =< Angle < 67.5 ) then

if ( Bmod =< 1 ) then
LossLower = Case_45_Loss(0) * Bmod
LossUpper = Case_67.5_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_45_Loss )
LossUpper = interpolate( Bmod, Case_67.5_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_45_Loss )
LossUpper = extrapolate( Bmod, Case_67.5_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 45)*LossUpper + (67.5 - Angle)*LossLower ) / 22.5

endif


if ( 67.5 =< Angle =< 90 ) then

if ( Bmod =< 1 ) then
LossLower = Case_67.5_Loss(0) * Bmod
LossUpper = Case_90_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_67.5_Loss )
LossUpper = interpolate( Bmod, Case_90_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_67.5_Loss )
LossUpper = extrapolate( Bmod, Case_90_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 67.5)*LossUpper + (90 - Angle)*LossLower ) / 22.5

endif

Tolonglah dah kebuntuan idea nih..
Reply

Use magic Report

 Author| Post time 22-10-2007 05:12 PM | Show all posts
I have to write a programs which i have to add code to calculate /interpolate the loss density from the flux density.


These are the sample of Pseudocode of my program (as below):


# Find the modulus flux density

Bmod = sqrt(Bx*Bx + By*By)

# Find the angle of the field in the element with respect to the x-axis

FieldAngle = atan(By/Bx)

# Find the angle of the field in the element with respect to the rolling direction

Angle = mod(FieldAngle - RollingAngle)
if ( Angle > 90 ) Angle = 180 - Angle


# Find the loss density according to the particular case

if ( 0 =< Angle < 22.5 ) then

if ( Bmod =< 1 ) then
LossLower = Case_0_Loss(0) * Bmod
LossUpper = Case_22.5_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_0_Loss )
LossUpper = interpolate( Bmod, Case_22.5_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_0_Loss )
LossUpper = extrapolate( Bmod, Case_22.5_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 0)*LossUpper + (22.5 - Angle)*LossLower ) / 22.5

endif


if ( 22.5 =< Angle < 45 ) then

if ( Bmod =< 1 ) then
LossLower = Case_22.5_Loss(0) * Bmod
LossUpper = Case_45_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_22.5_Loss )
LossUpper = interpolate( Bmod, Case_45_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_22.5_Loss )
LossUpper = extrapolate( Bmod, Case_45_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 22.5)*LossUpper + (45 - Angle)*LossLower ) / 22.5

endif


if ( 45 =< Angle < 67.5 ) then

if ( Bmod =< 1 ) then
LossLower = Case_45_Loss(0) * Bmod
LossUpper = Case_67.5_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_45_Loss )
LossUpper = interpolate( Bmod, Case_67.5_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_45_Loss )
LossUpper = extrapolate( Bmod, Case_67.5_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 45)*LossUpper + (67.5 - Angle)*LossLower ) / 22.5

endif


if ( 67.5 =< Angle =< 90 ) then

if ( Bmod =< 1 ) then
LossLower = Case_67.5_Loss(0) * Bmod
LossUpper = Case_90_Loss(0) * Bmod
endif

if ( 1 < Bmod =< 1.7 ) then
LossLower = interpolate( Bmod, Case_67.5_Loss )
LossUpper = interpolate( Bmod, Case_90_Loss )
endif

if ( 1.7 < Bmod ) then
LossLower = extrapolate( Bmod, Case_67.5_Loss )
LossUpper = extrapolate( Bmod, Case_90_Loss )
endif


# Now interpolate the loss for the actual angle from the Lower and Upper bounds

ElementLossDensity = ( (Angle - 67.5)*LossUpper + (90 - Angle)*LossLower ) / 22.5

endif

So, saya kena terjemahkan kod nie pd C languange..
Tolonglah dah kebuntuan idea nih..
Reply

Use magic Report

Post time 22-10-2007 05:15 PM | Show all posts
DETAIL : http://www.cprogramming.com/

mane ko tak paham leh refer
Reply

Use magic Report

Follow Us
Post time 23-10-2007 09:59 AM | Show all posts
straightforward aje tuh, top-down pseudocode, just convert je ke C/C++ code. what's the problem, code tak boleh jalan ke? of course tang interpolate and extrapolate tu you kena supply lah, sebab kita tak tau formula untuk interpolation / extrapolation.
Reply

Use magic Report

 Author| Post time 23-10-2007 10:45 AM | Show all posts

Reply #7 shahnazz's post

yg problem tu tang interpolate / extrapolate..code or formula dia tak tahu
Reply

Use magic Report


ADVERTISEMENT


Post time 24-10-2007 08:18 AM | Show all posts
interpolate / extrapolate ini nama method yg ko buat je kan??? method tuh terima 2 parameter then return value double or float


ini penerangan kes

Bmod = sqrt(Bx*Bx + By*By)

FieldAngle = atan(By/Bx)

# Find the angle of the field in the element with respect to the rolling direction

Angle = mod(FieldAngle - RollingAngle)
if ( Angle > 90 ) Angle = 180 - Angle

pastikan ko ada value utk RollingAngle tuh..

if ( Bmod =< 1 ) then
LossLower = Case_0_Loss(0) * Bmod
LossUpper = Case_22.5_Loss(0) * Bmod
endif

cam interpolate( Bmod, Case_45_Loss )
- methd nih terima 2 parameter iaitu Bmod = sqrt(Bx*Bx + By*By), pastikan Bx n By ko letak value sebab dia adalah parameter plg penting..
- paramter kedua cam Case_22.5_Loss(0) ini myb constant shj dn mesti ada value dia contoh
Case_22.5_Loss(0)  = -22.5// ini contoh jealah value dia..
- dan ko akan dapat nilai dalam variable LossUpper n LossLower

end of product hasil carian ko utk LossLower,LossUpper and Angle akan dapatkan nilai ElementLossDensity

ElementLossDensity = ( (Angle - 22.5)*LossUpper + (45 - Angle)*LossLower ) / 22.5

so buleh dikatakan ko hanya nk dapat nilai ElementLossDensity shj..

yg penting apa formula dalam method interpolate( float, float ) n extrapolate( float, float)


float interpolate( float a, float b){
     float LossUpperLower= a*b;//ini aku reka jer..
     return LossUpperLower;
}

float extrapolate( float a, float b){
     float LossUpperLower= a*b;//ini aku reka jer..
     return LossUpperLower;
}
so kita tak tau apa formula dalam function tuh

[ Last edited by  liverpoolfctv at 24-10-2007 08:20 AM ]
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

5-1-2025 09:15 AM GMT+8 , Processed in 0.105036 second(s), 22 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list