⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 powerwindow.htm

📁 power window related simulink simulation
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!-- $Revision: 1.2 $ -->
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Simulink demo</title>

<LINK rel=StyleSheet href="style.css" type="text/css">

</head>

<body bgcolor="#FFFFFF">

<h2>Simulink Power Window Controller Specification</h2>


<p>
Matlab-Simulink is a versatile tool that supports embedded control
design all the way from initial specification to code generation.

<p>
To manage the complexity of not only today`s engineered systems but also of
their design teams, structured analysis methods are used to systematically
arrive at rigorous, unambiguous, and consistent specifications. 
</p>

<p>
In this context, M<font size=-1>ATLAB</font>-S<font size=-1>IMULINK</font> can
be used to provide executable specifications that support system design closer
to its actual realization than typical Computer-Aided Systems/Software Engineering (CASE)
tools can.
</p>

<p>
This example shows how <i>activity diagrams</i>
(combined <i>data flow diagrams</i> and <i>control flow diagrams</i>)
can be implemented in M<font size=-1>ATLAB</font>-S<font size=-1>IMULINK</font>
and how to link the M<font size=-1>ATLAB</font>-S<font size=-1>IMULINK</font> model
to the system documentation.
</p>

<p>
The overall power window design includes:
<ul>
<li>high-level discrete event control specification</li>
<li>combined discrete event and continuous time systems, hybrid dynamic systems</li>
<li>hybrid control combined with energy based components:
<ul>
<li>power electronics to model actuator dynamics</li>
<li>multi-body system components to model the power window plant</li>.
</ul></li>
<li>automatically generated controller code for the control subsystem</li>
</ul>
</p>

<p>
<font color="FF0000">Throughout this demo, links appear that have to be activated in
the presented sequence.
These links are in bold.
Please click each of the bold faced links as they appear in the text.
You can jump to a particular stage by skipping several links in bold,
but to revert, you will have to reload the demo. 
</p>
<p> This file is meant to be used with R12.1 and earlier versions 
of MATLAB.  For later versions, please use the html file powerwindow_R13.htm</p></font>

<h3><a name="Introduction"></a>Introduction</h3>

<p>
Nowadays, electronics are used in automobiles to control, e.g., the opening
and closing of windows and sun-roof, adjusting the mirrors/headlights, and
to lock and unlock the doors. These systems are subject to stringent operation
constraints as failure may result in dangerous and possibly life-threatening
situations. Therefore, a careful design and analysis is mandatory before
deployment.
</p>

<p>
In this example, let`s concentrate on the power window system of an automobile,
specifically, the passenger-side window. A critical aspect of this system is
that it can never exert a force of more than 100 [N] on an object
when closing the window, see:
<blockquote>
    <blockquote>
        <p>
		<img src="window1b.jpg" alt="" border="0" align="">
		</p>
    </blockquote>
</blockquote>
When such an object is detected, the window is to be lowered by about 10 [cm].
</p>

<h3><a name="Requirements"></a>Requirements</h3>

<p>
More formally, the quantitative requirements for the control can be stated:
<ul>
<li>The window has to be fully opened and fully closed within 4 [s].
</li>
<li>If the up or down command is issued for at least 200 [ms] and at most
1 [s], the window has to be fully opened or closed, respectively.
</li>
<li>The window has to start moving 200 [ms] after the command is issued.
</li>
<li>The force to detect when an object is present should be less than 100 [N].
</li>
<li>When an object is present, the window should be lowered by approximately 10 [cm].
</li>
</ul>
</p>

<h3><a name="Discrete Event Control"></a>Discrete Event Control</h3>

