project(200分)

  • 主题发起人 主题发起人 leo_aj
  • 开始时间 开始时间
L

leo_aj

Unregistered / Unconfirmed
GUEST, unregistred user!
hi,everyone:
I Study in MIT. now i got the final project for this semester.
i like delphi very much, so like share the experience with you guys.
This project is about simulation. you can look the specification later. It is not
very easy actually, maybe for you not. now, for me i thought i finish 30%.
hope you can finish it soon(have to within two weeks).
i'll be glad to do with you .
if you choose it, or interest about it, i can send some handout about simulation.

Hints:
you can divide this wire into lots of pieces. and can creat a unit for piece, which
type is TPanel. create another for wire, which type is Tlist. so very piece is a items
of that wire(Twire).

ok, good lucky.

you can send me email (leo_aj@zfee.co.nz) if you need some help.
finally, i need your whole project.
NOTE: have to finish before 16/10/00



6D70 Introduction to Computer Science

Projects



Heated wire

Electric current flows through a piece of conductive wire of a given length and cross-section. The wire's ends are terminated with ideal heatsinks, always keeping the temperature at a given, fixed value. Assuming that no energy from the wire is radiated, the entire energy of the electric current is converted to heat and flows to the terminating heatsinks, according to the equation:


where:
k thermal conductivity of the wire material
l wire length
A wire cross-section
DT temperature difference

The resistivity of the wire material varies with temperature according to the formula:



where:
r resistivity of the wire material at temperature T
resistivity of the wire material at room temperature
a resistivity temperature coefficient
T the temperature of the material
room temperature = 293.15 K

Recall that the resistance of a piece of wire is given by:


where:
r resistivity of the wire material
l wire length
A wire cross-section

Recall also that, when a current I flows through a resistance R, the dissipated thermal power is given by:



Simulate the behaviour of the wire. Assume that a fixed DC voltage source is connected at the beginning of the simulation, when the wire is cold (i.e. its temperature equals the temperature of the heatsinks).



Allow the user to modify the following parameters:

Parameter Symbol Unit Range Default value
wire length Lwire m 0.05 - 1 0.1
wire cross-section Swire m2 10-8 - 10-6 10-7
wire material thermal conductivity Kwire W.(m.K)-1 20 - 450 393
wire material room temp. resistivity R0 W.m 1.65´10-6 - 5´10-5 1.78´10-6
wire material resistivity coefficient Awire K-1 0.002 - 0.006 0.00392
heatsink temperature Tsinks K 0 - 1000 293.15
voltage Vwire V 10-3 - 102 10-2
wire material melting point Tmelt K 600 - 3700 1356.15


An appropriate graphical representation, continuously showing the current distribution of temperatures along the wire, is required. This can be achieved by mapping temperature values to different colours.


One (spectacular) experiment you can conduct using this program may consist of adjusting the simulation parameters to demonstrate a situation when the middle section of the wire reaches melting point, at which moment the wire disintegrates and stops conducting.





 
MIT 是哪里啊?国外的?
 
呵呵,MIT = 麻省理工学院
太长了,看着费劲
 
Give me some $; I can help you !
wait for a minture ...
Are you a Chinese Girl ? I like Girls.
What ... Oh ! my god! Maybe I can't help you now !
Some girls need my help, I have to go!

(玩笑的开,时间的给我,慢慢的翻译 ,改天的回答,OK?)


 
可以结束了,早过了结束期2000.10.16
 
在 zyy04 的提醒下,GGCAT 发现面包上已经长了很长的霉。
他只好轻轻地放下,长长地叹了口气,转身走了....
 
to GGCAT:
你真Humor.
 
HI, folks:
First, i got to say to GGCAT, i really hope u r girls, cause u name sounds like
girl's name, CAT. why don't call uself CATKing. much better, at least, can't make
a misstake. joking. ^_^ . by the way, like to be friend with u.

I Already finish that project, if anyone feel interesting about that,
send your souce code. FREE!!!. listen, GGCAT. free.
 
I am interesting
 
MIT 的学生还有时间到这儿来瞄瞄?
 
give me your E-mail.
i gonna clear something, my university in another country, but not in US.
 
细看LEO_AJ的历史提问,居然发现书有我们伟大的方块字!!!
如果是外国人,就厉害!
如果是中国人,就颓废咯!:)

别生气啊!来灌水,想捞些¥
 
Finally result. just for reference.


unit Main;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls,piece,Wire, Spin,math,MMSystem, TeeProcs, TeEngine,
Chart, Series,bullet_proofing;

