v1-Exerc-1-MPF-DSEA-07JUN2014

2
Ministério da Educação UNIVERSIDADE TECNOLÓGICA FEDERAL DO PARANÁ Campus Curitiba Curso de Especialização em Sistemas Embarcados Automotivos Exercício 1 Professor: Max Mauro Dias Santos Aluno:_______________________________________________________________________Data:___/___/___ 1) Desenvolva uma função de controle de lâmpada do nível do combustível de acordo com a especificação a seguir. Considere as ferrramentas da Mathworks para gerar o controlador, valide e gere o C Code para embarcar em um microcontrolador. Specification: The fuel level sensor measures the level inside the fuel tank of a vehicle and produces na analog signal (i.e., a signal proportional to the measured fuel level) within the range of 0 and 10 V. This analog signal is used as the input for controlling the low-fuel indicator lamp. It is then subjected to time- and value-discrete sampling in the instrument cluster. In this process, an analog signal value of 8.5 V is the reading produced by the spare fuel quantity of 5 liters remaining in the fuel tank. A signal value of 10 V corresponds to an empty tank, and a signal value of 0 V a full tank. It follows that the low-fuel indicator lamp must be energized in the presence of a signal value greater than 8.5 V. To prevent a flickering of the lamp by virtue of it being switched on and off in rapid succession by minute movements of the fuel volume in the tank, a hysteresis function must be implemented. It is desirable that the low-fuel indicator lamp be switched off only at the point where a fuel volume exceeding 6 liters, corresponding to a signal value of less than 8.0 V, has been reached. Figure 2-8 shows the relevant switching operations. Based on the foregoing, the only factors of interest in the control of the low-fuel indicator lamp are the instantsor eventsof overshooting the “signal value less than 8.0 V” and “signal value greater than 8.5 V” thresholds, and the previous “off” or “on” state of the lamp. Fig. 2-8. Switching operations of a low-fuel indicator lamp. Figure 2-9 shows a diagram of the discrete “Lamp off” and “Lamp on” states, with the possible transitions between these states, to which the corresponding events have been assigned.

description

Exercício 1

Transcript of v1-Exerc-1-MPF-DSEA-07JUN2014

  • Ministrio da Educao

    UNIVERSIDADE TECNOLGICA FEDERAL DO PARAN

    Campus Curitiba

    Curso de Especializao em Sistemas Embarcados Automotivos Exerccio 1

    Professor: Max Mauro Dias Santos

    Aluno:_______________________________________________________________________Data:___/___/___

    1) Desenvolva uma funo de controle de lmpada do nvel do combustvel de acordo com a especificao a

    seguir.

    Considere as ferrramentas da Mathworks para gerar o controlador, valide e gere o C Code para embarcar em um microcontrolador.

    Specification: The fuel level sensor measures the level inside the fuel tank of a vehicle and produces na analog signal (i.e., a signal proportional to the measured fuel level) within the range of 0 and 10 V. This analog signal is used as the input for controlling the low-fuel indicator lamp. It is then subjected to time- and value-discrete sampling in the instrument cluster.

    In this process, an analog signal value of 8.5 V is the reading produced by the spare fuel quantity of 5 liters remaining in the fuel tank. A signal value of 10 V corresponds to an empty tank, and a signal value of 0 V a full tank. It follows that the low-fuel indicator lamp must be energized in the presence of a signal value greater than 8.5 V.

    To prevent a flickering of the lamp by virtue of it being switched on and off in rapid succession by minute movements of the fuel volume in the tank, a hysteresis function must be implemented. It is desirable that the low-fuel indicator lamp be switched off only at the point where a fuel volume exceeding 6 liters, corresponding to a signal value of less than 8.0 V, has been reached. Figure 2-8 shows the relevant switching operations.

    Based on the foregoing, the only factors of interest in the control of the low-fuel indicator lamp are the instantsor eventsof overshooting the signal value less than 8.0 V and signal value greater than 8.5 V thresholds, and the previous off or on state of the lamp.

    Fig. 2-8. Switching operations of a low-fuel indicator lamp.

    Figure 2-9 shows a diagram of the discrete Lamp off and Lamp on states, with the possible transitions between these states, to which the corresponding events have been assigned.

  • Fig. 2-9. State/transition graph of a low-fuel indicator lamp.

    So far, no point in time for the execution of the so-called actions Switch Lamp On and Switch Lamp Off has been defi ned. As is the case with conditions, these actions can be assigned to the transitions, and the applicable term is transition actions. State machines of this type are known as Mealy state machines. As an alternative, the actions may be assigned to the states, the applicable term being state actions. State machines of this type are known as Moore state machines. Mealy and Moore state machines also can be combined, that is, actions may be assigned to states and transitions. To suit the purpose of this example, the actions Switch Lamp On and Switch Lamp Off shall be assigned to the transitions.

    In addition, the state that the state machine occupies at the start requires defi nition. This state is termed start state. To monitor the functioning of the low-fuel indicator lamp, the defi nition will specify that the lamp must be energized for a specifi c time period each time the engine of the vehicle is started. In this way, the proper functioning of the lamp is confi rmed independently of the actual fuel level. The fi rst possible state transition shall occur only after a two-second delay, that is, the lamp shall remain illuminated for a minimum of two seconds after starting the engine. For this reason, a new state labeled Function Check, with a transition to the start state Lamp On, is introduced. As a result, the action Switch Lamp On is executed in the Function Check state. The start state in a state machine is marked with an (S).

    Figure 5-36 shows the state machine enhanced by means of the preceding procedure.

    Fig. 5-36. Assignment of actions and defi nition of start state.

    Referncia:

    Jorge Schauffele & Thomas Zurawka. Automotive Software Engineering: Principles, Processes, Methods and Tools. SAE International. 2005.