Movable trailing edge flaps implementation

Hi everyone,

We are trying to develop a controller for individual trailing edge flaps therefore first we need a tool where we can implement blades with movable trailing edge flaps. There are publications from DTU regarding this technique, but they used HAWC2 for simulations. Until now I used FAST for IPC development therefore I am wondering what are the possibilities in FAST for including the movable trailing edge flaps?

Regards,
Robert

Robert,

Are you just trying to change aerodynamic tables depending on flap deflection, or do you also want the flaps treated as separate bodies that affect the mass and stiffness properties of the blade?

If you want to do both, I do not foresee FAST being able to handle that situation for a long time. If you just want to affect the aerodynamic tables, you can do that now with a minor change to AeroDyn. The currently distributed version of FAST has AeroDyn compiled to use 2-D coefficient tables with angle of attack and Reynolds number being the two dimensions. I believe the AeroDyn user’s guide tells how to make a simple change to replace Re with a control setting.

In the version of AeroDyn I am working on now, airfoil tables can be 3-D, with alpha, Re, and control setting being the three dimensions. I am working on cubic-spline routines to interpolate the tables now, but it will be months before the new version is available.

Marshall

I am new to FAST !! i need to add trailing edge flaps in FAST code. is it possible with FAST7 VERSION or it needs a higher version?. What are all the changes to be made in aerodyn? after changing do we have to compile in fortran compiler? would you please help in getting a block in simulink like what i have uploaded ? step by step procedure would help me in easy understanding . help me in this aspect…
flap.png

I am new to FAST !! i need to add trailing edge flaps in FAST code. is it possible with FAST7 VERSION or it needs a higher version?. What are all he changes to be made in aerodyn? after changing do we have to compile in fortran compiler? would you please help in getting a block in simulink like what i have uploaded ? step by step procedure would help me in easy understanding . help me in this aspect…
flap.png

Dear Srinivasa,

Depending on the configuration of the actuators you are talking about, the actuator may or may not impact the structural properties (e.g., trailing-edge microtabs probably won’t impact the structural properties, but deformable trailing edges might). If it is reasonable to assume that the actuator will affect the airfoil data and not the structural properties, it may be reasonable to use AeroDyn’s MulTabLoc option (with suitable modification) to model the actuators. The MulTabLoc option was developed to help users switch airfoil data–not based on Reynolds number–but on some other (possibly controlled) parameter for just this reason. I’ve heard of some users who have made a further customizations that allow them to change the airfoil data through a block in the FAST S-Function for Simulink (for controlling the flaps within Simulink). But I don’t have instructions to help guide you through the process.

Best regards,

Hello everyone,

I finished the design stage of my active flap and want to design a control scheme to evaluate its vibration reduction potential.
The active flap is fair small and I expected it won’t change the structural and inertia properties too much.
Therefore, I decide to use multiple aerodynamic coefficient table to represent the flap angle change.
I found some previous studies use an additional input parameter ‘MutTabLoc’ for the FAST Nonlinear Wind Turbine (Green box in Simulink), such as Dale E. Berg did in his “Active Aerodynamic Blade load Control impacts on Utility Scale Wind Turbines”.
At this step, I want to test if the multi table works before I start to design the controller.
However, for AeroDyn v14 that I am using, the multi table is for the Reynolds number. I didn’t find a direct port that I can specify a particular table and use the values therein. Maybe I am missing something.
Does that mean I need modify the Aerodyn code and recomply it?
Any suggestions?

Thank you.
Xiao

Hi, Xiao.

A question about modifying the code to use MulTabLoc was posted and answered here: Variable airfoils using the MulTabLoc USER function. You will need to modify the code for this feature and recompile it. Note that FAST_IO.f90 is FAST_Subs.f90 in FAST 8.12.

