Design > Engineering board

Electric Motor Control - severe Geek speak

(1/4) > >>

Mark wood:
I have been working on a control for the electric motors for a while. I'm just about to the point of being ready to put it to actual code and testing. this header is a warning about the content which is highly technical but I tried to write clearly my approach to arriving at the conclusion I have. The architecture of this method is derived from my back ground in turbine engine controls and it draws from some loss of sensor accommodation logic and anticipation logic. Some of the methodology comes from this.

The basic control is a "timer" which my intent for my version is to be key fob start and stop with a timer for backup. I want this because it drives me crazy to have to wait for the timer to run down and something has happened or I am doing trim flights. Besides, I use the key fob for my stooge and it has some extra buttons that should do something.

Warning - there is engineering speak contained with the dialog

Mark wood:
Control Line Model Airplane Motor Control - Timer.
Mark Wood – 3 January 2022 Any use of this content requires acknowledgement of the work of the author. Including any software or hardware generated as a result.

This is the fundamental idea. Rather than using a complex method of measuring attitude and acceleration for a given flight condition and attempting to set a thrust level to balance, why not calculate how much thrust is required for the commanded flight condition and set that thrust? Simple, all you have to do is figure out how much thrust is required. Not quite so simple but doable. Since the thrust required is a function of the maneuver command why not command both simultaneously? Again simple. The following is a dialog on how to accomplish this and make it adjustable enough to meet the demands of a broad spectrum of aircraft. Note that the derivation of the gain function contained herein can also be used to improve the performance of G and attitude based controls and is covered under my use conditional statement above.

I spent a bunch of time thinking about the best way of managing the power output of the electric motors for the control line models. I began a year ago to make a timer and controller for a variable pitch propeller which I think has lots of potential but has a significant number of challenges to overcome. When I review how the current technology timer work I see that they work reasonably well but I believe they can work even better. After reviewing Howard’s data, I’m convinced that an improvement can be made by shifting the power gain over to an input from the control position. After spending some time doing calculations I believe that this is really the only input necessary. The only time I can see where taking attitude as a gain calculation is likely just the wing over maneuvers. Everything else naturally works with control position. Even the wing over, I’m not convinced that attitude is necessary if the entry turn can be made with minimal energy loss.

Let me attempt to explain. The airplane flying in level un-accelerated flight is in balance between thrust and drag. The airplane is also in trim with respect to its aerodynamic surfaces. Whenever we wish to change altitude or attitude the elevator moves and the airplane follows. To do a maneuver such as a loop we must give the control even more deflection. Changing the angle of the elevator changes the angle of attack which increases or decreases the lift. Lift isn’t free and drag follows the lift. If the airplane is in balance when we impart a control the drag slows the airplane down unless we add thrust while we are inputting control.

I want to make a statement here which will follow in all of the derivations. In order to simplify the computations I make the assumption that the speed remains constant. The speed won’t necessarily remain and if it doesn’t it won’t change the resulting architecture but it will needlessly complicate the analysis. If it seems to be missing any part of discussion come back to the bold statement here.

Mark wood:
The current crops of controls react to the onset of G which goes through a filter to remove noise. This causes a lag in response and requires over thrust to correct for the speed droop during the turn.

It turns out this is a fairly simple thing to anticipate the onset of thrust required and the biggest challenge is to know how much thrust to add or subtract. This is the part that takes some effort and knowledge of the aerodynamics involved. Even in this the solution is quite simple but the path to get there is not so easy. At first consideration we think of drag as a direct relationship with lift but it isn’t quite that easy. Since drag is a combination of different elements it has a particular shape which appears to be an exponential function but it is more easily modeled by using a trig function, 1- Cosine. While not a perfect fit, it is close enough to be usable in a power plant control.

This lends itself for use in the control algorithm with a couple of constants which could cover a large range of aircraft gain = k1*(1-k2*cos(k3*alpha)). With three input constants, the gain can be adjusted to fit almost any application.



