This invention relates to a control apparatus for an internal combustion engine, and in particular to a control apparatus for the operating parameters such as an ignition timing, a supercharging pressure, an air/fuel ratio, and a compression ratio of an internal combustion engine which is operable either with a low-octane rating fuel or a high-octane rating fuel. 
It is well known in the art that the octane rating of fuel gasoline is greatly interrelated with a knock-resistibility in an internal combustion engine.  Namely, as the octane rating of gasoline becomes higher, the knocking of an engine correspondingly decreases. 
FIG.  1 shows an ignition timing vs output shaft torque characteristic of an internal combustion engine in the case where a commercially available low-octane gasoline (regular gasoline) and a commercially available high octane gasoline (premium gasoline) of which the octane rating is higher than that of low-octane gasoline are used.  In the figure, point A indicates a knock limit for the low-octane gasoline while point B indicates a knock limit for high-octane gasoline, in which knock arises when the angle of the ignition timing is advanced beyond these points. 
According to FIG.  1, it is possible to advance the angle of the ignition timing up to a point B when the high-octane gasoline is used, where the output shaft torque will be higher as compared with the use of the low-octane gasoline. 
FIG.  2 shows a supercharging pressure vs output shaft torque characteristic of an engine associated with a supercharger.  Similar to FIG.  1, point A represents a knock limit when using the regular loc-octane gasoline and point B represents a knock limit when using the premium high-octane gasoline.  It will be seen from FIG.  2 that the increase of a supercharging pressure when premium gasoline is used for the engine enables the output shaft torque of the engine to be also increased as in FIG.  1. 
Therefore, in an engine associated with such a characteristic, in the case where the regular and the premium gasolines are alternatively used, if the operating parameters of an engine such as the ignition timing and the spercharging pressure are changed over to have an optimum value according to the kind of a gasoline in use, the output of the engine can be enhanced. 
However, in a conventional control apparatus for an internal combustion engine, the reference ignition timing characteristic and the reference supercharging characteristic and the like are preset only for a predetermined octane rating gasoline, e.g. the low-octane rating gasoline.  Therefore when the gasoline of the engine is changed over from the low octane rating gasoline to the high octane rating gasoline, an increase in the output of the engine can not be expected without any change or modification thereof, so that the presetting, e.g. of the reference ignition timing and the reference supercharging pressure must be repeated respectively towards the advance angle and the increased pressure, by some method. 
It has been also considered that by means of a knock control technique, which will be hereinafter described in the embodiments of this invention, for detecting engine knocks and controlling the ignition timing to the knock occurrence limit, the reference ignition timing characteristic is preset to point B in FIG.  1 for the premium gasoline and when regular gasoline is in use, the ignition timing is retarded to point A in FIG.  1 by means of the above knock control technique.  In this case, however, because of the broad ignition timing interval for a knock control between points A and B in FIG.  1, when knocks arise during an acceleration operation etc.,  of the engine, intense knocks disadvantageously arise during the retarding shift of the ignition timing from point B to point A in FIG.  1. 
Even if the reference ignition timing, etc.,  have been again preset at the knock limit A or B, since the knock limits A and B in FIG.  1 vary with environmental conditions during the operation of the engine such as temperature, humidity, etc, there is a possibility that knocks will arise due to variation in such environmental conditions. 
Furthermore, depending on the operating region of the engine, there is a case where an accurate determining operation of octane rating can not be done. 
U.S. Pat.  No.  3,822,583, titled "Method for Determining Octane Rating of Fuels under Road Conditions" discloses measuring the octane rating of a fuel used for an engine by the detection of knocks. 
Japanese Patent Application Laid-open No.  58-57072, published on Apr. 5, 1983, titled "Method for Controlling Ignition Timing of Electronic Controlled Engine" discloses a change-over ignition timing apparatus for an engine depending on the octane rating of a fuel.