Hi;
I read the view topic:viewtopic.php?f=4&t=1171. based on the moving trailing edge flaps. In that after “u_AD%MulTabLoc(:,:)” comment should we include the location of thr separate table of aero data set or just mention the number as “u_AD%MulTabLoc(:,:)”=“y_AD%MulTabLoc(2,3)”. sry that i couldn’t follow the steps.Is there a full descriptive material on “MulTabLoc”.
thank you:

Dear Srinivasa,

The MulTabLoc capability of old versions of AeroDyn was never documented. The comments on this forum are the best documentation available.

To use MulTabLoc, your airfoil data files should have multiple sets of coefficients distinguished by the Table ID parameter (row 4). For an example of an airfoil data file with multiple sets of coefficients, see the airfoil data provided for the SWRT models in the FAST CertTest (Tests 15, 16, and 17); these airfoil data files use the Reynolds number (in millions) as the Table ID parameter. For moveable trailing edge flaps, you can set the Table ID parameter to whatever is appropriate, say, the flap deflection in mm.

Let’s assume you have an airfoil with 3 tables with the Table ID parameters set to 0, 20 and 50. Then in the source code, you should set u_AD%MulTabLoc(:,:slight_smile: to a number between 0 and 50 for each element of each blade, and AeroDyn will interpolate the airfoil data accordingly. For example, if u_AD%MulTabLoc(2,3) = 10, then element 2 of blade 3 will use airfoil coefficients that are averaged between the first two tables (0 and 20).

I hope that helps.

Best regards,

1 Like

hi Dr. Bonnie;
I a trying to use the multitab option in FAST, as you said in the post viewtopic.php?f=4&t=1171 i have found the location of the code alteration as;
u_AD%MulTabLoc(2,1) = 10,
u_AD%MulTabLoc(3,1) = 15,
u_AD%MulTabLoc(5,1) = 20,
u_AD%MulTabLoc(2,2) = 10,
u_AD%MulTabLoc(3,2) = 15,
u_AD%MulTabLoc(5,2) = 20,
u_AD%MulTabLoc(2,3) = 10,
u_AD%MulTabLoc(3,3) = 15,
u_AD%MulTabLoc(5,3) = 20,
based on the Re number three tabs are used in each blade. Is it correct?? can i compile ?? kindly help me to solve this issue !!

Dear Srinivasa,

From your settings, it looks like you want to set elements 2, 3, and 5 of blades 1, 2, and 3 to use Table ID parameters of 10, 15, and 20, respectively. Is that correct? I don’t see any reason why you couldn’t compile with that change.

Best regards,

Hi Dr.bonnie;
I want to know how to choose the table id parameter!! What connection it has with the blade tip bending moment??the values 10,15 and 17 in previous post are rough given. I want to change the airfoil data based on the value of blade tip deflection so that the new airfoil data would nullify the effect of the bending moment of the blade!!! Kindly give your suggestions!!

Hi Srinivasa,

Are your trying to control the flap using a close loop control logic?
What I did is to connect it to FAST/Simulink and import the bending moment at each time step and use the PID controller to adjust the flap angle, which is corresponding to a airfoil table.

Best Regards,
Xiao

hi Xiao.Sun;
thank youverymuch for your kind reply !!! I have not yet made the modification in the source code of FAST8.10 . But my doubt is whether the change in my above post is enough to use the multitab flap. If it is so then what about the airfoil data, how should we get the airfoil data for different flap deflection condition. For example if we use some mm of flap deflection then the airfoil data at that deflected point is needed. isn’t it? how shall we get the airfoil data at each deflected flap angle to switch. If you have any example code kindly display it(both the changes in source code and the change in airfoil data file). thank you once again!!!

Hi Srinivasa

for the airfoil data for different flap angle, you need to obtain it from other numerical and experimental methods, such as wind tunnel testing, CFD simulation or XFoil Estimation.
then modify the aeroData file to combine several tables in one file, for example, here the Table ID is my flap angle.


NACA64 airfoil - Clark Y external flap with an aspect ratio of 17.  Original Cl, Cd, and Cm get from CFD using Fluent, created by Xiao Sun 3-18-3015
Cl and Cd values corrected for rotational stall delay and Cd values corrected using the Viterna method for 0 to 90deg AOA using AirfoilPrep
   3        Number of airfoil tables in this file
  -5.0		0.0		5.0      Table ID parameter
11.4		11.9		12.4					
0.0		0.0		0.0					
0.0		0.0		0.0					
0.0		0.0		0.0					
-1.2394		-3.2023		-5.3040					
7.4890		7.8301		7.8602					
1.6455		2.0640		2.4287					
-0.5318  	-0.3739		-0.1029					
-0.5800		-2.7500		-3.2900					
0.0094		0.0088		0.0088					
-180.00	0.0000	0.3298	0.0000	0.0000	0.1427	0.0000	0.0000	0.4135	0.0000
-170.00	0.3330	0.3746	0.4000	0.3880	0.1903	0.4000	0.4560	0.4570	0.4000
-160.00	0.6670	0.5029	0.2291	0.7770	0.3271	0.3885	0.9120	0.5816	0.4316
-150.00	0.8350	0.6981	0.2946	0.9520	0.5361	0.4323	1.0940	0.7706	0.4951
-140.00	0.7730	0.9344	0.3208	0.8430	0.7911	0.4249	0.9300	0.9985	0.4936
-130.00	0.6890	1.1803	0.3569	0.7310	1.0600	0.4433	0.7820	1.2341	0.5130
-120.00	0.5650	1.4024	0.3920	0.5870	1.3089	0.4684	0.6140	1.4442	0.5373
-110.00	0.3990	1.5698	0.4183	0.4090	1.5058	0.4888	0.4210	1.5984	0.5563
-100.00	0.2040	1.6575	0.4297	0.2070	1.6250	0.4968	0.2100	1.6720	0.5626
-90.00	0.0000	1.6500	0.4227	0.0000	1.6500	0.4873	0.0000	1.6500	0.5514
-80.00	-0.2040	1.6575	0.4246	-0.2070	1.6250	0.4710	-0.2100	1.6720	0.5567
-70.00	-0.3990	1.5698	0.4079	-0.4090	1.5058	0.4383	-0.4210	1.5984	0.5444
-60.00	-0.5650	1.4024	0.3768	-0.5870	1.3089	0.3948	-0.6140	1.4442	0.5195
-50.00	-0.6890	1.1803	0.3370	-0.7310	1.0600	0.3473	-0.7820	1.2341	0.4889
-40.00	-0.7730	0.9344	0.2958	-0.8430	0.7911	0.3021	-0.9300	0.9985	0.4615
-30.00	-0.8350	0.6981	0.2619	-0.9520	0.5361	0.2635	-1.0940	0.7706	0.4493
-20.00	-0.7670	0.4326	0.2062	-0.8190	0.3146	0.1867	-0.8600	0.4849	0.3559
-10.00	-0.6000	0.1311	0.1330	-0.5020	0.0967	0.0733	-0.3190	0.1452	0.2047
-6.00	-0.5340	0.0105	0.0076	-0.3750	0.0096	-0.0505	-0.1020	0.0093	-0.1323
-5.46	-0.4870	0.0104	0.0082	-0.3040	0.0094	-0.0552	-0.0270	0.0091	-0.1372
-4.92	-0.4390	0.0103	0.0086	-0.2320	0.0093	-0.0600	0.0490	0.0090	-0.1421
-4.37	-0.3880	0.0102	0.0084	-0.1600	0.0091	-0.0647	0.1250	0.0089	-0.1469
-3.83	-0.3330	0.0100	0.0072	-0.0870	0.0090	-0.0694	0.2010	0.0088	-0.1517
-3.29	-0.2740	0.0099	0.0050	-0.0130	0.0089	-0.0740	0.2760	0.0088	-0.1564
-2.75	-0.2100	0.0098	0.0020	0.0610	0.0088	-0.0787	0.3520	0.0089	-0.1610
-2.20	-0.1430	0.0097	-0.0017	0.1360	0.0088	-0.0832	0.4270	0.0090	-0.1656
-1.66	-0.0730	0.0096	-0.0058	0.2100	0.0089	-0.0878	0.5020	0.0092	-0.1701
-1.12	-0.0010	0.0095	-0.0101	0.2850	0.0089	-0.0923	0.5770	0.0093	-0.1746
-0.58	0.0720	0.0094	-0.0146	0.3600	0.0090	-0.0968	0.6520	0.0095	-0.1790
-0.03	0.1460	0.0095	-0.0192	0.4340	0.0092	-0.1012	0.7270	0.0098	-0.1834
0.51	0.2200	0.0096	-0.0238	0.5090	0.0094	-0.1057	0.8010	0.0101	-0.1877
1.05	0.2940	0.0096	-0.0284	0.5830	0.0096	-0.1101	0.8750	0.0104	-0.1920
1.59	0.3680	0.0098	-0.0331	0.6570	0.0099	-0.1146	0.9490	0.0108	-0.1963
2.14	0.4420	0.0100	-0.0377	0.7310	0.0102	-0.1190	1.0230	0.0112	-0.2006
2.68	0.5160	0.0103	-0.0423	0.8050	0.0106	-0.1235	1.0960	0.0117	-0.2049
3.22	0.5900	0.0106	-0.0470	0.8790	0.0110	-0.1280	1.1700	0.0122	-0.2092
3.76	0.6640	0.0109	-0.0517	0.9530	0.0114	-0.1325	1.2430	0.0128	-0.2136
4.31	0.7370	0.0113	-0.0565	1.0260	0.0119	-0.1371	1.3170	0.0134	-0.2181
4.85	0.8110	0.0117	-0.0614	1.1000	0.0125	-0.1418	1.3900	0.0141	-0.2226
5.39	0.8850	0.0121	-0.0663	1.1730	0.0131	-0.1466	1.4640	0.0148	-0.2272
5.93	0.9590	0.0126	-0.0713	1.2460	0.0138	-0.1515	1.5380	0.0156	-0.2319
6.47	1.0350	0.0132	-0.0764	1.3190	0.0146	-0.1566	1.6110	0.0164	-0.2367
7.02	1.1120	0.0138	-0.0819	1.3930	0.0155	-0.1619	1.6850	0.0173	-0.2416
7.56	1.1920	0.0144	-0.0879	1.4680	0.0163	-0.1673	1.7580	0.0184	-0.2466
8.10	1.2730	0.0150	-0.0948	1.5460	0.0171	-0.1729	1.8320	0.0196	-0.2516
8.64	1.3550	0.0157	-0.1026	1.6260	0.0177	-0.1786	1.9060	0.0210	-0.2568
9.19	1.4340	0.0174	-0.1110	1.7050	0.0185	-0.1837	1.9810	0.0224	-0.2622
9.73	1.5020	0.0206	-0.1195	1.7780	0.0194	-0.1878	2.0580	0.0238	-0.2678
10.27	1.5550	0.0262	-0.1275	1.8400	0.0206	-0.1902	2.1360	0.0250	-0.2739
10.81	1.5900	0.0343	-0.1342	1.8890	0.0233	-0.1924	2.2110	0.0263	-0.2806
11.36	1.6070	0.0446	-0.1379	1.9200	0.0299	-0.1976	2.2730	0.0282	-0.2883
11.90	1.6060	0.0566	-0.1371	1.9300	0.0428	-0.2092	2.3100	0.0315	-0.2972
12.44	1.5880	0.0699	-0.1306	1.9160	0.0638	-0.2296	2.3140	0.0364	-0.3074
12.98	1.5580	0.0831	-0.1202	1.8830	0.0905	-0.2549	2.2880	0.0438	-0.3172
13.53	1.5220	0.0943	-0.1086	1.8350	0.1187	-0.2788	2.2360	0.0541	-0.3241
14.07	1.4860	0.1018	-0.0989	1.7820	0.1444	-0.2945	2.1670	0.0681	-0.3255
14.61	1.4540	0.1048	-0.0934	1.7280	0.1643	-0.2985	2.0860	0.0857	-0.3203
15.15	1.4270	0.1052	-0.0932	1.6770	0.1785	-0.2948	2.0050	0.1053	-0.3111
15.69	1.4020	0.1056	-0.0992	1.6340	0.1871	-0.2889	1.9340	0.1249	-0.3012
16.24	1.3790	0.1082	-0.1123	1.6000	0.1907	-0.2860	1.8820	0.1428	-0.2940
16.78	1.3590	0.1144	-0.1310	1.5760	0.1904	-0.2874	1.8520	0.1587	-0.2922
17.32	1.3430	0.1242	-0.1515	1.5600	0.1886	-0.2899	1.8360	0.1753	-0.2985
17.86	1.3350	0.1374	-0.1696	1.5490	0.1874	-0.2898	1.8270	0.1945	-0.3150
18.41	1.3340	0.1542	-0.1817	1.5380	0.1890	-0.2844	1.8170	0.2185	-0.3437
18.95	1.3390	0.1757	-0.1884	1.5300	0.1937	-0.2775	1.8050	0.2461	-0.3800
19.49	1.3410	0.2032	-0.1923	1.5240	0.2008	-0.2765	1.7900	0.2742	-0.4165
20.03	1.3340	0.2385	-0.1961	1.5230	0.2097	-0.2888	1.7750	0.2999	-0.4456
20.58	1.3130	0.2813	-0.2018	1.5280	0.2207	-0.3184	1.7590	0.3219	-0.4618
21.12	1.2870	0.3259	-0.2089	1.5340	0.2371	-0.3590	1.7440	0.3430	-0.4661
21.66	1.2620	0.3651	-0.2165	1.5400	0.2625	-0.4021	1.7310	0.3676	-0.4610
22.20	1.2500	0.3921	-0.2236	1.5400	0.3007	-0.4391	1.7190	0.3997	-0.4489
22.75	1.2510	0.4064	-0.2303	1.5340	0.3498	-0.4641	1.7090	0.4401	-0.4341
23.29	1.2590	0.4167	-0.2383	1.5220	0.4001	-0.4751	1.7020	0.4854	-0.4231
23.83	1.2670	0.4323	-0.2493	1.5080	0.4412	-0.4701	1.6970	0.5316	-0.4224
24.37	1.2690	0.4614	-0.2647	1.4920	0.4638	-0.4478	1.6940	0.5749	-0.4381
24.92	1.2630	0.5044	-0.2843	1.4760	0.4679	-0.4106	1.6930	0.6148	-0.4693
25.46	1.2520	0.5567	-0.3067	1.4590	0.4598	-0.3634	1.6920	0.6524	-0.5109
26.00	1.2380	0.6135	-0.3306	1.4420	0.4454	-0.3113	1.6930	0.6887	-0.5577
30.00	1.1930	0.6981	-0.3346	1.3590	0.5361	-0.3245	1.5630	0.7706	-0.5438
40.00	1.1040	0.9344	-0.3565	1.2050	0.7911	-0.3566	1.3290	0.9985	-0.5343
50.00	0.9840	1.1803	-0.3831	1.0440	1.0600	-0.3901	1.1180	1.2341	-0.5410
60.00	0.8070	1.4024	-0.4064	0.8390	1.3089	-0.4230	0.8780	1.4442	-0.5517
70.00	0.5700	1.5698	-0.4223	0.5840	1.5058	-0.4523	0.6010	1.5984	-0.5596
80.00	0.2920	1.6575	-0.4283	0.2950	1.6250	-0.4748	0.2990	1.6720	-0.5606
90.00	0.0000	1.6500	-0.4227	0.0000	1.6500	-0.4873	0.0000	1.6500	-0.5514
100.00	-0.2040	1.6575	-0.4297	-0.2070	1.6250	-0.4968	-0.2100	1.6720	-0.5626
110.00	-0.3990	1.5698	-0.4183	-0.4090	1.5058	-0.4888	-0.4210	1.5984	-0.5563
120.00	-0.5650	1.4024	-0.3920	-0.5870	1.3089	-0.4684	-0.6140	1.4442	-0.5373
130.00	-0.6890	1.1803	-0.3569	-0.7310	1.0600	-0.4433	-0.7820	1.2341	-0.5130
140.00	-0.7730	0.9344	-0.3208	-0.8430	0.7911	-0.4249	-0.9300	0.9985	-0.4936
150.00	-0.8350	0.6981	-0.2946	-0.9520	0.5361	-0.4323	-1.0940	0.7706	-0.4951
160.00	-0.6670	0.5029	-0.2291	-0.7770	0.3271	-0.3885	-0.9120	0.5816	-0.4316
170.00	-0.3330	0.3746	-0.5000	-0.3880	0.1903	-0.5000	-0.4560	0.4570	-0.5000
180.00	0.0000	0.3298	0.0000	0.0000	0.1427	0.0000	0.0000	0.4135	0.0000

for the source code, what you did is a passive flap. What I did here is to read the control signal from simulink. But the idea is the same.

DO I=1,3
        u_AD14%MulTabLoc(16,i) = m_FAST%ExternInput%FlapCtrl(i)
    END Do

Thanks
Xiao

hi xiao.sun;
Is this command :
“DO I=1,3
u_AD14%MulTabLoc(16,i) = m_FAST%ExternInput%FlapCtrl(i)
END Do”
is alone enough to import the bending moment from the simulink !! i am new to this fortran language !!! if it is so then we have to recompile fast right??

Hello,

No, it is not enough. You have to modify several other subroutines according to your applications. Then recomply the FAST lib file in order to run with Simulink.

hi Xiao.Sun ;
thank you for your kind reply!!! If it is not a matter would you please share us with list of all changes to be made to FAST library functions to initiate the simulink interfaced flap control. It would be useful for designing a smart rotor. I am trying to propose a suitable controller for the Microtab flap angle control, since i am basically a control engineer…

Hello,

I did this work one year ago. So I may forget some modifications I did.
Currently, since no one describe this process, I plan to detail it in the appendix of my PhD thesis. You can read it and cite it, but it will be published in this August.
I also did some microtab control in my research projects and the paper is currently under review.

Here are some hints:

1)Fast_library.f90