<p>
The discrete event control of the window can be modeled by a statechart,
i.e., a finite state machine with hierarchy and parallelism. This state
machine contains the basic states of the power window system
<font face="Courier">up</font>,
<font face="Courier">auto-up</font>,
<font face="Courier">down</font>,
<font face="Courier">auto-down</font>,
<font face="Courier">rest</font>, and
<font face="Courier">emergency</font>.
It models the state transitions between these and accounts for the 
precedence of driver commands over the passenger commands.
It also includes emergency behavior that is to be activated when
an object is detected to be present between the window and the frame
while moving up.
The <a href="matlab:powerwindowscript(`initialize`);"><b>initial M<font size=-1>ATLAB</font>-S<font size=-1>IMULINK</font> model</b></a>
for the
<a href="matlab:powerwindowscript(`highlight statechart`);">power window control</a>
is a
<a href="matlab:powerwindowscript(`open control`);">discrete event controller</a>
that runs at a
given <a href="matlab:powerwindowscript(`highlight sample rate`);">sample rate</a>.
The discrete event control is a Stateflow model that extends the 
state transition diagram notion with hierarchy and parallelism.
Note that state changes because of passenger commands are encapsulated
in a <i>super state</i> that corresponds to no active driver commands.
</p>

<p>
Here, the control of the passenger window is considered. This window can be
moved up and down by either the passenger or the driver. The model includes
this control input as 
<a href="matlab:powerwindowscript(`highlight passenger and driver switches`);">switches</a>
that can be manually operated by double-clicking them. 
</p>


<p>
The state machine that controls a power window is tested by running the input
test vectors and verifying that the desired internal state is reached and
output is generated. The power window has four external inputs:
<ul>
<li>passenger input consists of a vector with three elements:
<ul>
<li><font face="Courier">neutral</font>: the passenger control switch is not depressed</li>
<li><font face="Courier">up</font>: the passenger control switch generates the up signal</li>
<li><font face="Courier">down</font>: the passenger control switch generates the down signal</li>
</ul></li>
<li>driver input</li>
<ul>
<li><font face="Courier">neutral</font>: the driver control switch is not depressed</li>
<li><font face="Courier">up</font>: the driver control switch generates the up signal</li>
<li><font face="Courier">down</font>: the driver control switch generates the down signal</li>
</ul></li>
<li>whether top or bottom of the window frame is reached
<ul>
<li>0: window moves freely between top or bottom</li>
<li>1: window is stuck at the top or bottom because of physical limitations</li>
</ul></li>
<li>whether an obstacle is present between the window and its frame
<ul>
<li>0: window moves freely between top or bottom</li>
<li>1: window is stuck at the top or bottom because of physical limitations</li>
</ul></li>
</ul>
The passenger and driver input signals are generated by
<a href="matlab:powerwindowscript(`highlight maps`);">mapping the up and
down signals</a> according to the following table

<p>
<table bordercolor="#000000" cellspacing="2" cellpadding="4" border="1" align="center">
  <tr align="center"><!-- Row 1 -->
    <td bordercolor="#FF0000" bgcolor="#FF8888"><b>up</b></td>
    <td bordercolor="#FF0000" bgcolor="#FF8888"><b>down</b></td>
    <td bordercolor="#0000FF" bgcolor="#8888FF"><b>neutral</b></td>
    <td bordercolor="#0000FF" bgcolor="#8888FF"><b>up</b></td>
    <td bordercolor="#0000FF" bgcolor="#8888FF"><b>down</b></td>
  </tr>
  <tr align="center"><!-- Row 2 -->
    <td bordercolor="#FF0000" bgcolor="FFCCCC">0</td>
    <td bordercolor="#FF0000" bgcolor="FFCCCC">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">1</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
  </tr>
  <tr align="center"><!-- Row 3 -->
    <td bordercolor="#FF0000" bgcolor="FFCCCC">0</td>
    <td bordercolor="#FF0000" bgcolor="FFCCCC">1</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">1</td>
  </tr>
  <tr align="center"><!-- Row 4 -->
    <td bordercolor="#FF0000" bgcolor="FFCCCC">1</td>
    <td bordercolor="#FF0000" bgcolor="FFCCCC">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">1</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
  </tr>
  <tr align="center"><!-- Row 5 -->
    <td bordercolor="#FF0000" bgcolor="FFCCCC">1</td>
    <td bordercolor="#FF0000" bgcolor="FFCCCC">1</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">1</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
    <td bordercolor="#0000FF" bgcolor="CCCCFF">0</td>
  </tr>

</table>
</p>

to explicitly generate the <font face="Courier">neutral</font> event from
the <font face="Courier">up</font> and <font face="Courier">down</font>
events as generated by pressing a power window control switch.
The blue part of the table is entered as
<a href="matlab:powerwindowscript(`open truth table`);">truth table</a>
in the map.
</p>

<h4><a name="window up"></a>Window Up</h3>

<p>
To observe the state machine behavior, first 
<a href="matlab:powerwindowscript(`run`);">run the simulation</a>
and then
double-click the 
<a href="matlab:powerwindowscript(`highlight passenger up`);">passenger window up switch</a>
or click <a href="matlab:powerwindowscript(`passenger window up`);">here</a>.
If the switch was pressed for more than one
second, the window moves up till the up switch is
<a href="matlab:powerwindowscript(`passenger window up release`);">released</a>
(or the top of the
window frame is reached and the
<a href="matlab:powerwindowscript(`endstop`);"><font face="Courier">endstop</font> event</font>
is generated</a>).
</p>

<p>
Please first <a href="matlab:powerwindowscript(`reset switches`);">reset the switches</a>
before continuing.
</p>

<h4><a name="window autoup"></a>Window Auto-Up</h3>

<p>
If the passenger up switch was pressed for a short period of time (less than a second),
<i>auto-up</i>
is activated and the window continues to move up.
To observe this state change, click the following links shortly after one another:
<a href="matlab:powerwindowscript(`passenger window up`);">here</a> and
<a href="matlab:powerwindowscript(`passenger window up release`);">here</a>.
Ultimately, the window reaches the top of the frame and the
<a href="matlab:powerwindowscript(`endstop`);"><font face="Courier">endstop</font> event</font>
is generated</a>
that moves the state machine back to its
neutral state.
</p>

<p>
Please first <a href="matlab:powerwindowscript(`reset switches`);">reset the switches</a>
before continuing.
</p>

<h4><a name="precedence"></a>Driver-side Precedence</h3>

<p>
The driver switch for the passenger window takes precedence over the driver
commands. 
First, move the system to its <font face="Courier">passenger up</font>
state by double-clicking the passenger window up switch
or click
<a href="matlab:powerwindowscript(`passenger window up`);">here</a>.
Next, double-click the
<a href="matlab:powerwindowscript(`highlight driver down`);">driver window down switch</a>
or click <a href="matlab:powerwindowscript(`driver window down`);">here</a>.
Notice how the state machine moves to the driver control part to generate the
window down output instead of the window up output.
When the driver control is
<a href="matlab:powerwindowscript(`driver window up`);">switched to up</a>,
the driver window up state is reached that generates the window up output again, i.e.,
<font face="Courier">windowUp = 1</font>.
</p>

<p>
To observe state behavior when an object is present between the window and its
frame, double-click the
<a href="matlab:powerwindowscript(`highlight obstacle`);">obstacle switch</a>
or click <a href="matlab:powerwindowscript(`obstacle`);">here</a>. On the next
sample time, the state machine moves to its <font face="Courier">emergencyDown</font> state to
lower the window a few inches. How far exactly depends on how long the
state machine is in the <font face="Courier">emergencyDown</font> state and is part of the next 
analysis phase.
</p>

<p>
Note that if any of the driver or passenger window
switches is still active, the state machine 
moves into the up or down states upon the next sample time after the emergency
state is departed. If the obstacle switch is still active too, the emergency
state is then activated at again the next sample time.

<p>
Please
<a href="matlab:powerwindowscript(`stop`);">stop the simulation</a>
and
<a href="matlab:powerwindowscript(`reset switches`);">reset the switches</a>
before continuing.
</p>

<h3><a name="Continuous Plant Behavior"></a>Continuous Plant Behavior</h3>

<p>
Once the discrete event control has been designed and verified, it can
be coupled to the continuous time plant behavior. To this end,
first 
<a href="matlab:powerwindowscript(`remove output`);"><b>remove initial input/output blocks</b></a>
that connect to ports that have to be connected to the
<a href="matlab:powerwindowscript(`add continuous`);"><b>continuous plant behavior</b></a>.
The plant is modeled as a second order differential equation with step-wise
changes in its input:
<ul>
<li>when the Stateflow chart generates <font face="Courier">windowUp</font> the input is 1,</li>
<li>when the Stateflow chart generates <font face="Courier">windowDown</font> the input is -1,</li>
<li>otherwise, the input is 0.</li>
</ul>

<p>
This phase allows analysis of the interaction between the discrete event

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -