Difference between revisions of "LoadControl Custom Task"
(→Theory) |
|||
Line 53: | Line 53: | ||
CustomTask LoadControl | CustomTask LoadControl | ||
Parameter velocity, (velocity) | Parameter velocity,(velocity) | ||
Parameter material, (int) | Parameter material,(int) | ||
Parameter direction, (int) | Parameter direction,(int) | ||
Parameter MaxVelocity,(number) | Parameter MaxVelocity,(number) | ||
Parameter Load_Function (user-inputted function) | Parameter "Load_Function (user-inputted function)" | ||
Parameter Kp,(number) | Parameter Kp,(number) | ||
Parameter Ki,(number) | Parameter Ki,(number) | ||
Line 80: | Line 80: | ||
* <tt>velocity</tt> - This is the starting velocity of the simulation for the specified [[Rigid Material|Rigid material]]. The sign of this parameter is probably more important than its value, as long as it is something reasonable. It is needed for initializing the load control. | * <tt>velocity</tt> - This is the starting velocity of the simulation for the specified [[Rigid Material|Rigid material]]. The sign of this parameter is probably more important than its value, as long as it is something reasonable. It is needed for initializing the load control. | ||
* <tt>material</tt> - The material number of the [[Rigid Material|Rigid material]] to be controlled. | * <tt>material</tt> - The material number of the [[Rigid Material|Rigid material]] to be controlled. | ||
* <tt>direction</tt> - An integer | * <tt>direction</tt> - An integer (1, 2, or 3) to choose the direction (x, y, or z) to contrtol for velocity and load. | ||
* <tt>MaxVelocity</tt> - A positive number that limits the magnitude of the velocity of the controlled material - defaults to 5 m/s. | * <tt>MaxVelocity</tt> - A positive number that limits the magnitude of the velocity of the controlled material - defaults to 5 m/s. | ||
* <tt>Load_Function</tt> - A [[User Defined Functions|user defined function]] that gives the desired load. This task doesn't work well with discontinuous functions. | * <tt>Load_Function</tt> - A [[User Defined Functions|user defined function]] that gives the desired load. This task doesn't work well with discontinuous functions. Note that the function is provided in the <tt>name</tt> of the parameter as a single string. The first word of the string must be "Load_Function" and the remainder of the name is the [[User Defined Functions|user defined function]]. | ||
These parameters are for the control algorithm | These following parameters are for the control algorithm. The provided default parameters seem to work well, but each can be changed if needed. | ||
* <tt>Kp</tt> - Proportional gain factor for PID algorithm | |||
* <tt>Ki</tt> - Integral and Derivative gain factors for PID algorithm. (Note: <tt>Kd = 0.25Ki</tt>) | * <tt>Kp</tt> - Proportional gain factor for PID algorithm (default 0.1). | ||
* <tt>smooth</tt> - Exponential smoothing parameter in (0,1). Controls how fast the dynamic relationship between distance and load is updated and also how much smoothing is done on the load values | * <tt>Ki</tt> - Integral and Derivative gain factors for PID algorithm. (Note: <tt>Kd = 0.25Ki</tt>) (default 0.001). | ||
* <tt>smooth</tt> - Exponential smoothing parameter in the range (0,1). Controls how fast the dynamic relationship between distance and load is updated and also how much smoothing is done on the load values (default 0.95). | |||
== To be developed == | == To be developed == | ||
Contact forces are corrupted with fat tail noise. A median filter would help reduce the effect of this noise. | Contact forces are corrupted with fat tail noise. A median filter would help reduce the effect of this noise. |
Revision as of 11:02, 4 May 2016
A custom task run a load control simulation based on calculations contact or reaction forces. .
Introduction
A LoadControl custom task needs either global contact or global reaction for the specified Rigid material depending on if contact for that material is enabled.
This CustomTask tries to achieve the load requested from a provided user defined function by adjusting the velocity of that material. It does that by dynamically estimating the relationship between the displacement and load and then uses a PID control algorithm to adjust the velocity.
Theory
This custom task tries to dynamically estimate the relationship between load and displacement of the rigid material using the following equation:
[math]\displaystyle{ K_t = \text{arg}\min_{K} \left[ \alpha \frac{(L-Kx)^2}{0.5(L^2+(K_{t-1}x)^2)}+(1-\alpha)\frac{(K-K_{t-1})^2}{K_{t-1}^2}\right] }[/math]
where [math]\displaystyle{ K_t }[/math] is the estimate the relationship between load and displacement at time t, x is the displacement, L is the recorded load and [math]\displaystyle{ \alpha }[/math] is the smooth parameter.
This gives:
[math]\displaystyle{ K_t =\frac{\lambda L x + \gamma K_{t-1}}{\lambda x^2 +\gamma} }[/math] where [math]\displaystyle{ \lambda =\frac{2(1-\alpha)}{L^2+(K_{t-1}x)^2} }[/math] and [math]\displaystyle{ \gamma =\frac{\alpha}{K_{t-1}^2} }[/math].
Then the error between requested load L(t) and recorded load L is smoothed and converted to velocity as:
[math]\displaystyle{ e_t =(1-\alpha)\frac{L(t)-L}{K_t}+\alpha e_{t-1} }[/math]
The integrated error is calculated as:
[math]\displaystyle{ Ie_t =\frac{L(t)-L}{K_t}+ Ie_{t-1} }[/math]
The derivative error is calculated with Brown's double exponential smoothing as:
[math]\displaystyle{ e{\scriptstyle 2}_t =(1-\alpha)e_t+ \alpha e{\scriptstyle 2}_{t-1} }[/math]
and
[math]\displaystyle{ De_t = \frac{1-\alpha}{\alpha}(e_t-e{\scriptstyle 2}_t) }[/math]
then finally the velocity is set using the PID algorithm:
[math]\displaystyle{ V_t = K_p e_t + K_i Ie_t + 0.25K_i De_t }[/math]
Note: If the velocity has a magnitude larger than MaxVelocity than it is given that magnitude and the integrated error for that time step is not accrued.
Task Scheduling
In scripted files, a LoadControl custom task is scheduled with the following block:
CustomTask LoadControl Parameter velocity,(velocity) Parameter material,(int) Parameter direction,(int) Parameter MaxVelocity,(number) Parameter "Load_Function (user-inputted function)" Parameter Kp,(number) Parameter Ki,(number) Parameter smooth,(number)
In XML files, these task options are scheduled using <Schedule> elements, which must be within the single <CustomTasks> block:
<Schedule name='LoadControl'> <Parameter name='velocity'>(number)</Parameter> <Parameter name='material'>(int)</Parameter> <Parameter name='direction'>(int)</Parameter> <Parameter name='MaxVelocity'>(number)</Parameter> <Parameter name='Load_Function (function)'/> <Parameter name='Kp'>(number)</Parameter> <Parameter name='Ki'>(number)</Parameter> <Parameter name='smooth'>(number)</Parameter> </Schedule>
These are the parameters that this custom task needs to operate:
- velocity - This is the starting velocity of the simulation for the specified Rigid material. The sign of this parameter is probably more important than its value, as long as it is something reasonable. It is needed for initializing the load control.
- material - The material number of the Rigid material to be controlled.
- direction - An integer (1, 2, or 3) to choose the direction (x, y, or z) to contrtol for velocity and load.
- MaxVelocity - A positive number that limits the magnitude of the velocity of the controlled material - defaults to 5 m/s.
- Load_Function - A user defined function that gives the desired load. This task doesn't work well with discontinuous functions. Note that the function is provided in the name of the parameter as a single string. The first word of the string must be "Load_Function" and the remainder of the name is the user defined function.
These following parameters are for the control algorithm. The provided default parameters seem to work well, but each can be changed if needed.
- Kp - Proportional gain factor for PID algorithm (default 0.1).
- Ki - Integral and Derivative gain factors for PID algorithm. (Note: Kd = 0.25Ki) (default 0.001).
- smooth - Exponential smoothing parameter in the range (0,1). Controls how fast the dynamic relationship between distance and load is updated and also how much smoothing is done on the load values (default 0.95).
To be developed
Contact forces are corrupted with fat tail noise. A median filter would help reduce the effect of this noise.