EENG6670 MAAP Course – Engine Control Lab

Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due

EENG6670 MAAP Course – Engine Control Lab
Title: M/Comp Architecture (MAAP) – Engine Control Lab
Module: EENG6670 Embedded Computer Systems
Work Setter: Philippos Assimakopoulos
Assessment: This assignment contributes 17.5% of the module.
Deadline: Submission deadline (Group 13): 12:00 noon, Thu 20 Feb (KV Week 29)
Marked work return date: Week 36
Submit: On line (Moodle)
Intended Learning Outcomes:

This assignment contributes to the assessment of the EENG6670 learning outcomes:

8.1 Demonstrate an understanding of the design and operation of embedded systems;

8.2 Demonstrate an understanding of real time software and hardware system requirements;

8.3 Demonstrate practical experience of embedded systems based on case studies and laboratory experiments.
Feedback method: Feedback will be via: Comments on Moodle; Written comments on work; Verbal comments in class. Further feedback will be available on request.

You are reminded of the University rules on Academic Integrity as stated in the student handbook. Examples of conduct regarded as a breach of these regulations include:

• Plagiarism: reproducing in any work submitted for assessment or review (for example, examination answers, essays, project reports, dissertations or theses) any material derived from work authored by another, without clearly acknowledging the source
• Duplication of Material
• Conspiring with others to reproduce the work of others without proper
acknowledgement, including knowingly permitting work to be copied by another student
• Falsification of data/evidence. 2
EENG6670 MAAP Course – Engine Control Lab
Please note that IET accreditation requires that when coursework contributes 30% or more of a
module then credit cannot be obtained if either your coursework or examination scores are
more than 10% below the module pass mark. This is irrespective of your module overall mark.

%
Marking Criteria
>70
The work is very clearly presented and structured demonstrating very good analytical abilities. The writing is analytical and at very high technical level using appropriate and succinct technical terminology. Assumptions are clearly stated and values with correct units are used. High standard engineering practice is demonstrated. Comparisons, judgements and critical assessments are made where appropriate demonstrating high level of understanding of the individual components and of the integrated system. Appropriate selection, application and evaluation of register configurations is demonstrated for each task. Understanding beyond the provided teaching materials may be demonstrated. Appropriate laboratory testing is used to verify the claims made for all tasks. Oscilloscope and LCD screenshots showing design outputs are clearly explained and discussed at a high technical level.
60-69
Good presentation and structure with little or no ambiguity or omitted stages. Demonstration of good analytical abilities with writing at good technical level. Assumptions are clearly stated and values with correct units are used. High standard engineering practice is demonstrated. Comparisons, judgements and critical assessments are made where appropriate, demonstrating good level of understanding of the individual components and the integrated system, although for some tasks may be lacking in technical detail. Appropriate selection, application and evaluation of register configurations is demonstrated for each task, albeit not to a high technical detail for all tasks. Appropriate laboratory testing is used to verify the claims made for most tasks. Oscilloscope and LCD screenshots showing design outputs for most tasks are clearly explained and discussed at a good technical level.
50-59
Acceptable presentation and method. Demonstration of some analytical ability with writing at good technical level although some tasks may lack technical detail or contain some errors. Some designs choices may be incorrect though the method is broadly appropriate. Appropriate selection, application and evaluation of register configurations is demonstrated but not for all tasks. Discussions are present but may lack clarity while a number of crucial control register constructs and design choices are not discussed in any detail. Good level of understanding is demonstrated for some of the tasks. Laboratory testing is used to verify the claims made for the attempted tasks. Oscilloscope  and LCD screenshots showing design outputs for the attempted tasks are explained but explanations may lack technical detail or contain some errors.
40-49
A significant amount of the required work is submitted, but there are multiple errors in the design method. The report contains significant errors, with some level of understanding demonstrated occasionally. The presentation is not clear and lacks the necessary technical detail. There may be errors in the design solution for a task but the methodology is broadly appropriate.
0-39
 Only a small amount of the required work is submitted, the structure and presentation are very unclear and difficult to follow. Many errors in the design solution for all or most of the tasks, and little evidence of understanding.