IF ( NINT(InitInpAry(2)) == 1 ) THEN
      ExternInitData%LidRadialVel = .true.
   ELSE
      ExternInitData%LidRadialVel = .false.
   END IF
   
    !Xiao Sun: add flap input
    do i = 1, 3
    ExternInitData%FlapPos(i) = InitInpAry(i+2) 
    end do
    !-------------
   
   CALL FAST_InitializeAll_T( t_initial, 1_IntKi, Turbine, ErrStat, ErrMsg, InputFileName, ExternInitData )


IF ( NumInputs_c > NumFixedInputs ) THEN  ! NumFixedInputs is the fixed number of inputs
         IF ( NumInputs_c == NumFixedInputs + 3 ) &
             !Xiao Sun: Set NumAdditionalInput to 3
             ! Pass three flap angle input to AeroDyn
             m_FAST%ExternInput%FlapCtrl   = InputAry(9:11)
             m_FAST%ExternInput%LidarFocus = InputAry(9:11)
      END IF   

2)FAST_subs.f90

!Xiao Sun: add m_FAST
!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

      ! Passed variables
  ! Xiao Sun: add m_FAST
   TYPE(FAST_MiscVarType),      INTENT(IN   )   :: m_FAST      ! Misc variables (including external inputs) for the glue code
   TYPE(FAST_ParameterType),    INTENT(IN   )   :: p_FAST      ! parameter FAST data    
   TYPE(AD14_InputType),        INTENT(INOUT)   :: u_AD14      ! The inputs to AeroDyn14
   TYPE(ED_OutputType),         INTENT(IN)      :: y_ED        ! The outputs from the structural dynamics module
   TYPE(FAST_ModuleMapType),    INTENT(INOUT)   :: MeshMapData ! Data for mapping between modules
   
   INTEGER(IntKi)                               :: ErrStat     ! Error status of the operation
   CHARACTER(*)                                 :: ErrMsg      ! Error message if ErrStat /= ErrID_None

      ! Local variables:
  !Xiao Sun: add I
   INTEGER(IntKi)                               :: I           ! Loops through blades
   INTEGER(IntKi)                               :: J           ! Loops through nodes / elements.
   INTEGER(IntKi)                               :: K           ! Loops through blades.
   INTEGER(IntKi)                               :: NodeNum     ! Node number for blade/node on mesh
   INTEGER(IntKi)                               :: NumBl
   INTEGER(IntKi)                               :: BldNodes



