Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Check my C code for a mini-project

Status
Not open for further replies.

Elec. Engineer

Newbie level 5
Joined
May 1, 2010
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
UAE
Activity points
1,376
Hello ..
i have a mini project and i need some help ..

the cirteria is as follows:
Please Read Entire Project Description!!

Please create a C program to meet the criteria.

Digital System:
A computer is used to monitor the flow rate of a liquid and the speed of the pump motor in a process control system. The computer will read the value of the speed and display the results on the computer every 5 seconds. The computer will warn the operator if the speed exceeds a specified value entered at the start of the program.

The flow rate of the system is given by the following formula.

flow rate = square_root (speed * tan(Radius/Shaft Length))


Deliverable:
Each assignment must include the Flow Chart and the C Language Code. Please include comments in your C program that explains each section and follows the standard outlined in the Example CASE STUDY in your workbook.

Program Criteria:
At the beginning of the program, the user will enter the system data.

=> Radius of Motor Rotor
=> Shaft Length
(The Radius must be less than the Length or the program will repeat the entering cycle.)
=> Maximum Motor Speed

The computer will display the input speed, the flow rate, and the time of display on the console every 5 seconds.

The computer will fill the screen with 10 lines of data. After that, the program will clear the screen and continue to display the data until another 10 lines and repeats.

The program will save the data in a log txt file “Datalog.txt” so the data can be read at a later date.

The keyboard will be used as a virtual input to the system. The speed range of values accepted by your system is between 33 rev/sec to 126 rev/sec. Refer to the ASCII table to learn how to enter these values from the keyboard. If the input exceeds the maximum value inputted by the operator, the computer will display a warning message and output a warning “beep”.

[/GVideo]\]
 

Re: mini project help

What type of help do you actually need?
Start coding and we can guide you with problems you meet.
 

mini project help

sure .. i'm going to start tomrrow co'z i don't have the program right now ..
 

Re: mini project help

We are waiting for it.
Good luck
 

mini project help

I programmed it as follow ,, but it doesn't work as the same of what i want ..

Code:
#include <stdio.h> 
#include <windows.h> 
#include <conio.h> 
#include <math.h> 
#include <time.h> 

void clrscr(void); 
void sleep (clock_t); 

void main(void) 
{ 

//Declare 

char speed; 
float radius; 
float length; 
float flow_rate; 
time_t t; 

//Initialize 


radius = 0; 
length = 0; 
speed = 0; 
flow_rate = 0; 



printf("\n\tProcess Control System.\n"); 
printf("\n\tThis Program will monitor the speed of a pump motor and a flow sensor.\n"); 

printf("\n\tThe user will enter the parameters of the system and start\n"); 
printf("\tthe system. The user can enter different values of speed by\n"); 
printf("\tpressing any key. The escape key will stop the system.\n"); 

repeat: 
printf("\n\n\tPlease enter the rotor radius in cm => "); 
scanf("%f",&radius); 

printf("\n\n\tPlease enter the shaft length in cm => "); 
scanf("%f",&length); 



if(radius <= length) 
{ 

printf("\n\n\tPlease enter the maximum speed => "); 
scanf("%c",&speed); 


flow_rate = sqrt(speed*tan(radius/ length)); 



time(&t); 

printf("\n\tspeed<m/s>\tflow rate <1/s>\tCurrent time\n\n"); 
printf("\t%c\t%f\t%s\n",speed,flow_rate,ctime(&t)); 




goto repeat; 
} 


else 

{ 

clrscr(); 
printf("\n\tTry again.\n\n"); 


goto repeat; 

} 

} 






void clrscr(void) 


{ 
HANDLE hndl = GetStdHandle(STD_OUTPUT_HANDLE); 
CONSOLE_SCREEN_BUFFER_INFO csbi; 
GetConsoleScreenBufferInfo(hndl, &csbi); 
DWORD written; 
DWORD N = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X + 1; 
COORD curhome = {0,0}; 
FillConsoleOutputCharacter(hndl, ' ', N, curhome, &written); 
csbi.srWindow.Bottom -= csbi.srWindow.Top; 
csbi.srWindow.Top = 0; 
SetConsoleWindowInfo(hndl, TRUE, &csbi.srWindow); 
SetConsoleCursorPosition(hndl, curhome); 
} 

void sleep(clock_t delay) 
{ 
clock_t stoptime; 
stoptime = delay + clock(); 
while( stoptime > clock() ){ ; } 
}
MOD: Always use "Code" option while uploading your Programs which will neatly present it.
 

mini project help

You may need to delete the line

Code:
goto repeat;

from the if statement and move the other

Code:
goto repeat;

out of the else body.
 

mini project help

omg, don't use goto in C unless you have a really really really (really) good reason. For repeating you have do, while and for.

Please use code tags for posting code.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top