Engine Control Lab – Lab Group 13
EENG6670: Microcomputer Applications, Architectures and Performance (MAAP)

Introduction
This experiment supports some of the material in the MAAP lectures. You will look at a real-time system problem, generating the spark in an internal combustion engine.
Safety
This experiment has been reviewed under the Control of Substances Hazardous to Health (COSHH) regulations with a conclusion that there are no hazards covered by this act. The equipment has a revolving disc which may cause minor abrasions if touched while in operation. As with any electrically operated equipment, you should take care not to short out power supplies so metallic objects such as pens and watches should be kept clear.

Assessment

This experiment will be assessed by means of a formal report (as a guideline of about 10-12 sides, including diagrams and code listings) (note: do not list the whole code in your report as part of your answer to each task. Instead, only sections of code that relate to the task and where code modifications have been made). As a guide, you should spend about 6 hours on this and you can return to the lab to finish off or check results if you wish. You should each separately prepare your formal report. The emphasis should be on what you did and discovered with a discussion of these discoveries rather than a restatement of this script. For this reason, you should keep detailed records of your activities in an open Word document or note book including screenshots of the oscilloscope trace and the MBED LCD display which you must include in your final report with your answer to each part/question. Make sure you caption each screenshot properly and refer to it when you are providing your answer to each part/question.

Background theory for this lab is provided through the MAAP lecture 10 slideset/recording on Moodle.

Throughout this script you will find questions/topics which I would like you to answer and discuss in the report.

The Experiment

Rather than writing an exhaustive script for this experiment, I have outlined the aims and method of each section. Generally, text in italics is used for aspects you will observe or carry out in the lab. Text in bold is used for questions you have to answer. Text in red is used for additional hints on each topic.

Note: Avoid the use floating point variables and math in any of the calculations you implement within the code – it’s too slow.

Please feel free to ask questions of the demonstrator and lecturer during or after the demonstrated sessions (please include both in your email):

Demonstrators: George Frangulea ([email protected]), Hazim Abdulsada ([email protected])
Lecturer: Philippos Assimakopoulos ([email protected])
Preamble
Before starting the lab, go through the background theory (MAAP lecture 10 slideset and recording onMoodle). If you haven’t used the MBED for some time, remember to check your MBED login prior to the lab and make sure it works (you will need it for the lab).
Note: Make sure that you stay within your allocated lab group and work on the correct lab script version as the lab script changes every week. Submissions that are not for the correct lab group script willreceive zero marks.

PART 1 [1 Mark]

In the lab we do not have a real petrol engine. Instead, we use a circuit board with a rotating disc/flywheel (rotating counter-clockwise) to simulate some aspects of a petrol engine. The rotating disc can be made to spin at different rotational speeds (rpm). It has a TDC sensor and small hole in the disc to view LEDs. It also has some LEDs in the board that light up when the disc is at TDC and when you get a spark (the demonstrator will answer any questions you may have regarding the setup).

Log on to the MBED Keil Studio Cloud and create a new design called “measure”. Copy and paste the file measure.cpp from Moodle into your new design. The program uses the LCD12832 display to print out results, so you will need to import the LCD12832_lcd library into your design.

Connect the black flying lead from the flywheel to the GND pin of the MBED, and the TDC output (red lead) to pin 30. Compile, download and run the project ‘measure’. Observe the program’s output on the LCD Display and/or the PC using Tera Term (a terminal emulator) (example LCD output is shown in Fig.1).

Fig. 1. Example of information displayed on the LCD display

The measure.cpp program uses the MBED’s CAP2.0 capture pin (pin 30) and Timer 2 to measure the rotational period of the disc. Go through the code (use the course lecture slides as reference if needed) and ensure that you understand how the program works.