! Xiao Sun: Set MulTabLoc based on FlapCtrl
    DO I=1,3
        u_AD14%MulTabLoc(16,i) = m_FAST%ExternInput%FlapCtrl(i)
    END Do


IF ( p_FAST%CompAero == Module_AD14 ) THEN
      !Xiao Sun: add m_FAST
      CALL AD14_InputSolve_NoIfW( p_FAST, m_FAST, AD14%Input(1), ED%Output(1), MeshMapData, ErrStat2, ErrMsg2 )   
         CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )  


IF ( p_FAST%CompAero == Module_AD14 ) THEN 
      !Xiao Sun: add m_FAST
      CALL AD14_InputSolve_NoIfW( p_FAST, m_FAST, AD14%Input(1), ED%Output(1), MeshMapData, ErrStat2, ErrMsg2 )
         CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )  


! Xiao Sun: add initialization for flap 
   IF (PRESENT(ExternInitData)) THEN
       do i=1,3
             m_FAST%ExternInput%FlapCtrl(i) = ExternInitData%FlapPos(i)
       end do 
    END IF

3)FAST_Type.f90

! =========  FAST_ExternInputType  =======
  TYPE, PUBLIC :: FAST_ExternInputType
    REAL(ReKi)  :: GenTrq      ! generator torque input from Simulink/Labview [-]
    REAL(ReKi)  :: ElecPwr      ! electric poser input from Simulink/Labview [-]
    REAL(ReKi)  :: YawPosCom      ! yaw position command from Simulink/Labview [-]
    REAL(ReKi)  :: YawRateCom      ! yaw rate command from Simulink/Labview [-]
    REAL(ReKi) , DIMENSION(1:3)  :: BlPitchCom      ! blade pitch commands from Simulink/Labview [rad/s]
    REAL(ReKi)  :: HSSBrFrac      ! Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW [-]
    !Xiao Sun: flapCtrl
    REAL(ReKi) , DIMENSION(1:3)  :: FlapCtrl      ! Flap Angle Control Signal [deg]
    REAL(ReKi) , DIMENSION(1:3)  :: LidarFocus      ! lidar focus (relative to lidar location) [m]
  END TYPE FAST_ExternInputType

 =========  FAST_ExternInitType  =======