type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Lcs: TLabel;
Lrtr: TLabel;
Lrc: TLabel;
Lht: TLabel;
Lmc: TLabel;
Lvoltage: TLabel;
Lmp: TLabel;
ELen: TEdit;
Esc: TEdit;
Ertr: TEdit;
Erc: TEdit;
Eht: TEdit;
Emc: TEdit;
Evoltage: TEdit;
Emt: TEdit;
Label9: TLabel;
Timer1: TTimer;
Panel2: TPanel;
Label2: TLabel;
Label3: TLabel;
LTime1: TLabel;
SETime: TSpinEdit;
LTime2: TLabel;
Start: TButton;
Reset: TButton;
Lsink: TPanel;
Panel3: TPanel;
Lsegment: TLabel;
Esegment: TSpinEdit;
Chart1: TChart;
Series1: TLineSeries;
Lwarning: TLabel;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure initialise;
procedure FormCreate(Sender: TObject);
procedure ResetClick(Sender: TObject);
procedure StartClick(Sender: TObject);
procedure EditExit(Sender: TObject);
procedure Chart1AfterDraw(Sender: TObject);
private
{ Private declarations }
counter:integer;
piece:Tpiece;
totalresistor:extended;
wire:TWire;
proof:Tbullet_proofing;
public
{ Public declarations }

end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
var
i:integer;
begin
timer1.interval:=trunc(power(10,SETime.value));
counter:=counter+1;
LTime2.caption:=inttostr(counter);
Tpiece(wire.items[0]).Tleft:=piece.ht;
wire.totalresistance(wire,totalresistor);
for i:=0 to (wire.count div 2) -1 do
begin
wire.AnimateStep(wire,i,piece,totalresistor,Timer1,series1); //does it this wire specify wire
if Tpiece(wire.items).Taverage>=piece.meltPoint then
begin
timer1.enabled:=false;
PlaySound ('',0, snd_Async);
lwarning.Caption:='Fusing the Wire !';
series1.clear;
exit; // prevent the Buzzer keep ringing.
end;
end;

for i:=wire.count div 2-1 downto 0 do
begin
timer1.enabled:=false;
series1.add(Tpiece(wire.items).Taverage,'',clred);
timer1.Enabled:=true; // add another half wire's chart
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.enabled:=false;
counter:=0;
wire:=Twire.create;

end;

procedure TForm1.initialise;
begin
piece.Mrc:=strtofloat(erc.text);
piece.Mrtr:=strtofloat(ertr.text);
piece.CrossSection:=strtofloat(esc.text);
piece.Mtc:=strtofloat(emc.text);
piece.Ht:=strtofloat(eht.text);
piece.Plength:=strtofloat(Elen.text)/60;
piece.meltPoint:=strtofloat(emt.text);
wire.voltage:=strtofloat(evoltage.text);

end;

procedure TForm1.ResetClick(Sender: TObject);
var
i:integer;
begin
if Reset.caption='Reset' then
begin
start.enabled:=false;
Timer1.Enabled:= FALSE;
counter:=0;
Lwarning.Caption:='';
LTime2.Caption:='0';
Reset.Caption:='Set';
Start.caption:='Start';
while wire.Count>0 do
begin
TPiece(wire.Last).Free;
Wire.Remove(wire.Last);
series1.clear
end;
end
else
begin
for i:=0 to Esegment.Value-1 do
begin
piece:=Tpiece.create(self);
initialise;
piece.parent:=self;
piece.Height:=10;
piece.width:=trunc(460/Esegment.Value);
piece.color:=clblack;
piece.BevelOuter:=bvnone;
piece.x:=330+piece.width div 2+i*piece.width ;
piece.y:=502;
wire.Add(piece);
Tpiece(wire.items).resistivity:=piece.ht;
end;
panel3.left:=Tpiece(wire.items[wire.count-1]).left+Tpiece(wire.items[wire.count-1]).width;
start.enabled:=true;
Reset.caption:='Reset';
end;
end;

procedure TForm1.StartClick(Sender: TObject);
begin
if Start.Caption='Start' then
begin
Timer1.Enabled:= true;
start.Caption:= 'Pause';

end
else
begin
Timer1.Enabled:= False;
Start.Caption:= 'Start';

end
end;

procedure TForm1.EditExit(Sender: TObject);
begin
proof.bulletProofing(sender,Elen,esc,emc,ertr,erc,eht,evoltage,emt,esegment,reset);
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
series1.clear;
end;

end.


unit Piece;

interface
uses
extctrls,graphics,forms;
type
Tpiece=class(Tpanel)
private

FResistivity:extended;
FTleft:extended;
FTright:extended;
FTaverage:extended;
Fpower:extended;
Fy:integer;
FX:integer;

public