Photo taken at 45 degree in level ish flight. Notice the control indicator (~4°) and AOA (~4°) vane positions.




From the videos of the airplane equipped with the control position and Angle Of Attack vane indicators, we can get an idea of how the airplane is working in terms of lift coefficient, Cl and the resulting drag coefficient, Cd. Since the airplane is equipped with flaps a series of Cl curves plotted against AOA must be used. I didn’t take the time to plot the flight results so I’ll simply estimate behavior via a straight line. For some of the concept development, in order to simplify the math, I make an assumption of constant velocity. In a control system working on control position the loop would close in a near constant velocity so it makes sense to use this assumption. Give the ability to adjust gains and limits how solidly the control would hold a specific velocity would be something the operator could manage.

There are a couple of advantages associated with this approach the foremost of which is that minimal filtering is necessary of the control input and output. Position sensors tend to be low noise except that pots tend to get noisy with age so, in the powerplant control world, we like to use RVDTs or Hall Effect sensors. Any time a filter is necessary as in the case of accelerometers or gyros a delay is generated. This delay is added to the frame rate of the output and the acceleration time of the powerplant.

The other is an inherent closed control loop even though the specific powerplant control is an open loop architecture. An airplane in level flight will fly at a specific trim condition including the control position. If the airplane slows down, in order to maintain altitude the pilot in the loop, meat servo, has to increase the pitch attitude to maintain altitude. The control position required to increase the attitude will result in a change in power output, eventually stabilizing speed where the power available matches the power required to fly.

Of interest is the behavior in the triangular loops. Watching the AOA video, I notice about a 5 degree control position on the up leg and 0 degree control position on the down leg. Seems like the control would be okay there as well.

Mark wood:
The Figures:

The first Figure, Figure 1, Cl v AOA, is a map of Cl versus AOA with a variation of the flap angle of a 25% chord flap. Each curve is an AOA sweep of Cl for a 5 degree incremental deflection of the flaps. The lowest curve is of an airfoil from 0 to some range near stall. Each dot on the curve is 1 degree change in AOA. Following a singular curve, such as the lowest curve would be representative of a non-flapped airplane. The lift would work as an increase in AOA along that curve. We’ll see that the idea of the 1-cos(x) gain works equally well for this configuration.

I’ve arbitrarily placed two lines on the curve chart to illustrate approximately how a coupled flap airplane would generate the lift as function of the combined effect of flap deflection and pitch angle. You could think of the lines as the ratio of elevator authority to flap pitch moment, kinda, sorta. The reason being is there is some velocity dependency as well. From testing I know that the AOA increases at times to around 15 degrees with flaps deployed.
 
Each line illustrates how the lift increases with control input the line being where control would be with respect to the lift curve which I’ll use the term Operational line. This is kind of how we control inlet guide vanes on turbine engine compressors so the term fits. The control angle, I make an assumption of 1:1 control to flap, from the origin to the crossing at the highest curve would be 45 degrees. As we trace each of the Op lines every curve crossing is an increase of 5 degrees in control position.

 
Figure 1, Cl v AOA -  Lift

Depending on the velocity and the elevator ratio the AOA would be somewhere between zero and allot wherever trim would be. I labeled one line Op line at constant velocity and the other Op line at decaying velocity. This is for illustration purposes and if there were a gain function based on control position the thrust would be increasing to close the difference. This condition wouldn’t likely be static. Whether the condition is or not is dependent upon the difference between the power available, that which is being commanded, and the power required to fly.

The next Figure and the following are of the Lift verses Drag or Cl v Cd. In the same manor I placed multiple curves on each chart for each of the flap positions and AOA sweeps. The interesting result is the kind of fractal growth appearance of the curves. The usefulness of these curves is that the thrust / power requirement can be derived from them.  Both power and thrust are a direct function of the coefficient of drag Cd. On the first chart I have done some calculating of the required lift coefficients and from that we can get an idea of the drag coefficient which would result from a combination of flap position and AOA. Notice that for most of these there are more than one possible solution. I’ve made these same charts for many flap configurations from 15% flap to 40% flap. When I’m heard making some seemly brash statement, it is the result of this kind of analysis.

 
Figure 2 Cl v Cd - Drag