! Xiao Sun: Add initial viarable for flap?
  TYPE, PUBLIC :: FAST_ExternInitType
    REAL(DbKi)  :: Tmax = -1      ! External code specified Tmax [s]
    INTEGER(IntKi)  :: SensorType = SensorType_None      ! lidar sensor type, which should not be pulsed at the moment; this input should be replaced with a section in the InflowWind input file [-]
    LOGICAL  :: LidRadialVel      ! TRUE => return radial component, FALSE => return 'x' direction estimate [-]
    INTEGER(IntKi)  :: TurbineID      ! ID number for turbine (used to create output file naming convention) [-]
    REAL(ReKi) , DIMENSION(1:3)  :: TurbinePos      ! Initial position of turbine base (origin used in future for graphics) [m]
    INTEGER(IntKi)  :: NumSCin      ! number of controller inputs [from supercontroller] [-]
    INTEGER(IntKi)  :: NumSCout      ! number of controller outputs [to supercontroller] [-]
    ! Xiao Sun: add flap
    REAL(ReKi) , DIMENSION(1:3)  :: FlapPos      ! Initial position of flap  [deg]
  END TYPE FAST_ExternInitType

DstExternInputTypeData%GenTrq = SrcExternInputTypeData%GenTrq
    DstExternInputTypeData%ElecPwr = SrcExternInputTypeData%ElecPwr
    DstExternInputTypeData%YawPosCom = SrcExternInputTypeData%YawPosCom
    DstExternInputTypeData%YawRateCom = SrcExternInputTypeData%YawRateCom
    DstExternInputTypeData%BlPitchCom = SrcExternInputTypeData%BlPitchCom
    DstExternInputTypeData%HSSBrFrac = SrcExternInputTypeData%HSSBrFrac
    ! Xiao Sun: add FlapCtrl
    DstExternInputTypeData%FlapCtrl = SrcExternInputTypeData%FlapCtrl