Use the oscilloscope to look at the TDC pulse. It would look similar to Fig. 2 (note: if you are unfamiliar with the operation of an oscilloscope, ask the demonstrator).

Fig. 2. Oscilloscope view of TDC pulses. Note that measurement markers have been placed such that the

period (Δt) between two consecutive TDC pulses can be measured.

Using the scope, determine and explain the relationship between the rotational period displayed by the program (in the LCD) and the timings measured using the oscilloscope – i.e, work out and state what a change of ‘1’ in the displayed LCD value corresponds to in actual time. Explain and note this in your report. Relate your answer to how the code in measure.cpp is implemented.

[Hint: Check the code, especially for the Timer2_init() function, try to work out the period of Timer Counter 2 which is based on the pre-scaler value and the main frequency of the MBED core chip (the LPC1768 microcontroller). Once you have done this, you should be able to explain the relationship between the period displayed in LCD and the measured Δt from oscilloscope.]

Useful notes (based on the Lecture 10 slideset):

  • The disc represents the crankshaft of the engine.
  • Pistons are normally attached to the crankshaft and they slide up and down within cylinders.
  • When the piston is at the top of its travel within the cylinder, it is said to be at Top Dead Centre (TDC). It is from here that the angles are measured i.e. it is 0°.
  • The TDC sensor gives a positive pulse of about 4 milliseconds when the piston is at TDC. The rising edge (seen for example in Fig.2) represents TDC.

PART 2 [2 Marks]

Add a digital output called something like ‘spark’ on pin 12 to the measure.cpp code, to generate a "spark" at TDC with a duration of 0.5 ms.

Attach the white lead (spark wire) to your spark output and use the scope to observe the TDC sensor output and the spark. Sketch/Capture the result.

Useful notes (based on the Lecture 10 slideset):


  • In this context a "spark" is a short positive pulse of 0.5 millisecond duration. It should be generated on the specified MBED pin which needs to be connected to the engine simulator. There, the spark pulse causes the LEDs to flash briefly.
  • There is a small hole in the disc to view the LEDs. Since the LEDs are at a point just before TDC, in this instance you will not see them by looking from above. [The disc rotates anti clockwise]. They will be visible from the side.
  • The simplest way to generate the spark is to set the spark output high at TDC, then wait for 0.5 millisecond before setting it low again. Note – You will need to configure the Spark output pin as a DigitalOut.


[Hint: The rising edge of spark signal should be generated at the rising edge of TDC. To implement this, figure out where the TDC signal is generated in measure.cpp file. Once you figure out this part, you should be able to find out where to make the addition to the code to generate the spark signal.

Moreover, when you use the built-in wait(), wait_ms() or wait_us() functions from MBED library, for some reason, sometimes the wait_ms() function does not work properly. To tackle this issue, try to use the wait() function instead, but remember that the parameter passed into the wait() function is in unit of seconds. Lastly, DO NOT use any aforementioned wait() function inside the Timer2_isr() - as we discussed in the lectures it is not good practice to add delays in an ISR.]

Part 3 [5 Marks]

Create a new design called ‘timing’, copy and paste the file timing.cpp from Moodle into your new design. Compile and run timing.cpp. It produces a spark pulse, on pin 10, at 180 degrees before TDC.

Modify the programme so that it produces the spark at 15 degrees before TDC.

Useful notes (based on the Lecture 10 slideset):

  • A spark has to occur some time before TDC to allow the petrol/air mixture to be burning when the piston reaches TDC. This is known as the Advance Angle (AA) since the spark occurs "in advance of" TDC.
  • You should be able to see the LEDs flash through the hole in the disc. The green LED is at 15 degrees before TDC.

[Hint: The disk rotates counter-clockwise (NOT clockwise).]

Observe the variation in the timing while the disc speed is being increased and decreased. You will see this as a change in the colour of the LED illuminated through the hole at the time of the "spark". That is, the spark pulse does not occur at the correct angle when accelerating or decelerating.