Mrtr:extended;
CrossSection:extended;
Mrc:extended;
Mtc:extended;
Ht:extended;
meltPoint:extended;
Plength:extended;
procedure SetX(value:integer);
procedure Sety(value:integer);
procedure Setpower(value:extended);
function getResistor:extended;
procedure SetTleft(value:extended);
procedure SetTright(value:extended);
procedure setResistivity(value:extended);
property Resistor : extended read getResistor;
property Tleft : extended read FTleft write SetTleft;
property Tright: extended read FTright write SetTright;
property Taverage: extended read FTaverage write FTaverage;
property power : extended read Fpower write setpower;
property X:integer read Fx write SetX;
property Y:integer read Fy write Sety;
property Resistivity : extended read FResistivity write setResistivity;
end;


implementation

procedure Tpiece.SetTright(value:extended);
begin
FTright:=((Plength*power)/(mtc*CrossSection))+value;
FTaverage:=(Tright+Tleft)/2;
resistivity:=Taverage;
end;

procedure Tpiece.SetTleft(value:extended);
begin
FTleft:=value;
end;

procedure Tpiece.SetResistivity(value:extended);
const T0=293.15;
begin
FResistivity:=Mrtr*(1+mrc*(value-T0)); //value is current temperature
end;

function Tpiece.getResistor:extended;
begin
result:=resistivity*plength/CrossSection;

end;

procedure Tpiece.Setpower(value:extended);
begin
Fpower:=sqr(value)*Resistor;
end;

procedure Tpiece.SetX(value:integer);
begin
FX:=value;
left:=value-width div 2;
end;

procedure Tpiece.Sety(value:integer);
begin
Fy:=value;
top:=value-height;
end;



end.


unit Wire;

interface
uses
piece,classes,Graphics,extctrls,MMSystem,windows,Series,color;

type
TWire=class(Tlist)
private

public
voltage:extended;
procedure Current(wire:Twire;i:integer;totalresistor:extended);
procedure AnimateStep(wire:Twire;i:integer;piece:Tpiece;totalresistor:extended;timer1:TTimer;Series1:TLineSeries);
procedure totalresistance(wire:Twire;var totalResistor:extended);
procedure Drawchart(wire:Twire;i:integer;Series1:TLineSeries;timer1:TTimer);

end;
implementation

procedure Twire.Current(wire:Twire;i:integer;totalresistor:extended);
begin
Tpiece(wire.items).power:=voltage/totalresistor;
end;

procedure Twire.totalresistance(wire:Twire;var totalResistor:extended);
var
j:integer;
begin
totalresistor:=0;
for j:=0 to wire.count-1 do
totalresistor:=Tpiece(wire.items[j]).resistor+totalResistor;
end;

procedure TWire.AnimateStep(wire:Twire;i:integer;piece:Tpiece;totalresistor:extended;timer1:TTimer;Series1:TLineSeries);
begin

wire.current(wire,i,totalresistor);
Tpiece(wire.items).Tright:=(Tpiece(wire.items).Tleft);
Tpiece(wire.items[i+1]).Tleft:=Tpiece(wire.items).Tright;
Tpiece(wire.items).color:=HSL_To_RGB(trunc(Tpiece(wire.items).Taverage)*10000);
Tpiece(wire.items[count-i-1]).color:=HSL_To_RGB(trunc(Tpiece(wire.items).Taverage)*10000);
wire.Drawchart(wire,i,series1,timer1); // i 'v to enlage the tempture 10000, otherwise can not see tempture changing
end; //for detail, please see the user guide for tempture.

procedure Twire.Drawchart(wire:Twire;i:integer;Series1:TLineSeries;timer1:TTimer);
begin
timer1.enabled:=false;
with Series1 do
begin
add(Tpiece(wire.items).Taverage,'',clred);
end;
timer1.enabled:=true;
end;

end.


unit bullet_proofing;

interface
uses
sysutils,stdctrls,spin,Dialogs;

type
EoutofRange=class(Exception);
Tbullet_proofing=class
procedure bulletProofing(Sender: TObject;Elen,esc,emc,ertr,erc,eht,evoltage,emt:TEdit;esegment:Tspinedit; reset:Tbutton);
end;

implementation