Int_BufSz  = 0
      Re_BufSz   = Re_BufSz   + 1  ! GenTrq
      Re_BufSz   = Re_BufSz   + 1  ! ElecPwr
      Re_BufSz   = Re_BufSz   + 1  ! YawPosCom
      Re_BufSz   = Re_BufSz   + 1  ! YawRateCom
      Re_BufSz   = Re_BufSz   + SIZE(InData%BlPitchCom)  ! BlPitchCom
      Re_BufSz   = Re_BufSz   + 1  ! HSSBrFrac
      Re_BufSz   = Re_BufSz   + SIZE(InData%FlapCtrl)    !Xiao Sun: add FlapCtrl         
      Re_BufSz   = Re_BufSz   + SIZE(InData%LidarFocus)


ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%GenTrq
      Re_Xferred   = Re_Xferred   + 1
      ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%ElecPwr
      Re_Xferred   = Re_Xferred   + 1
      ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%YawPosCom
      Re_Xferred   = Re_Xferred   + 1
      ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%YawRateCom
      Re_Xferred   = Re_Xferred   + 1
      ReKiBuf ( Re_Xferred:Re_Xferred+(SIZE(InData%BlPitchCom))-1 ) = PACK(InData%BlPitchCom,.TRUE.)
      Re_Xferred   = Re_Xferred   + SIZE(InData%BlPitchCom)
      ReKiBuf ( Re_Xferred:Re_Xferred+(1)-1 ) = InData%HSSBrFrac
      Re_Xferred   = Re_Xferred   + 1
      ! Xiao Sun: add FlapCtrl
      ReKiBuf ( Re_Xferred:Re_Xferred+(SIZE(InData%FlapCtrl))-1 ) = PACK(InData%FlapCtrl,.TRUE.)
      Re_Xferred   = Re_Xferred   + SIZE(InData%FlapCtrl)
      ReKiBuf ( Re_Xferred:Re_Xferred+(SIZE(InData%LidarFocus))-1 ) = PACK(InData%LidarFocus,.TRUE.)
      Re_Xferred   = Re_Xferred   + SIZE(InData%LidarFocus)

 OutData%HSSBrFrac = ReKiBuf( Re_Xferred )
      Re_Xferred   = Re_Xferred + 1
      ! xiao Sun: add FlapCtrl
      i1_l = LBOUND(OutData%FlapCtrl,1)
      i1_u = UBOUND(OutData%FlapCtrl,1)
      ALLOCATE(mask1(i1_l:i1_u),STAT=ErrStat2)

This should be enough. And you need recomply FAST library.

hi xiao,
thank you very much !!!waiting to cite your thesis and paper !!!