Why does this occur (provide an explanation in your report)?

[Hint: Check how is the period calculated in the code.]

Explain in your report how you could reduce this effect by modifying:
(i) the software and
(ii) the hardware

Save the code you have generated in Part 3, you will need to return to it later…

Now modify your code such that it displays not the period of rotation of the flywheel, instead it displays the rotational speed in revolutions per minute (rpm).

[Hint: You will need to inspect the Timer initialisation code to determine the significance of the displayed value of period. In addition, as you should not use floating point calculations, all variables should be declared as volatile INTEGER type, pay close attention when performing division arithmetic operations during the conversion from period of rotation to the rotational speed in revolutions per minute as any small value divided by a big value will end up with a zero result. For example, if you have three integer variables, int a = 2; int b = 10; and int c = 5, then a/b * c = 2/10 * 5 will give you 0 in this case, NOT 1 as 2/10 = 0 and 0 * 5 = 0. To solve this, rearrange the expression to (2 * 5) / 10 which will give you the desired output 1.]

Part 4 [4 Marks]

For best engine efficiency, the advance angle is small for low revolution rates and much larger at high revolution rates.

Alter your program so that it calculates the Advance Angle (AA), which should be 20 degrees up to 600 rpm and constant at 80 degrees beyond 1500 rpm. Between these two rotation speeds, there should be a linear change in the AA.

Test your AA calculation code by displaying the AA (along with the RPM) on the LCD display, line 2.

[Hint: Background information useful for solving this is available in the Lecture 10 slideset. You will need to derive the mathematical formula of the linear part of the AA graph.]

Once you have an AA varying between the two limits, modify the programme so that the spark occurs at the calculated time. Do not use floating point in your calculations since it is slow. Use your program to work out the angle before TDC of the right-hand red LED.

[Hint: In PART 3, the spark occurs at a fixed advance angle which is 15 degrees. Now you will need to utilise the calculated advance angle from above and replace the hard-coded one you did in PART 3]

Part 5 [2 Marks]

A real time system can be defined as a system in which an action or calculation must occur within a limited period of time. As such, the system you have devised above can be considered as a real time one. How much time is available for the calculation of the advance angle given a speed of 2100 revolutions per minute?

[Hint: This is a calculation problem. Background information useful for solving this is available in the lecture 10 slideset on Moodle.]

Part 6 [2 Marks]

Implement your software modification suggested in Part 3 to maintain the correct advance angle during acceleration and deceleration. Test your solution and see if it works.

Part 7 [2 Marks]

The code provided for Parts 3-5 uses a general purpose I/O Pin configured as an output and named ‘spark’ plus two Match Registers MR0 and MR1. An interrupt from MR0 sets the spark output high and an interrupt from MR1 resets spark low. The use of two match registers for a single output is not efficient, neither is the use of an extra output pin and DigitialOut API, when the processor can drive a pin automatically from the Match Register.

Copy the original timing.cpp code to a new design name and modify the code such that it uses just Match Register 1 to set the spark pin high, and then to return it low. Set the AA at a constant 15 degrees, to keep things simple and make testing easier.

Note: It is not safe just to toggle the Spark output, you need to set it high on the first Match Register Interrupt following TDC then set it low on the next interrupt. If you just toggle Spark, there is always the chance that the spark signal could become inverted following a glitch, so set it explicitly high and then low.

Part 8 [2 Marks]

The code is still using an extra output pin and DigitalOut API.

Modify your program such that the spark is generated directly from the MAT2.2 signal. To do this you will need to configure pin 6 such that it is driven by MAT2.2, and the pin should be set high and then set low using the Timer 2 Match Register 2.

Note: Pin 6 is used by the application board to drive the LCD Display, so this change will mess up the display. But give it a try anyway and checked the results on the oscilloscope. (It’s likely that you will have to remove the lcd library from your project for this). Once again, you should avoid toggling the spark output on a match.

发表评论

电子邮件地址不会被公开。 必填项已用*标注