A first pass walk through the analysis of power required to fly is the following. We begin with the first chart and move along the Op line for constant velocity. As we move upward along that line we cross the flap =0 degree line Cl curve and an AOA and Cl value. That Cl value is then translated to Figure 2. I have plotted an intersection for level flight I could have equally used an observed AOA, which I did, and made a point on the corresponding line. I was going to present that on a separate chart but it is so close to the blue line 1-Cos line on Figure 3 it is just as easy to say that is what it looks like.

The next interesting condition is the level flight at 45 degrees condition. This is an interesting analysis and one that absolutely must be done in order to draw the conclusion I have regarding the need to know and use attitude and G in the thrust control algorithm. Like indicated before, I don’t think so provided not too much energy is lost in the corner and after the derivation here, you’ll see that  it is very likely to be able to do exactly that. The limiting condition is how steady do we really want airspeed to remain constant as I think that is entirely achievable. Suffice it to say the G force, lift vector, required to fly tethered at 45 degrees constant speed for a given bank is equal to the G force of the tension in level flight. The weight of the airplane reduces the tension of the line. I’ll derive that later but it’s confirmable in the video and you can see on the captured photo above.

Moving up the scale to 6 G loops we cross the calculated Cl of about 0.98 and can see there is an intersection with the 10 degree flap deflection curve around 4 ish degrees AOA. Looking at the AOA video this seems to be nearly exactly the condition. It repeats again for the 10 G square corners.

 
Figure 3 Cl v Cd - Drag - Annotated

Mark wood:
Implementation:


This is the beauty part as the implementation is super simple just a few lines of code and minimal filtering required. At least I think minimal filtering which is dependent on the input control. The input filtering can be as simple as creating a dead band. A dead band would not allow any gain signal to be generated unless the input was greater than a value. Some gain spikes may occur but the powerplant has inertia which will inherently work as a filter. 

Read input – POS

Filter through a dead band calculation POS_filt = |POS| > Kdb where Kdb could be tunable via external input for different devices or simply be set to be greater than the RMS noise level. Glitches would filter on the output calculation and the ESC governor output. In order to prevent oscillation it likely needs to be some level around 2 degrees control motion. If a linkage is used to a modified servo some play in that linkage wouldn’t be harmful.

Calculate gain G_thrust = K1*(1-K2*(Cos(K3*POS_filt)) Where K1, K2 and K3 are externally tunable via input. The variable constants having different impact on the gain controls. K1 is the overall magnitude of the delta thrust, the larger its value, the more overall gain is available. K2 limits the authority of the position input and needs to be limited to 1 or less. K3 changes the position input to match the control, end point adjustment.

And maybe filter the output G_thrust [1/(n-3)] and give it limits G_thrust  > G_max = G_max. A simple running average filter to smooth noise slightly may or may not be necessary but is in a place for consideration.

Done.

My current timer is implementing this architecture and is set up to use a 4 button 833 Mhz radio Tx and Rx. Button 1 operates the stooge release. Button 2 operates the Start Stop function and buttons 3 and 4 are intended to adjust the Gain constants, 3 is increase and 3 is decrease. I haven’t yet sorted out the mode of operation but theoretically I could use the 3&4 INCR/DECR buttons to make different trimming modes. Mode 1 level flight speed. Mode 2 & 3 would be delta thrust gain tuning.

My selection of the Rx and Tx reflect my coding skill level. There are microprocessor systems today which have built in WiFi  and Bluetooth connectivity which are currently a bit over my head.

Navigation

[0] Message Index

[#] Next page

Go to full version