procedure Tbullet_proofing.bulletProofing(Sender: TObject;Elen,esc,emc,ertr,erc,eht,evoltage,emt:TEdit;esegment:Tspinedit; reset:Tbutton);
begin
try
if sender=Elen then
if (strtofloat(Elen.text)>1) or (strtofloat(Elen.text)<0.05) then
raise Eoutofrange.create('');
if sender=Esc then
if (strtofloat(Esc.text)<1e-8) or (strtofloat(Esc.text)>1e-6) then
raise Eoutofrange.create('');
if sender=Emc then
if (strtofloat(Emc.text)<20) or (strtofloat(Emc.text)>450) then
raise Eoutofrange.create('');
if sender=Ertr then
if (strtofloat(Ertr.text)<1.65e-6) or (strtofloat(Ertr.text)>5e-5) then
raise Eoutofrange.create('');
if sender=Erc then
if (strtofloat(Erc.text)<0.002) or (strtofloat(Erc.text)>0.006) then
raise Eoutofrange.create('');
if sender=Eht then
if (strtofloat(Eht.text)<0) or (strtofloat(Eht.text)>1000) then
raise Eoutofrange.create('');
if sender=Evoltage then
if (strtofloat(Evoltage.text)<1e-3) or (strtofloat(Evoltage.text)<1e-2) then
raise Eoutofrange.create('');
if sender=Emt then
if (strtofloat(Emt.text)<600) or (strtofloat(Emt.text)>3700) then
raise Eoutofrange.create('');
if sender=Esegment then
if Esegment.value mod 2 =1 then
raise EoutofRange.create('');
Reset.enabled:=true;
if sender<>elen then elen.Enabled:=true;
if sender<>esc then esc.enabled:=true;
if sender<>emc then emc.enabled:=true;
if sender<>ertr then ertr.enabled:=true;
if sender<>erc then erc.enabled:=true;
if sender<>eht then eht.enabled:=true;
if sender<>evoltage then evoltage.enabled:=true;
if sender<>emt then emt.enabled:=true;
if sender<>esegment then esegment.enabled:=true;
except
on E:Exception do
begin
Reset.enabled:=false;
if sender<>elen then elen.enabled:=false;
if sender<>esc then esc.enabled:=false;
if sender<>emc then emc.enabled:=false;
if sender<>ertr then ertr.enabled:=false;
if sender<>erc then erc.enabled:=false;
if sender<>eht then eht.enabled:=false;
if sender<>evoltage then evoltage.enabled:=false;
if sender<>emt then emt.enabled:=false;
if sender<>esegment then esegment.enabled:=false;
if sender=elen then raise Eoutofrange.create('exceed the default range[0.05,1], or input string ');
if sender=esc then raise Eoutofrange.create('exceed the default range[1E-8,1E-6], or input string');
if sender=emc then raise Eoutofrange.create('exceed the default range[20,450], or input string');
if sender=ertr then raise Eoutofrange.create('exceed the default range[1.65E-6,5E-5], or input string');
if sender=erc then raise Eoutofrange.create('exceed the default range[0.002,0.006], or input string');
if sender=eht then raise Eoutofrange.create('exceed the default range[0,1000], or input string');
if sender=evoltage then raise Eoutofrange.create('exceed the default range[1E-3,1E-2], or input string');
if sender=emt then raise Eoutofrange.create('exceed the default range[600,3700], or input string');
if sender=esegment then raise EoutofRange.create('must input even number');

end;
end;
end;


end.



unit Color;

interface
uses
Graphics;

type
ColorHSLQuad=Record
Case Integer of
0:(DW:LongWord);
1:(H:Byte; //0-240 which is hue
S:Byte; //0-240 which is color saturation
L:Byte; //0-240 which is brilliance
Reserved:Byte);
end;
ColorRGBA=Record
Case Integer of
0:(DW:LongWord);
1:(R:Byte;
G:Byte;
B:Byte;
A:Byte);
End;
Function HSL_To_RGB(HSL:LongWord):TColor;
Function VALUE(n1,n2,hue:Integer):Byte;

implementation




Function HSL_To_RGB(HSL:LongWord):TColor;
Var m1,m2:Integer;
C:ColorRGBA;
CH:ColorHSLQuad;
Begin
CH.DW:=HSL;
IF CH.S=0 then
begin
C.R:=CH.L*51 div 48;
C.G:=C.R;
C.B:=C.R;
C.A:=0;
Result:=C.DW;Exit;
End else
Begin
if CH.L<=120 then m2:=(CH.L+CH.L*CH.S Div 240)*51 Div 48
else m2:=(CH.L+CH.S-(Ch.L*Ch.s) Div 240)*51 div 48;
m1:=(CH.L*51 div 24)-m2;
C.R:=VALUE(m1,m2,CH.H+80);
C.G:=VALUE(m1,m2,CH.H);
C.B:=VALUE(m1,m2,CH.H-80);
End;
C.A:=0;
Result:=C.DW;
End;

Function VALUE(n1,n2,hue:Integer):Byte;
Begin
if (hue>240) then Dec(Hue,240)
else if(hue<0) then Inc(Hue,240);
if (hue<40) then
Result:=((n1+(n2-n1)*hue div 40))
else if (hue<120) then
Result:=(n2)
else if (hue<160) then
Result:=((n1+(n2-n1)*(160-hue) div 40))
else Result:=(n1);
end;

end.
 
It's too long to read in short time!
So I have to copy it to disk and read it.
And it's well if you gave us some accounting.
 
多人接受答案了。
 
后退
顶部