主题:警急求助啊。。。。。实在没办法了。
你好。 我是一名刚到英国剑桥留学的大学生 现在我的导师限我在3天之内完成一个PASCAL 的编程。。 由于我以前从未接触过这类的训练 所以 只能请求帮助 可以帮我么? 不胜感激。。
Project: Frequency Domain Nodal Analysis
The project requires you to write a frequency domain nodal analysis program. This means that impedances/admittances will replace the resistances/conductances in your nodal analysis program and so your Gaussian Elimination code will have to cope with real and imaginary coefficients.
Initially write your program so that the user specifies (in a text file, specified below) inductances, capacitances, resistances and a single, specific, frequency of operation. This allows the relevant impedances to be computed and hence the equations to be constructed. Once this is working the user should be able to specify a start frequency, a stop frequency and a frequency step. The program will repeat its entire calculation with each frequency in the desired range:
Input inductances, capacitances, resistances and current sources from file.
Specify start, stop and step frequencies from file.
Set frequency:= start frequency.
For this frequency, compute solution by nodal analysis.
Increment frequency by step frequency.
Return to step 4, unless frequency>stop frequency.
In this laboratory it is strongly suggested that you produce a flow chart of your program. The demonstrators will be on hand to give you advice. Remember that you’ve already written functions that implement complex arithmetic.
The Input File Specification
Nodes are numbered 1, 2, 3 etc, with node 0 being the reference node. Your program may assume that only one component is connected between each node. The speicification for the input file is:
A single character denoting the type of component:
- R=resistor, C=capacitor, L=inductor, I=current source.
- Or F to specify frequency (see below).
- Or P to specify the node of interest (see below).
- Or E if this is the last line of the file.
If the character is R, C, L or I it is followed by a space and then two integers (separated by spaces) specifying the nodes connected by the component, and then a real value for the value of the component.
If the character is F it is followed by an integer number denoting the number of frequency points required and two real values denoting the highest and lowest frequency values.
If the character is P it is followed by an integer number denoting the node of interest (for which the results are required).
Example files:
L 1 2 5.00E-03
R 2 3 500
C 3 0 4.70E-09
I 1 0 1.0
F 3 30E+03 40E+03
P 2
E
This example is for a series LCR circuit driven by a 1A current source. 3 frequency points are requested – one at 30kHz, one at 35kHz and one at 40kHz. The value of node 2 (the connection between the resistor and inductor) is of interest.
The Output File
The magnitude and phase of the voltage at the node of interest should be written to a text file which has 3 columns: frequency, magnitude and phase. Provided you remember to close the file when you have finished, you would be able to graph this data for your report using most graphing programs (e.g. Excel, Matlab).
Example file:
3.00E+03 5.001E-01 4.50E+01
3.50E+03 2.341E+00 4.20E+01
4.00E+03 1.011E+00 2.50E+01
(note: these are fictitious values!).
The Report
A report on your project is required:
Describe how you planned your program.
Where and why did you need to use Sequencing, Selection and Looping?
Describe how you identified and implemented sub-programs. Were you able to reuse procedures and functions from other programs?
How did you test your program? Did you write it all and then test it, or did you write and test each piece as you went along? Include results for example circuits.
What problems did you encounter? How did you resolve them?
How might your program be improved?
Your report should include a print-out of your program. The report should be accompanied by a floppy disk containing the executable (.exe) file. Each program will be run by the marker, using an example file similar to that above – if the program does not accept the example input file format, it will not be tested and all marks for a working program will be lost.
As your program will produce an answer for a number of frequencies it is sensible to plot graphs of nodal voltage against frequency. You can achieve this using Matlab, Excel or any other graph-drawing program to display and print the data (as described above).
Extra marks are available if you enable the user to specify voltage sources between nodes.
No extra marks will be awarded for using Delphi GUI elements (buttons, forms etc). If however you want to experiment with these or find using them useful in your own testing of your program, you are welcome to do so (note the optional notes in Chapter 9 of these notes and the chapter on "Introduction to Delphi" in Mastering Pascal and Delphi Programming).
Project: Frequency Domain Nodal Analysis
The project requires you to write a frequency domain nodal analysis program. This means that impedances/admittances will replace the resistances/conductances in your nodal analysis program and so your Gaussian Elimination code will have to cope with real and imaginary coefficients.
Initially write your program so that the user specifies (in a text file, specified below) inductances, capacitances, resistances and a single, specific, frequency of operation. This allows the relevant impedances to be computed and hence the equations to be constructed. Once this is working the user should be able to specify a start frequency, a stop frequency and a frequency step. The program will repeat its entire calculation with each frequency in the desired range:
Input inductances, capacitances, resistances and current sources from file.
Specify start, stop and step frequencies from file.
Set frequency:= start frequency.
For this frequency, compute solution by nodal analysis.
Increment frequency by step frequency.
Return to step 4, unless frequency>stop frequency.
In this laboratory it is strongly suggested that you produce a flow chart of your program. The demonstrators will be on hand to give you advice. Remember that you’ve already written functions that implement complex arithmetic.
The Input File Specification
Nodes are numbered 1, 2, 3 etc, with node 0 being the reference node. Your program may assume that only one component is connected between each node. The speicification for the input file is:
A single character denoting the type of component:
- R=resistor, C=capacitor, L=inductor, I=current source.
- Or F to specify frequency (see below).
- Or P to specify the node of interest (see below).
- Or E if this is the last line of the file.
If the character is R, C, L or I it is followed by a space and then two integers (separated by spaces) specifying the nodes connected by the component, and then a real value for the value of the component.
If the character is F it is followed by an integer number denoting the number of frequency points required and two real values denoting the highest and lowest frequency values.
If the character is P it is followed by an integer number denoting the node of interest (for which the results are required).
Example files:
L 1 2 5.00E-03
R 2 3 500
C 3 0 4.70E-09
I 1 0 1.0
F 3 30E+03 40E+03
P 2
E
This example is for a series LCR circuit driven by a 1A current source. 3 frequency points are requested – one at 30kHz, one at 35kHz and one at 40kHz. The value of node 2 (the connection between the resistor and inductor) is of interest.
The Output File
The magnitude and phase of the voltage at the node of interest should be written to a text file which has 3 columns: frequency, magnitude and phase. Provided you remember to close the file when you have finished, you would be able to graph this data for your report using most graphing programs (e.g. Excel, Matlab).
Example file:
3.00E+03 5.001E-01 4.50E+01
3.50E+03 2.341E+00 4.20E+01
4.00E+03 1.011E+00 2.50E+01
(note: these are fictitious values!).
The Report
A report on your project is required:
Describe how you planned your program.
Where and why did you need to use Sequencing, Selection and Looping?
Describe how you identified and implemented sub-programs. Were you able to reuse procedures and functions from other programs?
How did you test your program? Did you write it all and then test it, or did you write and test each piece as you went along? Include results for example circuits.
What problems did you encounter? How did you resolve them?
How might your program be improved?
Your report should include a print-out of your program. The report should be accompanied by a floppy disk containing the executable (.exe) file. Each program will be run by the marker, using an example file similar to that above – if the program does not accept the example input file format, it will not be tested and all marks for a working program will be lost.
As your program will produce an answer for a number of frequencies it is sensible to plot graphs of nodal voltage against frequency. You can achieve this using Matlab, Excel or any other graph-drawing program to display and print the data (as described above).
Extra marks are available if you enable the user to specify voltage sources between nodes.
No extra marks will be awarded for using Delphi GUI elements (buttons, forms etc). If however you want to experiment with these or find using them useful in your own testing of your program, you are welcome to do so (note the optional notes in Chapter 9 of these notes and the chapter on "Introduction to Delphi" in Mastering Pascal and Delphi Programming).