logging defined DISCON.dll variables in output file

Hi everyone,

I am trying to modify the NREL5MW DISCON controller and log some variables in output file.
In Bladed the code below would do the job. however, in FAST this code does not log the defined variable.

    avrSwap[65] =1; //No of outputs for logging
iFirstLog = NINT(avrSwap[62])-1; //Address of first output
strcpy_s(OutName, "flg;"); //Names and units
avrSwap[iFirstLog] = aaa;

does anyone know how to log data from the DISCON controller into the output file.

Best Regards

Saman.Poushpas

Hi, Saman.

We have not yet implemented the ability to output the data logging channels from Bladed DLL controllers. For now, I think people just write separate files inside the DLL when they need those data.

Sorry for the inconvenience.

Dear bonnie

could you please direct me to an example or guide me how to write such a file. I am trying to design a controller for a TLP 5MW turbine for 70m water depth.it is very important to log some data for controller design.
can i use one of the unused avrSwap=0 arrays to get the data out ? for instance avrSwap[40] is demanded yaw actuator torque and is equal to zero in the controller.

Best regards

Saman

The first option would be to just write a file inside your dll code. In C, it would be something like this: On initialization, you’d open a file for writing (writing the headers and units, if desired): fp = fopen( file_name , "w" ); on each call to the DLL, you can write a line to the file: fprintf(fp,"%f %f \n", t, aaa) ; and at the end, you’d close the file: fclose(fp);

If you want the DLL output in the FAST output file, you’ll have to modify the ServoDyn code. Inside your DLL, you should put your outputs in some unused avrSwap records (e.g., records 120-129 are available, assuming the array starts at 1) in the DLL; then it’s just a matter of putting them in the WriteOutput array in ServoDyn. The easiest way is to probably just overwrite some of the ServoDyn output channels. If you’re not using the nacelle tuned-mass damper, you could overwrite those channels with values from your DLL. You’d need to make sure that the lines telling you that those channels are invalid are commented out in the SetOutParam routine: ! InvalidOutput( NTMD_XQ) = ( .not. p%CompNTMD ) ! InvalidOutput( NTMD_XQD) = ( .not. p%CompNTMD ) ! InvalidOutput( NTMD_YQ) = ( .not. p%CompNTMD ) ! InvalidOutput( NTMD_YQD) = ( .not. p%CompNTMD )
Then, overwrite them in the SrvD_CalcOutput routine. Change this: AllOuts(NTMD_XQ ) = x%NTMD%tmd_x(1) AllOuts(NTMD_XQD) = x%NTMD%tmd_x(2) AllOuts(NTMD_YQ ) = x%NTMD%tmd_x(3) AllOuts(NTMD_YQD) = x%NTMD%tmd_x(4) to something like this: AllOuts(NTMD_XQ ) = OtherState%dll_data%avrSWAP(120) AllOuts(NTMD_XQD) = OtherState%dll_data%avrSWAP(121) AllOuts(NTMD_YQ ) = OtherState%dll_data%avrSWAP(122) AllOuts(NTMD_YQD) = OtherState%dll_data%avrSWAP(123)
And then select those channels (NTMD_XQ, NTMD_XQD, NTMD_YQ, NTMD_YQD) in the ServoDyn input file.

I see, so i need to create a text file in the code like in C code,OK that’s a good approach.
many thanks

Dear Bonnie

thanks again for your excellent guidance.

for the second option, modifying the servoDyn commands, then I have to compile the FAST is it true?
since I am using FASTv7 which allows me to extract the linear model out of the FAST I assume I have to make similar changes in the FAST_IO file and then compile it again?
I have tried to compile FAST v8 with modified servoDyn file using Visual studio and I received warnings and a general error as follow:

Warning 1 FAST_Project: warning: TargetPath(C:\Users\mfb09161\Desktop\FASTv8\bin\FAST_Project.exe) does not match the Linker’s OutputFile property value (C:\Users\mfb09161\Desktop\FASTv8\bin\FAST_dev_Debug_Win32.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
Warning 2 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ERF] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 215
Warning 3 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ERF] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 228
Warning 4 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [ERF] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 241
Warning 5 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [GAMMA] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 254
Warning 6 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [GAMMA] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 267
Warning 7 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [GAMMA] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 280
Warning 8 warning #7410: Fortran 2003 does not allow this keyword. [CARRIAGECONTROL] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 301
Warning 9 warning #7410: Fortran 2003 does not allow this keyword. [CONVERT] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 342
Warning 10 warning #7416: Fortran 2003 does not allow this intrinsic procedure. [EXIT] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\NWTC_Library\SysIVF.f90 369
Warning 11 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [INITOUT] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\ServoDyn\TMD.f90 56
Warning 12 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [XD] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\MoorDyn\MoorDyn.f90 42
Warning 13 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [Z] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\MoorDyn\MoorDyn.f90 42
Warning 14 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [U] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\Waves2.f90 95
Warning 15 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\Waves2.f90 95
Warning 16 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [XD] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\Waves2.f90 95
Warning 17 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [Z] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\Waves2.f90 95
Warning 18 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [OTHERSTATE] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\Waves2.f90 95
Warning 19 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [DXDT] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\WAMIT.f90 1589
Warning 20 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [XD] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\IceFloe\IceFloe.f90 80
Warning 21 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [Z] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\IceFloe\IceFloe.f90 80
Warning 22 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [OTHERSTATE] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\IceFloe\IceFloe.f90 80
Warning 23 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [DXDT] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\HydroDyn\HydroDyn.f90 1501
Warning 24 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [DXDT] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\AeroDyn\AeroDyn.f90 1301
Warning 25 warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [Z_RESIDUAL] C:\Users\mfb09161\Desktop\FASTv8\Source\dependencies\AeroDyn\AeroDyn.f90 1358
Error 26 general error c101008d: Failed to write the updated manifest to the resource of file “C:\Users\mfb09161\Desktop\FASTv8\bin\FAST_Project.exe”. The system cannot find the file specified. mt.exe

specified.mt.exe ??? :unamused:

Sorry i mean FAST_Project.exe in bin folder

sorry I found the solution thanks 8)

Hi, Saman.

Yes.

You can tell Visual Studio not to generate the manifest file (under Project->properties->Linker->Manifest File, set “generate manifest” to “no”). You shouldn’t need a manifest, and for some reason Visual Studio sometimes complains that it can’t generate it.

This error occurs because you’ve got a newer version of the Intel compiler that I used. The integrations are a little different with Visual Studio, so I’d recommend going into Project->properties->Configuration properties->General and changing output directory = …\bin, target name = FAST_dev_$(PlatformName), Target Extension = .exe, and then using the default value for Output File in the Project->properties->Configuration properties->Linker (which should be $(OutDir)$(TargetName)$(TargetExt))

The other warnings can be ignored.