ME6105: Homework 3 Energy-Based Systems Modeling in Modelica
ME6105: Homework 3 Energy-Based Systems Modeling in Modelica ME6105: Homework 3 Energy-Based Systems Modeling in Modelica
October 27 th , 2010 ME6105: Homework 3 Energy-Based Systems Modeling in Modelica Project: SEGWAY Jean-Vincent DEFRANCE Mickaël KARGULEWICZ Guilhem TOURNAIRE Pascal TRANG
- Page 2 and 3: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 4 and 5: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 6 and 7: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 8 and 9: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 10 and 11: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 12 and 13: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 14 and 15: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 16 and 17: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 18 and 19: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 20 and 21: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 22 and 23: Jean-Vincent DEFRANCE, Guilhem TOUR
- Page 24 and 25: Jean-Vincent DEFRANCE, Guilhem TOUR
October 27 th , 2010<br />
<strong>ME6105</strong>: <strong>Homework</strong> 3<br />
<strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong><br />
Project: SEGWAY<br />
Jean-V<strong>in</strong>cent DEFRANCE Mickaël KARGULEWICZ<br />
Guilhem TOURNAIRE Pascal TRANG
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Contents<br />
1. GOALS AND PROBLEM DOMAIN .......................................................................................................3<br />
2. SYSTEM AND SIMULATION SPECIFICATION .........................................................................................4<br />
2.1. SYSTEMS APPROACH ........................................................................................................................... 4<br />
2.2. INTERACTIONS ................................................................................................................................... 5<br />
2.3. PHYSICAL PHENOMENA INCLUDED IN OUR MODEL: .................................................................................... 5<br />
2.4. PHYSICAL PHENOMENA NOT INCLUDED IN OUR MODEL: ............................................................................. 5<br />
3. DYMOLA MODELS AND VERIFICATIONS .............................................................................................6<br />
3.1. DC MOTOR ...................................................................................................................................... 6<br />
3.2. THE CONTROL LOOP ............................................................................................................................ 7<br />
3.3. THE ROAD ......................................................................................................................................... 9<br />
3.4. THE WHEELS.................................................................................................................................... 12<br />
3.5. BATTERY ........................................................................................................................................ 13<br />
3.6. CONVERTER .................................................................................................................................... 15<br />
3.7. HANDLEBAR END PLATFORM ............................................................................................................... 19<br />
3.8. THE SEGWAY PT .............................................................................................................................. 19<br />
3.9. USER ............................................................................................................................................. 21<br />
4. EXPERIMENTATION AND INTERPRETATION ...................................................................................... 21<br />
4.1. SIMULATION OF THE SEGWAY BEHAVIOR ............................................................................................... 21<br />
4.2. COMPARISON OF BATTERY DURATIONS ACCORDING TO THE SLOPE .............................................................. 22<br />
4.3. VARIATION OF THE SEGWAY BEHAVIOR FOR DIFFERENT USER MASSES. ........................................................ 23<br />
5. LESSONS LEARNED ...................................................................................................................... 24<br />
5.1. WHERE WE STRUGGLED ..................................................................................................................... 24<br />
5.2. WHERE WE WENT DOWN THE WRONG PATH AND HOW DID WE REVISE OUR APPROACH .................................. 25<br />
5.3. HOW WOULD WE DO THINGS DIFFERENTLY IF WE WERE TO CREATE ANOTHER SIMULATION MODEL ................... 25<br />
5.4. DID YOU LEARN ANYTHING NEW ABOUT THE BEHAVIOR OF THE SYSTEM YOU WERE MODELING? ....................... 25<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 2
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
1. Goals and problem doma<strong>in</strong><br />
In our first homework, we identified two ma<strong>in</strong> trade-offs:<br />
- The first was between the autonomy and the power of the Segway.<br />
- The second was between the general technical performances and the overall costs of production and<br />
assembly of the Segway.<br />
S<strong>in</strong>ce the first homework, we used real Segways to feel how this vehicle really works:<br />
The most strik<strong>in</strong>g fact is that the speed is limited by the control loop: when the Segway reaches a given<br />
speed, the handlebar straightens up automatically to force the user to lean back and slow down. Thanks to this<br />
experience, we will slightly change the first trade-off to better fit what we felt. Moreover, we will reduce the<br />
scope of the second one to have a more feasible study:<br />
Instead of try<strong>in</strong>g to study the trade-off between the power of the motor and the autonomy, we will<br />
look at the <strong>in</strong>fluence of the maximum speed allowed by the control loop on the autonomy. As a matter of fact,<br />
the motor power has obviously an <strong>in</strong>fluence on the maximum speed reachable, but <strong>in</strong> practical use, the speed<br />
is limited by the control loop, not by the motor power. Consequently, look<strong>in</strong>g at the motor power is not<br />
directly relevant for a Segway.<br />
For the second trade-off, <strong>in</strong>stead of look<strong>in</strong>g at the general technical performances, we will only look at<br />
the autonomy of the Segway, and <strong>in</strong>stead of look<strong>in</strong>g at the overall costs of production, we will only look at the<br />
battery price.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 3
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
To study these trade-offs, we will model a complete Segway and its environment: the driver of the<br />
Segway, a road and the w<strong>in</strong>d resistance. In the model, the Segway will move only <strong>in</strong> one direction (mov<strong>in</strong>g<br />
forward and backward) without consider<strong>in</strong>g rotation. It will also be possible to model the Segway mov<strong>in</strong>g <strong>in</strong> a<br />
slope.<br />
For the first trade-off, we will look at the energy consumption of the Segway dur<strong>in</strong>g a classic ride: flat<br />
road, no w<strong>in</strong>d, and regular accelerations and brakes to simulate a real use <strong>in</strong> a city with other road-users and<br />
traffic lights. In order to shorten the simulation duration, we will underestimate the battery capacity and then<br />
extrapolate the result to obta<strong>in</strong> the autonomy with a real battery.<br />
For the second trade-off, we will use the extrapolated autonomy for different type of batteries and try<br />
to f<strong>in</strong>d the best one consider<strong>in</strong>g their prices. Currently, battery stands for 25% of the Segway price, s<strong>in</strong>ce the<br />
price is the ma<strong>in</strong> reason why people do not buy Segway, we will be able to f<strong>in</strong>d a battery that br<strong>in</strong>g the best<br />
compromise between cost and autonomy.<br />
2. System and Simulation Specification<br />
2.1. <strong>Systems</strong> approach<br />
Dc to dc converter<br />
battery<br />
Control loop<br />
motor<br />
gear box<br />
driver<br />
ma<strong>in</strong> body<br />
(platform +<br />
handle bar)<br />
wheel<br />
road<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 4
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
2.2. Interactions<br />
- Road-wheel : transmission of power from rotational to translation<br />
- Wheel – gear box : transmission of torque<br />
- Motor – gear box : transmission of torque with a ga<strong>in</strong><br />
- Gear box – ma<strong>in</strong> body : fixed<br />
- Motor – ma<strong>in</strong> body : fixed<br />
- DC to DC converter – motor : electrical <strong>in</strong>terface – motor <strong>in</strong>put voltage<br />
- Control loop – DC to DC converter : electrical <strong>in</strong>terface – command<br />
- Battery – DC to DC converter : electrical <strong>in</strong>terface<br />
- Driver – ma<strong>in</strong> body : fixed (<strong>in</strong> our model, not <strong>in</strong> reality)<br />
2.3. Physical phenomena <strong>in</strong>cluded <strong>in</strong> our model:<br />
- Friction between tire and road<br />
- Friction <strong>in</strong> motor<br />
- Tire deformation<br />
- Inertia of the body, driver, wheel and motor<br />
2.4. Physical phenomena not <strong>in</strong>cluded <strong>in</strong> our model:<br />
- Air resistance<br />
- Temperature of components (especially battery and motor)<br />
- Slipp<strong>in</strong>g of the tire on the road<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 5
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
3. Dymola Models and Verifications<br />
Model<br />
3.1. DC Motor<br />
We have decided to use a DC motor that has already been done <strong>in</strong> class before. Tests have already been<br />
done for this motor so we are go<strong>in</strong>g to use the same for our model:<br />
Test<br />
Tests have already done previously with the follow<strong>in</strong>g configuration:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 6
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Model<br />
3.2. The control loop<br />
The control loop of a Segway, which permits the system to rema<strong>in</strong> <strong>in</strong> equilibrium, is based on a PID<br />
which regulates the angular velocity of the handlebars. As a result, if the driver leans forward, the PID will try<br />
to reduce the angular velocity of the handlebars, and therefore it will accelerate the motor to catch up the<br />
forward mov<strong>in</strong>g.<br />
Moreover, there is an additional security system to limit the maximum speed: when the Segway reaches<br />
a given speed, the motor quickly delivers more torque to straighten up the handlebars and force the user to<br />
lean back and slow down.<br />
These two systems are modeled as shown <strong>in</strong> the follow<strong>in</strong>g figure:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 7
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Although we are sure that the control loop of a Segway is based on a PID, we have no idea about how it<br />
really works. We just know that a powerful computer is used, and that the software update is very expensive.<br />
Therefore, we built this model with the aim to obta<strong>in</strong> the two ma<strong>in</strong> purposes of this control loop, which are<br />
the equilibrium of the system and the speed limitation, but we admit that this model is probably very different<br />
from the reality.<br />
The equilibrium function is made with a simple PID which tries to reduce the error between the set and<br />
the real angular velocities of the handlebars. For a better equilibrium of the Segway, the set angular velocity is<br />
not 0 but a small value that is proportional and opposite to the real angular velocity. The real angular velocity<br />
is given by the gyrometers attached to the body of the Segway.<br />
The speed limit function is made with a test on the Segway velocity: if this velocity exceeds the limit, the<br />
set angular velocity given to the PID is set to a large value <strong>in</strong> order to quickly straighten up the handlebars. The<br />
Segway velocity is the derivative of its position, and this position is calculated with a rotary encoder.<br />
Test<br />
To test the control loop, we create <strong>in</strong>put signals which could be found on a real situation with a Segway.<br />
We assume that the user is lean<strong>in</strong>g forward to reach the maximum velocity. Therefore, the angular<br />
velocity of the body of the Segway <strong>in</strong>creases and then rema<strong>in</strong>s constant, as shown with the blue curve.<br />
Actually, the angular velocity is negative when the user leans forward because it is measured on the +z axis.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 8
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
As a result, the Segway accelerates until it reaches the speed limit, here 4 m/s. This acceleration is<br />
shown with the p<strong>in</strong>k curve.<br />
Before the speed limit is reached, the set angular velocity is small, proportional and opposite to the real<br />
angular velocity <strong>in</strong> order to obta<strong>in</strong> a better stability. When the speed limit is reached, the set angular velocity<br />
becomes suddenly larger to straighten up the handlebars. The evolution of this set angular velocity is shown<br />
by the red curve.<br />
Therefore, the error between the set and the real angular velocities is calculated (green curve) and<br />
processed by the PID <strong>in</strong> order to drive the motor of the Segway.<br />
Model<br />
3.3. The road<br />
The road is simply modeled with a prismatic jo<strong>in</strong>t allow<strong>in</strong>g one translation for the Segway compared to<br />
the World. For a horizontal road, the direction of the jo<strong>in</strong>t is {1,0,0}, and for a 10% positive slope, it is {1,0.1,0}.<br />
Axis1 and support1 receive the translation generated by the roll<strong>in</strong>g wheel of the Segway:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 9
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Test<br />
We tested the road by verify<strong>in</strong>g that a mass placed on it does not fall vertically. If we <strong>in</strong>cl<strong>in</strong>ate the floor,<br />
the mass should follow the profile of the road.<br />
For this we just l<strong>in</strong>ked a po<strong>in</strong>t mass to the road. If the road is horizontal (vector [1,0,0]) the po<strong>in</strong>t mass<br />
does not move. If we <strong>in</strong>cl<strong>in</strong>ate the road at 45° (vector [1,1,0]), the ball should fall. That is what we observe <strong>in</strong><br />
the simulation<br />
Configuration:<br />
Position of the mass as a function of time on the plane road:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 10
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Position of the mass as a function of time for a 45° slope: mass falls down:<br />
Trajectory of the mass:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 11
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Model<br />
3.4. The wheels<br />
The wheels rotate around the body of the Segway and on the road, but it is important to notice that the<br />
body of the Segway can lean forward and backward, and therefore the angular velocity of the wheel compared<br />
to the road is not equal to the one compared to the body of the Segway. That is why we need two revolute<br />
jo<strong>in</strong>ts:<br />
- The first one is between the wheel and the body of the Segway. The stator of the DC motor is l<strong>in</strong>ked to<br />
the body of the Segway through support1, and its rotor is l<strong>in</strong>ked to the wheel through axis1.<br />
- The other one is between the wheel and the road: the angular velocity between these two elements is<br />
transformed <strong>in</strong>to a l<strong>in</strong>ear velocity thanks to the roll<strong>in</strong>g wheel, and a damper models the energy loss<br />
due to the contact between the road and the tire.<br />
The vertical prismatic jo<strong>in</strong>t coupled with an elastogap stands for the tire. In this model, we assume that<br />
the Segway moves straight forward and backward. Therefore, we can consider that the two wheels have the<br />
same angular velocity and are on the same transmission shaft. These two wheels are modeled by the two body<br />
cyl<strong>in</strong>ders.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 12
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Model<br />
3.5. Battery<br />
To model the battery, we used generic discharge graphs (V=f(A.h) ). Measur<strong>in</strong>g the current provided to<br />
the system with a current sensor, we <strong>in</strong>tegrate it <strong>in</strong> time to get the quantity of charges used. Interpolat<strong>in</strong>g the<br />
graph <strong>in</strong> a table, the quantity of charges used can then give us the voltage provided by the battery.<br />
To get the graphs, we used the battery block of Simul<strong>in</strong>k which gives the data for different types of<br />
batteries. In our case, we began by model<strong>in</strong>g an Ni-MH.<br />
Plot given by Simul<strong>in</strong>k:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 13
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Test<br />
To test our battery model, we just connected a small resistor to it. We should see a quick discharge of<br />
the battery. If we also plot the quantity of charges used, we should f<strong>in</strong>d the same time for the voltage decay<br />
and the quantity of charges reach<strong>in</strong>g the capacity value.<br />
Configuration:<br />
Test results :<br />
We took the capacity <strong>in</strong> A.sec so that the simulation does not take too much time. However, the<br />
observations are the same as if we used Ah. We see <strong>in</strong> the previous figure that the quantity of charges<br />
<strong>in</strong>creases up to a value of 5.8A.sec, which is the total capacity of the battery. When it reaches this value, the<br />
tension provided falls to 0, which corresponds to the moment when the battery is discharged.<br />
We also observe that the discharge graph is really close to the one provided by Simul<strong>in</strong>k, which confirms<br />
the validity of our battery model.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 14
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Model<br />
3.6. Converter<br />
A DC to DC converter has been added between the battery and the DC motor which allows modulat<strong>in</strong>g<br />
the <strong>in</strong>put voltage com<strong>in</strong>g from the battery. Indeed, the PID controller gives us a desired angular speed for the<br />
DC motor and the role of the DC to DC motor is to adapt the voltage <strong>in</strong> order to reach it.<br />
Here is the block we created <strong>in</strong> order to model the DC to DC converter:<br />
p1<br />
n1<br />
As you can see, it has 2 <strong>in</strong>puts (p1 and n1), 2 outputs (p2 and n2) and a Real Input (u) represent<strong>in</strong>g the<br />
command. In order to control the DC to DC converter represented by this block, we have used the <strong>Modelica</strong><br />
language with the appropriate declarations and equations.<br />
u<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 15<br />
p2<br />
n2
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Tests<br />
We made different tests with the DC to DC converter model. The first one was to use the DC to DC<br />
converter with a constant <strong>in</strong>put voltage (150V) and a constant real <strong>in</strong>put as command (50V).<br />
Configuration:<br />
Results:<br />
constant...<br />
[V]<br />
160<br />
140<br />
120<br />
100<br />
80<br />
60<br />
+ -<br />
ground<br />
realExpression<br />
50<br />
dC_DC_converter<br />
dC_DC_converter.p1.v resistor.v<br />
ground1<br />
40<br />
0.0 0.5 1.0<br />
As we can see, the output voltage is equal to the real <strong>in</strong>put command so that the DC to DC motor functions.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 16<br />
R=2000<br />
resistor
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
The second test we ran was the DC to DC converter coupled with the battery model and still a constant<br />
real <strong>in</strong>put (100V).<br />
Configuration:<br />
Results:<br />
[V]<br />
120<br />
100<br />
80<br />
60<br />
40<br />
20<br />
0<br />
realExpression<br />
100<br />
battery_... dC_DC_...<br />
Here, we can see that the output voltage is not always constant anymore. Indeed, we have to take <strong>in</strong>to<br />
account the fact that the battery discharges itself. In this case, the test shows that the output voltage follows<br />
the real <strong>in</strong>put command as long as the battery is not discharged, phenomenon which was expected.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 17<br />
R=20<br />
ground<br />
-20<br />
0.0 0.2 0.4 0.6 0.8 1.0<br />
resistor<br />
dC_DC_converter.p1.v resistor.v dC_DC_converter.u
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
The third test we ran was the DC to DC converter coupled with the battery model and a ramp (duration<br />
5s, height 200V) as real <strong>in</strong>put.<br />
Configuration:<br />
Results:<br />
[V]<br />
250<br />
200<br />
150<br />
100<br />
50<br />
0<br />
ramp<br />
duration=5<br />
battery_... dC_DC_...<br />
In this test, we can see that the output voltage follows the command (which is not constant <strong>in</strong> this case)<br />
as long as the battery is not discharged.<br />
ground<br />
dC_DC_converter.p1.v resistor.v dC_DC_converter.u<br />
-50<br />
0 1 2 3 4 5<br />
These 3 tests have shown that our DC to DC converter with a real <strong>in</strong>put was valid.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 18<br />
R=20<br />
resistor
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Model<br />
3.7. Handlebar end platform<br />
We have decided to model the handlebar and the platform <strong>in</strong> the same part. The handlebar is modeled<br />
by a simple body cyl<strong>in</strong>der while the platform is modeled by a bodybox:<br />
Model<br />
3.8. The Segway PT<br />
The entire Segway is ma<strong>in</strong>ly divided <strong>in</strong>to 4 parts: the body, the wheels, the control loop, and the<br />
electrical propulsion.<br />
The wheel is connected to the body of the Segway. The frame_a1 will be used to connect the user to the<br />
Segway, the frame_a2 will be used to connect the Segway to the road, and the flangeT1 and supportT1 will be<br />
used to move the Segway along the road. The relative angles sensor models the rotary encoder which<br />
measures the angle between the body of the Segway and the wheels. The absolute angular velocity sensor<br />
models the gyrometers which measure the angular velocity of the body of the Segway compared to an <strong>in</strong>ertial<br />
frame (here the "World").<br />
Thanks to these two sensors, the control loop gives a command to the DC to DC converter. This<br />
converter receives an almost constant voltage from the battery, and delivers a vary<strong>in</strong>g voltage to the DC motor<br />
accord<strong>in</strong>g to the command of the control loop. The DC motor drives the wheels through the gearbox, and<br />
therefore the entire Segway is balanced.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 19
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Complete Segway model:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 20
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Model<br />
3.9. User<br />
The user is modeled very simply because we consider that he doesn’t move on the platform. He is<br />
modeled us<strong>in</strong>g a simple body cyl<strong>in</strong>der. We do not have modeled reactions of the user dur<strong>in</strong>g the motion of the<br />
segway.<br />
4. Experimentation and Interpretation<br />
4.1. Simulation of the Segway behavior<br />
Simulation configuration:<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 21
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
Observations:<br />
S<strong>in</strong>ce the user don’t move on the platform the segway move forward and when it reaches the speed<br />
limit, the handlebar and the user beg<strong>in</strong>s to lean backward <strong>in</strong> order to slow down the segway. When the<br />
segway is leant backward, it beg<strong>in</strong>s to slow down <strong>in</strong> order to reach a speed equal to zero. When this is done,<br />
s<strong>in</strong>ce the user don’t move, the segway is leant backward and therefore it beg<strong>in</strong>s to move backward. The<br />
behavior is correct and close to what was expected. S<strong>in</strong>ce the user does not move on the platform, the segway<br />
is go<strong>in</strong>g to do round trips.<br />
4.2. Comparison of battery durations accord<strong>in</strong>g to the slope<br />
To perform this comparison, we choose a small enough battery so that the Segway does not have the<br />
time to stop and move back.<br />
We see on the result<strong>in</strong>g figure that the battery duration is smaller when the Segway has to climb a<br />
slope. Moreover, if we perform this simulation with a negative slope, we also obta<strong>in</strong> a smaller battery duration<br />
because the Segway has to brake more <strong>in</strong> order not to exceed the speed limit.<br />
Results:<br />
Accelerat<strong>in</strong>g/Mov<strong>in</strong>g forward Brak<strong>in</strong>g/Mov<strong>in</strong>g backward<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 22
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
4.3. Variation of the Segway behavior for different user masses.<br />
In this case, we just change the mass of the user <strong>in</strong> order to see its <strong>in</strong>fluence on the segway behavior.<br />
After simulation, we can see that the frequency of round trips is smaller with the heavier user, but the<br />
amplitude of the movement is almost the same. Therefore, the accelerations are smaller.<br />
Evolution of the segway position on the road with two different users:<br />
( blue user is 1.5 times heavier than the red one)<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 23
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
5. Lessons learned<br />
First, we can say that this assignment was very challeng<strong>in</strong>g. We do not pretend to be expert on the<br />
Segway system but we certa<strong>in</strong>ly have improved our knowledge on it through our model<strong>in</strong>g study. In the same<br />
time, by fac<strong>in</strong>g the difficulties regard<strong>in</strong>g the model<strong>in</strong>g of such a system, we also had to improve our knowledge<br />
on both Dymola software and <strong>Modelica</strong> language.<br />
5.1. Where we struggled<br />
Here are the stages where we have struggled the most:<br />
• understand<strong>in</strong>g the behavior of the Segway and its control<br />
At the beg<strong>in</strong>n<strong>in</strong>g, we did not know that the driver <strong>in</strong> a lean<strong>in</strong>g forward position was experienc<strong>in</strong>g a<br />
force-feedback control through the handle bar, forc<strong>in</strong>g him to lean backward when the system reaches a given<br />
maximum speed.<br />
Concern<strong>in</strong>g the control, we can say that we did not expect such a complexity. We had to th<strong>in</strong>k about an<br />
easiest way to model it without hav<strong>in</strong>g a result<strong>in</strong>g behavior of our model that is too far from the reality.<br />
• f<strong>in</strong>d<strong>in</strong>g data concern<strong>in</strong>g Segway components<br />
For <strong>in</strong>stance, we only know the overall weight of the system. We have not succeeded <strong>in</strong> f<strong>in</strong>d<strong>in</strong>g enough<br />
data regard<strong>in</strong>g its mass distribution so that we had to make approximation. It can be problematic for a system<br />
which is based on balance sens<strong>in</strong>g.<br />
• f<strong>in</strong>d<strong>in</strong>g a way to model the driver<br />
Indeed, the driver has an <strong>in</strong>fluence on the stability of the Segway dur<strong>in</strong>g the motion. When the Segway<br />
reaches its speed limit, <strong>in</strong> reality the driver can feel a force-feedback through the handle bar and should decide<br />
to brake by mov<strong>in</strong>g its gravity center backward <strong>in</strong>stead of <strong>in</strong>sist<strong>in</strong>g lean<strong>in</strong>g forward. In this situation, the driver<br />
helps the Segway to regulate its speed. <strong>Model<strong>in</strong>g</strong> such a behavior was quite hard s<strong>in</strong>ce it means we had to<br />
create a model represent<strong>in</strong>g the driver with the help of an additional controller.<br />
• the discovery of some standard components of the Dymola library and their utilization <strong>in</strong> the model<br />
In particular, the multi-body library was not very <strong>in</strong>tuitive when we had to give a shape <strong>in</strong> 3D to our<br />
Segway model <strong>in</strong> order to respect its <strong>in</strong>ertia.<br />
• debugg<strong>in</strong>g our model, f<strong>in</strong>d<strong>in</strong>g the error<br />
Sometimes, we have forgotten components that have quickly slowed down our work progress like<br />
grounds or fixed parts. In general, we can say that f<strong>in</strong>d<strong>in</strong>g the reason why Dymola was upset was quite timeconsum<strong>in</strong>g.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 24
Jean-V<strong>in</strong>cent DEFRANCE, Guilhem TOURNAIRE<br />
Mickaël KARGULEWICZ, Pascal TRANG<br />
5.2. Where we went down the wrong path and how did we revise our approach<br />
At the beg<strong>in</strong>n<strong>in</strong>g, we did not know how to stabilize the Segway and which parameter had to be<br />
controlled: angular speed, position or acceleration <strong>in</strong> order to obta<strong>in</strong> a Segway that does not fall at the first<br />
acceleration. We did many trials by attempt<strong>in</strong>g to set different conditions on these different parameters, it<br />
was quite unsuccessful. By do<strong>in</strong>g some research on how to model the Segway control, we found that many<br />
people that have attempted to create a Segway by themselves have used a PID controller on the angular<br />
speed. It seemed to be a good idea to use this tool as a controller but we still had to adapt the PID control to<br />
our model. So, we can say that the major problem we had with our model was to f<strong>in</strong>d the way to control it <strong>in</strong><br />
realistic and not too complex way, which took us time and many trials.<br />
5.3. How would we do th<strong>in</strong>gs differently if we were to create another simulation model<br />
It would have been better to have ridden a Segway before the previous assignment for <strong>in</strong>stance. For<br />
another simulation model, we would try this time to have more concrete knowledge on how works the system<br />
we are us<strong>in</strong>g, <strong>in</strong>stead of bas<strong>in</strong>g our knowledge only on theoretical pr<strong>in</strong>ciples.<br />
Then, we can say that we would have made more efforts concern<strong>in</strong>g our time management. That is to<br />
say, we would try to improve our efficiency through a better shar<strong>in</strong>g of the work load and a better<br />
organization.<br />
5.4. Did you learn anyth<strong>in</strong>g new about the behavior of the system you were model<strong>in</strong>g?<br />
Yes, we have learnt new th<strong>in</strong>gs about the behavior of the system, especially concern<strong>in</strong>g the behavior<br />
when the system reaches its speed limit. We also have learnt about the behavior of the battery and its<br />
discharge when comb<strong>in</strong>ed with a DC to DC converter that sets an output voltage.<br />
ME 6105 – October 27 th , 2010<br />
<strong>Homework</strong> 3: <strong>Energy</strong>-<strong>Based</strong> <strong>Systems</strong> <strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>Modelica</strong> 25