?? powerwindow.htm
字號(hào):
Before including this behavior, first
<a href="matlab:powerwindowscript(`remove continuous subsystem`);"><b>remove the continuous behavior</b></a>
included before and
<a href="matlab:powerwindowscript(`add power`);"><b>add a more detailed subsystem</b></a>
consisting of
<a href="matlab:powerwindowscript(`highlight electronics`);">power electronics</a>
and a
<a href="matlab:powerwindowscript(`highlight multi-body`);">multi-body system</a>.
Let`s have a look at these in detail next.
</p>
<h4><a name="power electronics"></a>Power Electronics</h4>
<p>
The control signals generated by the
<a href="matlab:powerwindowscript(`highlight statechart`);">discrete event controller</a>
have to be `amped up` to be sufficiently powerful to drive the
<a href="matlab:powerwindowscript(`open motor`);">DC motor</a>
that moves the window. This is modeled by the
<a href="matlab:powerwindowscript(`open amplification up`);">amplification modules</a>.
It shows that a switch either connects the DC motor
to the battery voltage or ground. By connecting the battery reversely, a
negative voltage is obtained and the window can be moved up, down, or remain
at its position. Note that the window is always driven at maximum power, i.e.,
no DC motor controller is present to apply a prescribed velocity.
</p>
<h4><a name="multi-body"></a>Multi-Body System</h4>
<p>
The window is modeled by using the multi-body system blockset. This consists
of a library of noncausal multi-body elements such as bodies, joints, and
actuators. The
<a href="matlab:powerwindowscript(`open multi-body window`);">window model</a>
consists of a
<a href="matlab:powerwindowscript(`highlight worm gear`);">worm gear</a>
and
<a href="matlab:powerwindowscript(`highlight lever`);">lever</a>
to move the
<a href="matlab:powerwindowscript(`highlight window`);">window holder</a>
in the vertical direction.
The following figure shows how the mechanical parts move:
<blockquote>
<blockquote>
<p>
<img src="window2b.jpg" alt="" border="0" align="">
</p>
</blockquote>
</blockquote>
<h4><a name="design iteration"></a>Design Iteration</h4>
<p>
An important effect of the more detailed implementation is that there is no
window position measurement available. Instead, the current of the DC motor
is measured and used to detect the endstops and whether an obstacle is present.
This brings about the next stage in system design which now allows to analyze
the control and whether it indeed does not cause too large a force when an
obstacle is present.
</p>
<p>
The redesigned context diagram, level 1 activity diagram and ... are given here.
In the originally designed system,
<a href="matlab:powerwindowscript(`remove position detection`);"><b>remove the obstacle and endstop detection</b></a>
based on the window position,
<a href="matlab:powerwindowscript(`include current detection`);"><b>replace it with a current based implementation</b></a>, and
<a href="matlab:powerwindowscript(`connect current`);"><b>connect the process</b></a>
to the controller and position and force measurements.
</p>
<p>
Let`s also
<a href="matlab:powerwindowscript(`add object switch`);"><b>add a control mechanism</b></a>
to conveniently switch between the presence and absence of the object and
<a href="matlab:powerwindowscript(`resize for object switch`);">resize the window</a>.
</p>
<h4><a name="animation"></a>The System in Motion</h4>
To view the geometrics of the system in motion,
<a href="matlab:powerwindowscript(`add VR world`);"><b>add a virtual reality world</b></a>
and
<a href="matlab:powerwindowscript(`open VR world`);">open it by double-clicking on the block</a>.
Select a stiff solver, e.g., the
<a href="matlab:powerwindowscript(`ode23t`);">modified Trapezoidal</a>.
In the <font face="Courier">Visualization</font> tab, check both options
<a href="matlab:powerwindowscript(`passenger window up`);">set the passenger up switch</a>
and
<a href="matlab:powerwindowscript(`run`);">run the simulation</a>
again. After some initial time
(less than 1 [s] but more than 10 [ms] in simulation time, simulation time is displayed in the bottom-right corner of the model window status bar),
<a href="matlab:powerwindowscript(`passenger window up release`);">switch off the passenger up switch</a>
to initiate the auto-up behavior.
Notice how the window holder starts to move vertically to close the window.
When the object is encountered, the window is rolled down.
Click the
<a href="matlab:powerwindowscript(`driver window down`);">driver down switch</a>
to roll down the window completely. Again, after some initial time (less than one second simulation time)
<a href="matlab:powerwindowscript(`driver window down release`);">switch off the driver down switch</a>
to initiate the auto-down behavior.
</p>
<p>
When the window has reached the bottom of the frame,
<a href="matlab:powerwindowscript(`stop`);">stop the simulation</a>.
Now, open the
<a href="matlab:powerwindowscript(`open position scope`);"><font face="Courier">position</font> measurement</a> (in [m])
and the
<a href="matlab:powerwindowscript(`open Ia scope`);"><font face="Courier">armature current</font> (Ia) measurement</a> (in [A]).
Note that the absolute value of the
armature current transient during normal behavior does not exceed 10 [A].
The obstacle is detected when the absolute value of the
armature current required to move the window up
exceeds 2.5 [A] (in fact, it less than -2.5 [A])
where during normal operation this is about 2 [A].
You probably have to zoom in to have a good look at this.
The window endstop
is detected when the absolute value of the armature current exceeds 15 [A].
</p>
<p>
Variation in the armature current during normal operation is due to
<a href="matlab:powerwindowscript(`open friction`);">friction</a>
that is included by sensing joint velocities and positions and
applying window specific coefficients. A
<a href="matlab:powerwindowscript(`highlight friction table`);">look-up table</a>
is used to this end
and noise is added to allow evaluation of the control robustness.
</p>
<h4><a name="ideal current measurement"></a>Control Law Evaluation</h4>
<p>
While the idealized continuous plant allowed access to the window position
for <font face="Courier">endStop</font> and <font face="Courier">obstacle</font> event generation, in the more
realistic situation, these events have to be generated from accessible
physical variables. In case of the power window system, this typical is
the armature current, <font face="Courier">Ia</font>, of the DC motor that drives the worm gear.
</p>
<p>
While moving the window, this current will have a value around 2 [A] and
when switched on, a transient current is drawn that may reach values of
around 10 [A]. End stop detection is activated when the current exceeds
a value of 15 [A], which is drawn when the angular velocity of the motor
is kept almost 0 despite a positive or negative input voltage.
</p>
<p>
Detecting the presence of an object is much more difficult in this setup.
Because safety restrictions prescribe that the window force should not
exceed 100 [N], an object should be detected by an armature current much
less than 10 [A]. However, this conflicts with the transient values achieved
during normal operation.
</p>
<p>
Here, a control law is implemented that disables object detection during the
transient. Now, when an armature current that is more than 2 [A] is measured,
an object is considered to be present and the <font face="Courier">emergencyDown</font> state
of the discrete event control is entered.
Open the
<a href="matlab:powerwindowscript(`open window force scope`);"><font face="Courier">window force</font> measurement</a> (in [N])
to verify that the force exerted when an object is present and the window
reverses its velocity remains less than 100 [N].
</p>
<p>
Note that far more sophisticated
control laws are possible and implemented in reality. For example, neural-network
based learning feedforward control techniques can be implemented to emulate
the friction characteristic of each individual vehicle and its changes over
time.
</p>
<h3><a name="power"></a>Realistic Armature Measurement</h3>
<p>
The armature current as used in the power window control is an ideal value
that is accessible because of the use of an actuator model. In a more realistic
situation, this current value has to be measured by data acquisition components.
To include these, first
<a href="matlab:powerwindowscript(`prepare realistic Ia`);"><b>remove the ideal measurement</b></a>.
Next,
<a href="matlab:powerwindowscript(`include realistic Ia`);"><b>add the more realistic measurement</b></a>
that include a signal conditioning block where the current is derived based on
a voltage measurement. This voltage is within the range of an analog-to-digital
converter (ADC) that discretizes based on a given number of bits. The resulting
value has to be scaled based on the value of the resistor that is used and
the range of the ADC that is chosen.
<a href="matlab:powerwindowscript(`fixed point processing`);"><b>Include these operations as fixed point computations.</b></a>
Notice that 16 bits are required instead of 8 to achieve the necessary resolution with the given range.
</p>
<p>
Study the same scenario
<ul>
<li><a href="matlab:powerwindowscript(`passenger window up`);">set the passenger up switch</a></li>
<li><a href="matlab:powerwindowscript(`run`);">run the simulation</a></li>
<li>after some time <a href="matlab:powerwindowscript(`passenger window up release`);">switch off the passenger up switch</a>
<li>when the window has been rolled down, click the
<a href="matlab:powerwindowscript(`driver window down`);">driver down switch</a></li>
<li>after some time
<a href="matlab:powerwindowscript(`driver window down release`);">switch off the driver down switch</a></li>
<li>when the window has reached the bottom of the frame,
<a href="matlab:powerwindowscript(`stop`);">stop the simulation</a>.</li>
</ul>
Notice how the armature current now has a discretized appearance by
<a href="matlab:powerwindowscript(`zoom Ia`);">zooming in</a> on it.
</p>
<h3><a name="reorganization"></a>Reorganizing the Model</h3>
<p>
To avoid cluttered diagrams, the designed model can be reorganized using
subsystems.
<ul>
<li>First, <a href="matlab:powerwindowscript(`collapse DAQ subsystem`);"><b>collapse the DAQ subsystem</b></a>
<li>Next, <a href="matlab:powerwindowscript(`collapse process`);"><b>collapse the actuator and plant subsystems</b></a>
</ul>
</p>
<h3><a name="CAN bus"></a>Communication</h3>
<p>
Similar to the Stateflow output part, the input events have to be generated
by hardware, in this case the window control switches in the door
and center control panels. These events are generated by local processors
and then communicated to the window controller by a CAN bus.
</p>
<p>
To include these phenomena, first
<a href="matlab:powerwindowscript(`delete direct input`);"><b>remove the idealized input</b></a>
and
<a href="matlab:powerwindowscript(`add CAN input`);"><b>add input from a CAN bus</b></a>.
Next,
<a href="matlab:powerwindowscript(`add CAN output`);"><b>add switch components</b></a>
that generate the events and put these on the CAN bus.
If you
<a href="matlab:powerwindowscript(`open switch subsystem`);">open the switch subsystem</a>
you note a structure very similar to the window control system:
again, there is a
<a href="matlab:powerwindowscript(`highlight switch plant`);">plant model</a>
that represents the control switch, a
<a href="matlab:powerwindowscript(`highlight switch DAQ`);">data acquisition</a>
subsystem that includes, a.o., signal conditioning components, a
<a href="matlab:powerwindowscript(`highlight switch control`);">control</a>,
module to map the commands from the physical switch to logical commands,
and a
<a href="matlab:powerwindowscript(`highlight switch CAN module`);">CAN module</a>,
to post the events to the vehicle data bus.
</p>
<p>
Additional communication effects (e.g., because of other systems using the CAN bus)
and more realism can be added similar to
the described phases. Each of these phases allows analysis of the discrete
event controller in an increasingly realistic situation. Once a sufficient level of
detail is achieved, controller code can be automatically generated for
any specific target platform.
</p>
<table width="100%" cellspacing="2" cellpadding="2" border="2">
<DIV CLASS=table>
<tr BGCOLOR="#DDDDDD"><!-- Row 1 -->
<td><b>AD0</b></td>
<td COLSPAN=5>POWER WINDOW SYSTEM</td>
</tr>
<tr><!-- Row 4 -->
<td>ARMATURE_CURRENT</td>
<td>DATA</td>
<td>CONTINUOUS</td>
<td>REAL</td>
<td>MIN: -20 [A]</td>
<td>MAX: 20 [A}</td>
</tr>
<tr BGCOLOR="#DDDDDD"><!-- Row 25 -->
<td><b>AD1.3</b></td>
<td COLSPAN=5>DETECT_OBSTACLE_ENDSTOP</td>
</tr>
<tr><!-- Row 26 -->
<td>ABSOLUTE_ARMATURE_CURRENT</td>
<td>DATA</td>
<td>CONTINUOUS</td>
<td>REAL</td>
<td>MIN: 0 [A]</td>
<td>MAX: 20 [A]</td>
</tr>
<tr><!-- Row 27 -->
<td>ENDSTOP_MAX</td>
<td>DATA</td>
<td>CONSTANT</td>
<td>REAL</td>
<td>VALUE: 15 [A]</td>
<td> </td>
</tr>
<tr><!-- Row 27 -->
<td>OBSTACLE_MAX</td>
<td>DATA</td>
<td>CONSTANT</td>
<td>REAL</td>
<td>VALUE: 2.5 [A]</td>
<td> </td>
</tr>
</DIV>
</table>
<h3><a name="Code Generation"></a>Code Generation</h3>
<p>
To generate code of the
<a href="matlab:powerwindowscript(`highlight window control`);">designed control</a>
first
<a href="matlab:powerwindowscript(`show sample rates`);">check the sample rates</a>
of the controller by selecting
<font face="Courier">Sample time colors</font>
from the <font face="Courier">Format menu</font>.
This shows that the controller runs at a uniform sample rate.
</p>
<p>
Now, click your right mouse-button on the window control module
and from <font face="Courier">Real-time Workshop</font> select
<font face="Courier">Build Subsystem</font>
to build real-time code of the subsystem.
</p>
<p>
<a href="matlab:powerwindowscript(`closemodel`);">Close</a>
the power window demonstration
M<font size=-1>ATLAB</font>-S<font size=-1>IMULINK</font> model.
</p>
<hr>
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -