Question about Fast and MEX S-Function

Dear all,

my name is Julian Michael and I am currently writing my master thesis in Berlin, Germany. I started to deal with FAST a few weeks ago. My main goal is to simulate a small windturbine (r_blade = 0,35m), which is implemented as a “ramping test” (no generator, but flywheel mass). To achieve this I created simple windfiles, bladefiles, etc. and edited the input-files in FAST. I run the OpenLoop-Version with steady wind.

My first question is: How can I solve the following error. When I run Start_Simulation.m I get:

[code]Error using Simsetup (line 24)
Error while obtaining sizes from MEX S-function ‘FAST_SFunc’ in
‘FAST_OpenLoop/FAST Nonlinear Wind Turbine/S-Function’.

Error in run (line 57)
evalin(‘caller’, [s ‘;’]);

Error in Start_Simulations (line 23)
run ([Simsetup_path ‘\Simsetup.m’]);

Caused by:
Error using Simsetup (line 24)
Closing program.[/code]

My second question is: Do I have to consider something special if I want to implement this “ramping test” into FAST?

Since I’m not yet experienced in using FAST please let me know If you need any details of my simulation.

Thank you in advance.

Yours faithfully,
Julian Michael

Julian,

Start_Simulation.m is not an NREL script, but the error message you are getting says it’s caused by something on line 24 of Simsetup.m. Line 24 of the NREL-released Simsetup.m is commented out. Have you modified it? The error message reads like something from the Simulink window. Is there a different error message at the Matlab Command Window? The messages in the Command Window are generated by FAST and are generally more helpful for finding why the simulation doesn’t run. If you still can’t figure out the issue, please post the Matlab code you are trying to run.

I’ll let someone else answer your second question.

Bonnie,

thank you for your reply. I got FAST as a package and didn’t know that this is not NREL Code.

I run the simulation via Start_Simulation.m:

[code]% the FAST Simulation folder must be the current directory
clc
clear all;
Simulation_path = pwd; % current working directory as an variable

%% ============== 1_SteadyWind - 15 mps, NoControl =========================
% % multiple(k) simulations-runs with varying generator moments (rated): 1_SteadyWind - 15 mps, NoControl
% Uncomment to run !
GenMoment = 0; % starting generator moment (rated)
k = 1; % number of runs, divisible by 5! (number of subplot in a figure)

for i=1:k

 Simsetup_path= fullfile(Simulation_path, 'Onshore', '1_SteadyWind_15mps_NoControl');
 run ([Simsetup_path '\Simsetup.m']);

 %GenMoment= GenMoment+1000; % increase of moment can be adjusted

end

run (fullfile(Simulation_path, ‘\Simulink’, ‘\Plotting’ ,‘\plotMapCp.m’)); % plotting Cp-map
run (fullfile(Simulation_path, ‘\Simulink’, ‘\Plotting’ ,‘\plotMapCm.m’)); % plotting Cm-map[/code]

Simsetup.m runs the following:

[code]clear FAST_SFunc;

%% ========== Display of #.run and with which generator moment ============
disp( ’ -------------------------------------------------’ );
disp( [’ ’ sprintf(‘%.0f’,i) ‘.run with ’ sprintf(’%.0f’, GenMoment) ‘Nm’] );
disp( ’ -------------------------------------------------’ );

%% ======================= Setup run ======================================
input_fast = [‘HTWBerlinHLV_Onshore.fst’]; % primary FAST-File (.fst)

addpath( [Simulation_path, ‘\Simulink’]); % Add Simulink folder to work-directories with the model and necessary m-scripts

% Read FAST input file and set initial conditions
Read_FAST_Input;

%% ======================= Simulation-modell ==============================

sim([Simulation_path, ‘\Simulink’, ‘\FAST_OpenLoop.mdl’],[0,TMax]); % TMax defined in primary FAST-File(.fst)

%% ================== Read outdata and calculate maps =====================
run ([ Simulation_path, ‘\Simulink’, ‘\Calculations’ , ‘\calcMap.m’]); % maps from FAST (Outdata in workspace)

%run ([ Simulation_path, ‘\Simulink’, ‘\Calculations’ , ‘\ImportELM.m’]); % reads AeroDyn-Output into Matlab workspace
%run ([ Simulation_path, ‘\Simulink’, ‘\Calculations’ , ‘\calcMap2.m’]); % maps from AeroDyn-Output

%% ============== Plotting the results of this Simulation-run =============
% run ([ Simulation_path, ‘\Simulink’, ‘\Plotting’ , ‘\Plot5MWresults.m’]);
% run ([ Simulation_path, ‘\Simulink’, ‘\Plotting’ , ‘\Plot5MWmap.m’]);

%% ====================== closing simulation ==============================
% If your there is an error that requires you to restart the Simulink
% simulation before FAST terminates properly (you should see the Simulation
% Time Ratio statistics printed to the Matlab command window when it
% terminates properly), call the FAST_SFunc routine with FLAG=9, like this:
%
FAST_SFunc(0,,,9);
rmpath( [Simulation_path, ‘\Simulink’]);[/code]

Line 24 runs
sim([Simulation_path, ‘\Simulink’, ‘\FAST_OpenLoop.mdl’],[0,TMax]);

This is the OpenLoop.mdl

Model { Name "FAST_OpenLoop" Version 7.6 MdlSubVersion 0 GraphicalInterface { NumRootInports 0 NumRootOutports 0 ParameterArgumentNames "" ComputedModelVersion "1.94" NumModelReferences 0 NumTestPointedSignals 0 } SavedCharacterEncoding "windows-1252" SaveDefaultBlockParams on ScopeRefreshTime 0.035000 OverrideScopeRefreshTime on DisableAllScopes off DataTypeOverride "UseLocalSettings" DataTypeOverrideAppliesTo "AllNumericTypes" MinMaxOverflowLogging "UseLocalSettings" MinMaxOverflowArchiveMode "Overwrite" MaxMDLFileLineLength 120 Created "Mon Feb 09 16:59:21 2004" Creator "s0526152" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%<Auto>" LastModifiedBy "s0526152" ModifiedDateFormat "%<Auto>" LastModifiedDate "Thu Sep 22 15:29:07 2011" RTWModifiedTimeStamp 238594387 ModelVersionFormat "1.%<AutoIncrement:94>" ConfigurationManager "None" SampleTimeColors off SampleTimeAnnotations off LibraryLinkDisplay "none" WideLines off ShowLineDimensions on ShowPortDataTypes off ShowLoopsOnError on IgnoreBidirectionalLines off ShowStorageClass off ShowTestPointIcons on ShowSignalResolutionIcons on ShowViewerIcons on SortedOrder off ExecutionContextIcon off ShowLinearizationAnnotations on BlockNameDataTip off BlockParametersDataTip off BlockDescriptionStringDataTip off ToolBar on StatusBar on BrowserShowLibraryLinks off BrowserLookUnderMasks off SimulationMode "normal" LinearizationMsg "none" Profile off ParamWorkspaceSource "MATLABWorkspace" AccelSystemTargetFile "accel.tlc" AccelTemplateMakefile "accel_default_tmf" AccelMakeCommand "make_rtw" TryForcingSFcnDF off RecordCoverage off CovPath "/" CovSaveName "covdata" CovMetricSettings "dw" CovNameIncrementing off CovHtmlReporting on CovForceBlockReductionOff on covSaveCumulativeToWorkspaceVar on CovSaveSingleToWorkspaceVar on CovCumulativeVarName "covCumulativeData" CovCumulativeReport off CovReportOnPause on CovModelRefEnable "Off" CovExternalEMLEnable off ExtModeBatchMode off ExtModeEnableFloating on ExtModeTrigType "manual" ExtModeTrigMode "normal" ExtModeTrigPort "1" ExtModeTrigElement "any" ExtModeTrigDuration 1000 ExtModeTrigDurationFloating "auto" ExtModeTrigHoldOff 0 ExtModeTrigDelay 0 ExtModeTrigDirection "rising" ExtModeTrigLevel 0 ExtModeArchiveMode "off" ExtModeAutoIncOneShot off ExtModeIncDirWhenArm off ExtModeAddSuffixToVar off ExtModeWriteAllDataToWs off ExtModeArmWhenConnect on ExtModeSkipDownloadWhenConnect off ExtModeLogAll on ExtModeAutoUpdateStatusClock on BufferReuse on ShowModelReferenceBlockVersion off ShowModelReferenceBlockIO off Array { Type "Handle" Dimension 1 Simulink.ConfigSet { $ObjectID 1 Version "1.10.0" Array { Type "Handle" Dimension 8 Simulink.SolverCC { $ObjectID 2 Version "1.10.0" StartTime "0.0" StopTime "TMax" AbsTol "auto" FixedStep "DT" InitialStep "auto" MaxNumMinSteps "-1" MaxOrder 5 ZcThreshold "auto" ConsecutiveZCsStepRelTol "10*128*eps" MaxConsecutiveZCs "1000" ExtrapolationOrder 4 NumberNewtonIterations 1 MaxStep "DT" MinStep "auto" MaxConsecutiveMinStep "1" RelTol "1e-3" SolverMode "Auto" ConcurrentTasks off Solver "ode4" SolverName "ode4" SolverJacobianMethodControl "auto" ShapePreserveControl "DisableAll" ZeroCrossControl "UseLocalSettings" ZeroCrossAlgorithm "Nonadaptive" AlgebraicLoopSolver "TrustRegion" SolverResetMethod "Fast" PositivePriorityOrder off AutoInsertRateTranBlk off SampleTimeConstraint "Unconstrained" InsertRTBMode "Whenever possible" } Simulink.DataIOCC { $ObjectID 3 Version "1.10.0" Decimation "1" ExternalInput "[t, u]" FinalStateName "xFinal" InitialState "xInitial" LimitDataPoints on MaxDataPoints "1000" LoadExternalInput off LoadInitialState off SaveFinalState off SaveCompleteFinalSimState off SaveFormat "Array" SaveOutput off SaveState off SignalLogging on DSMLogging on InspectSignalLogs off SaveTime off ReturnWorkspaceOutputs off StateSaveName "xout" TimeSaveName "tout" OutputSaveName "yout" SignalLoggingName "sigsOut" DSMLoggingName "dsmout" OutputOption "RefineOutputTimes" OutputTimes "[]" ReturnWorkspaceOutputsName "out" Refine "1" } Simulink.OptimizationCC { $ObjectID 4 Version "1.10.0" Array { Type "Cell" Dimension 8 Cell "BooleansAsBitfields" Cell "PassReuseOutputArgsAs" Cell "PassReuseOutputArgsThreshold" Cell "ZeroExternalMemoryAtStartup" Cell "ZeroInternalMemoryAtStartup" Cell "OptimizeModelRefInitCode" Cell "NoFixptDivByZeroProtection" Cell "UseSpecifiedMinMax" PropName "DisabledProps" } BlockReduction on BooleanDataType on ConditionallyExecuteInputs on InlineParams off UseIntDivNetSlope off UseSpecifiedMinMax off InlineInvariantSignals off OptimizeBlockIOStorage on BufferReuse on EnhancedBackFolding off StrengthReduction off ExpressionFolding on BooleansAsBitfields off BitfieldContainerType "uint_T" EnableMemcpy on MemcpyThreshold 64 PassReuseOutputArgsAs "Structure reference" ExpressionDepthLimit 2147483647 FoldNonRolledExpr on LocalBlockOutputs on RollThreshold 5 SystemCodeInlineAuto off StateBitsets off DataBitsets off UseTempVars off ZeroExternalMemoryAtStartup on ZeroInternalMemoryAtStartup on InitFltsAndDblsToZero off NoFixptDivByZeroProtection off EfficientFloat2IntCast off EfficientMapNaN2IntZero on OptimizeModelRefInitCode off LifeSpan "inf" MaxStackSize "Inherit from target" BufferReusableBoundary on SimCompilerOptimization "Off" AccelVerboseBuild off } Simulink.DebuggingCC { $ObjectID 5 Version "1.10.0" RTPrefix "error" ConsistencyChecking "none" ArrayBoundsChecking "none" SignalInfNanChecking "none" SignalRangeChecking "none" ReadBeforeWriteMsg "UseLocalSettings" WriteAfterWriteMsg "UseLocalSettings" WriteAfterReadMsg "UseLocalSettings" AlgebraicLoopMsg "warning" ArtificialAlgebraicLoopMsg "warning" SaveWithDisabledLinksMsg "warning" SaveWithParameterizedLinksMsg "none" CheckSSInitialOutputMsg on UnderspecifiedInitializationDetection "Classic" MergeDetectMultiDrivingBlocksExec "none" CheckExecutionContextPreStartOutputMsg off CheckExecutionContextRuntimeOutputMsg off SignalResolutionControl "TryResolveAllWithWarning" BlockPriorityViolationMsg "warning" MinStepSizeMsg "warning" TimeAdjustmentMsg "none" MaxConsecutiveZCsMsg "error" MaskedZcDiagnostic "warning" IgnoredZcDiagnostic "warning" SolverPrmCheckMsg "none" InheritedTsInSrcMsg "warning" DiscreteInheritContinuousMsg "warning" MultiTaskDSMMsg "warning" MultiTaskCondExecSysMsg "none" MultiTaskRateTransMsg "error" SingleTaskRateTransMsg "none" TasksWithSamePriorityMsg "warning" SigSpecEnsureSampleTimeMsg "warning" CheckMatrixSingularityMsg "none" IntegerOverflowMsg "warning" Int32ToFloatConvMsg "warning" ParameterDowncastMsg "error" ParameterOverflowMsg "error" ParameterUnderflowMsg "none" ParameterPrecisionLossMsg "warning" ParameterTunabilityLossMsg "warning" FixptConstUnderflowMsg "none" FixptConstOverflowMsg "none" FixptConstPrecisionLossMsg "none" UnderSpecifiedDataTypeMsg "none" UnnecessaryDatatypeConvMsg "none" VectorMatrixConversionMsg "none" InvalidFcnCallConnMsg "error" FcnCallInpInsideContextMsg "Use local settings" SignalLabelMismatchMsg "none" UnconnectedInputMsg "warning" UnconnectedOutputMsg "warning" UnconnectedLineMsg "warning" SFcnCompatibilityMsg "none" UniqueDataStoreMsg "none" BusObjectLabelMismatch "warning" RootOutportRequireBusObject "warning" AssertControl "UseLocalSettings" EnableOverflowDetection off ModelReferenceIOMsg "none" ModelReferenceMultiInstanceNormalModeStructChecksumCheck "error" ModelReferenceVersionMismatchMessage "none" ModelReferenceIOMismatchMessage "none" ModelReferenceCSMismatchMessage "none" UnknownTsInhSupMsg "warning" ModelReferenceDataLoggingMessage "warning" ModelReferenceSymbolNameMessage "warning" ModelReferenceExtraNoncontSigs "error" StateNameClashWarn "warning" SimStateInterfaceChecksumMismatchMsg "warning" InitInArrayFormatMsg "warning" StrictBusMsg "None" BusNameAdapt "WarnAndRepair" NonBusSignalsTreatedAsBus "none" LoggingUnavailableSignals "error" BlockIODiagnostic "none" SFUnusedDataAndEventsDiag "warning" SFUnexpectedBacktrackingDiag "warning" SFInvalidInputDataAccessInChartInitDiag "warning" SFNoUnconditionalDefaultTransitionDiag "warning" SFTransitionOutsideNaturalParentDiag "warning" } Simulink.HardwareCC { $ObjectID 6 Version "1.10.0" ProdBitPerChar 8 ProdBitPerShort 16 ProdBitPerInt 32 ProdBitPerLong 32 ProdBitPerFloat 32 ProdBitPerDouble 64 ProdBitPerPointer 32 ProdLargestAtomicInteger "Char" ProdLargestAtomicFloat "None" ProdIntDivRoundTo "Undefined" ProdEndianess "Unspecified" ProdWordSize 32 ProdShiftRightIntArith on ProdHWDeviceType "32-bit Generic" TargetBitPerChar 8 TargetBitPerShort 16 TargetBitPerInt 32 TargetBitPerLong 32 TargetBitPerFloat 32 TargetBitPerDouble 64 TargetBitPerPointer 32 TargetLargestAtomicInteger "Char" TargetLargestAtomicFloat "None" TargetShiftRightIntArith on TargetIntDivRoundTo "Undefined" TargetEndianess "Unspecified" TargetWordSize 32 TargetTypeEmulationWarnSuppressLevel 0 TargetPreprocMaxBitsSint 32 TargetPreprocMaxBitsUint 32 TargetHWDeviceType "Specified" TargetUnknown on ProdEqTarget on } Simulink.ModelReferenceCC { $ObjectID 7 Version "1.10.0" UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange" CheckModelReferenceTargetMessage "error" EnableParallelModelReferenceBuilds off ParallelModelReferenceErrorOnInvalidPool on ParallelModelReferenceMATLABWorkerInit "None" ModelReferenceNumInstancesAllowed "Multi" PropagateVarSize "Infer from blocks in model" ModelReferencePassRootInputsByReference on ModelReferenceMinAlgLoopOccurrences off PropagateSignalLabelsOutOfModel off SupportModelReferenceSimTargetCustomCode off } Simulink.SFSimCC { $ObjectID 8 Version "1.10.0" SFSimEnableDebug on SFSimOverflowDetection on SFSimEcho on SimBlas on SimCtrlC on SimExtrinsic on SimIntegrity on SimUseLocalCustomCode off SimParseCustomCode on SimBuildMode "sf_incremental_build" } Simulink.RTWCC { $BackupClass "Simulink.RTWCC" $ObjectID 9 Version "1.10.0" Array { Type "Cell" Dimension 7 Cell "IncludeHyperlinkInReport" Cell "GenerateTraceInfo" Cell "GenerateTraceReport" Cell "GenerateTraceReportSl" Cell "GenerateTraceReportSf" Cell "GenerateTraceReportEml" Cell "GenerateSLWebview" PropName "DisabledProps" } SystemTargetFile "grt.tlc" GenCodeOnly off MakeCommand "make_rtw" GenerateMakefile on TemplateMakefile "grt_default_tmf" GenerateReport off SaveLog off RTWVerbose on RetainRTWFile off ProfileTLC off TLCDebug off TLCCoverage off TLCAssert off ProcessScriptMode "Default" ConfigurationMode "Optimized" ConfigAtBuild off RTWUseLocalCustomCode off RTWUseSimCustomCode off IncludeHyperlinkInReport off LaunchReport off TargetLang "C" IncludeBusHierarchyInRTWFileBlockHierarchyMap off IncludeERTFirstTime on GenerateTraceInfo off GenerateTraceReport off GenerateTraceReportSl off GenerateTraceReportSf off GenerateTraceReportEml off GenerateCodeInfo off GenerateSLWebview off RTWCompilerOptimization "Off" CheckMdlBeforeBuild "Off" CustomRebuildMode "OnUpdate" Array { Type "Handle" Dimension 2 Simulink.CodeAppCC { $ObjectID 10 Version "1.10.0" Array { Type "Cell" Dimension 21 Cell "IgnoreCustomStorageClasses" Cell "IgnoreTestpoints" Cell "InsertBlockDesc" Cell "InsertPolySpaceComments" Cell "SFDataObjDesc" Cell "MATLABFcnDesc" Cell "SimulinkDataObjDesc" Cell "DefineNamingRule" Cell "SignalNamingRule" Cell "ParamNamingRule" Cell "InlinedPrmAccess" Cell "CustomSymbolStr" Cell "CustomSymbolStrGlobalVar" Cell "CustomSymbolStrType" Cell "CustomSymbolStrField" Cell "CustomSymbolStrFcn" Cell "CustomSymbolStrFcnArg" Cell "CustomSymbolStrBlkIO" Cell "CustomSymbolStrTmpVar" Cell "CustomSymbolStrMacro" Cell "ReqsInCode" PropName "DisabledProps" } ForceParamTrailComments off GenerateComments on IgnoreCustomStorageClasses on IgnoreTestpoints off IncHierarchyInIds off MaxIdLength 31 PreserveName off PreserveNameWithParent off ShowEliminatedStatement off IncAutoGenComments off SimulinkDataObjDesc off SFDataObjDesc off MATLABFcnDesc off IncDataTypeInIds off MangleLength 1 CustomSymbolStrGlobalVar "$R$N$M" CustomSymbolStrType "$N$R$M" CustomSymbolStrField "$N$M" CustomSymbolStrFcn "$R$N$M$F" CustomSymbolStrFcnArg "rt$I$N$M" CustomSymbolStrBlkIO "rtb_$N$M" CustomSymbolStrTmpVar "$N$M" CustomSymbolStrMacro "$R$N$M" DefineNamingRule "None" ParamNamingRule "None" SignalNamingRule "None" InsertBlockDesc off InsertPolySpaceComments off SimulinkBlockComments on MATLABSourceComments off EnableCustomComments off InlinedPrmAccess "Literals" ReqsInCode off UseSimReservedNames off } Simulink.GRTTargetCC { $BackupClass "Simulink.TargetCC" $ObjectID 11 Version "1.10.0" Array { Type "Cell" Dimension 16 Cell "GeneratePreprocessorConditionals" Cell "IncludeMdlTerminateFcn" Cell "CombineOutputUpdateFcns" Cell "SuppressErrorStatus" Cell "ERTCustomFileBanners" Cell "GenerateSampleERTMain" Cell "GenerateTestInterfaces" Cell "ModelStepFunctionPrototypeControlCompliant" Cell "CPPClassGenCompliant" Cell "MultiInstanceERTCode" Cell "PurelyIntegerCode" Cell "SupportComplex" Cell "SupportAbsoluteTime" Cell "SupportContinuousTime" Cell "SupportNonInlinedSFcns" Cell "PortableWordSizes" PropName "DisabledProps" } TargetFcnLib "ansi_tfl_table_tmw.mat" TargetLibSuffix "" TargetPreCompLibLocation "" TargetFunctionLibrary "ANSI_C" UtilityFuncGeneration "Auto" ERTMultiwordTypeDef "System defined" ERTCodeCoverageTool "None" ERTMultiwordLength 256 MultiwordLength 2048 GenerateFullHeader on GenerateSampleERTMain off GenerateTestInterfaces off IsPILTarget off ModelReferenceCompliant on ParMdlRefBuildCompliant on CompOptLevelCompliant on IncludeMdlTerminateFcn on GeneratePreprocessorConditionals "Disable all" CombineOutputUpdateFcns off CombineSignalStateStructs off SuppressErrorStatus off ERTFirstTimeCompliant off IncludeFileDelimiter "Auto" ERTCustomFileBanners off SupportAbsoluteTime on LogVarNameModifier "rt_" MatFileLogging on MultiInstanceERTCode off SupportNonFinite on SupportComplex on PurelyIntegerCode off SupportContinuousTime on SupportNonInlinedSFcns on SupportVariableSizeSignals off EnableShiftOperators on ParenthesesLevel "Nominal" PortableWordSizes off ModelStepFunctionPrototypeControlCompliant off CPPClassGenCompliant off AutosarCompliant off UseMalloc off ExtMode off ExtModeStaticAlloc off ExtModeTesting off ExtModeStaticAllocSize 1000000 ExtModeTransport 0 ExtModeMexFile "ext_comm" ExtModeIntrfLevel "Level1" RTWCAPISignals off RTWCAPIParams off RTWCAPIStates off GenerateASAP2 off } PropName "Components" } } PropName "Components" } Name "Configuration" CurrentDlgPage "Solver" ConfigPrmDlgPosition " [ 400, 210, 1280, 840 ] " } PropName "ConfigurationSets" } Simulink.ConfigSet { $PropName "ActiveConfigurationSet" $ObjectID 1 } BlockDefaults { ForegroundColor "black" BackgroundColor "white" DropShadow off NamePlacement "normal" FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" ShowName on BlockRotation 0 BlockMirror off } AnnotationDefaults { HorizontalAlignment "center" VerticalAlignment "middle" ForegroundColor "black" BackgroundColor "white" DropShadow off FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" UseDisplayTextAsClickCallback off } LineDefaults { FontName "Helvetica" FontSize 9 FontWeight "normal" FontAngle "normal" } BlockParameterDefaults { Block { BlockType Clock DisplayTime off } Block { BlockType Constant Value "1" VectorParams1D on SamplingMode "Sample based" OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: Inherit from 'Constant value'" LockScale off SampleTime "inf" FramePeriod "inf" PreserveConstantTs off } Block { BlockType Demux Outputs "4" DisplayOption "none" BusSelectionMode off } Block { BlockType Inport Port "1" OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" SignalType "auto" SamplingMode "auto" LatchByDelayingOutsideSignal off LatchInputForFeedbackSignals off Interpolate on } Block { BlockType Integrator ExternalReset "none" InitialConditionSource "internal" InitialCondition "0" LimitOutput off UpperSaturationLimit "inf" LowerSaturationLimit "-inf" ShowSaturationPort off ShowStatePort off AbsoluteTolerance "auto" IgnoreLimit off ZeroCross on ContinuousStateAttributes "''" } Block { BlockType Mux Inputs "4" DisplayOption "none" UseBusObject off BusObject "BusObject" NonVirtualBus off } Block { BlockType Outport Port "1" OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" SignalType "auto" SamplingMode "auto" SourceOfInitialOutputValue "Dialog" OutputWhenDisabled "held" InitialOutput "[]" } Block { BlockType "S-Function" FunctionName "system" SFunctionModules "''" PortCounts "[]" SFunctionDeploymentMode off } Block { BlockType SignalSpecification OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off Dimensions "-1" VarSizeSig "Inherit" SampleTime "-1" SignalType "auto" SamplingMode "auto" } Block { BlockType SubSystem ShowPortLabels "FromPortIcon" Permissions "ReadWrite" PermitHierarchicalResolution "All" TreatAsAtomicUnit off CheckFcnCallInpInsideContextMsg off SystemSampleTime "-1" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" RTWMemSecFuncInitTerm "Inherit from model" RTWMemSecFuncExecute "Inherit from model" RTWMemSecDataConstants "Inherit from model" RTWMemSecDataInternal "Inherit from model" RTWMemSecDataParameters "Inherit from model" SimViewingDevice off DataTypeOverride "UseLocalSettings" DataTypeOverrideAppliesTo "AllNumericTypes" MinMaxOverflowLogging "UseLocalSettings" Variant off GeneratePreprocessorConditionals off } Block { BlockType ToWorkspace VariableName "simulink_output" MaxDataPoints "1000" Decimation "1" SampleTime "0" FixptAsFi off } } System { Name "FAST_OpenLoop" Location [991, 186, 1574, 570] Open on ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" ReportName "simulink-default.rpt" SIDHighWatermark "33" Block { BlockType Clock Name "Clock" SID "1" Position [30, 25, 50, 45] Decimation "10" } Block { BlockType SubSystem Name "FAST Nonlinear Wind Turbine" SID "2" Ports [3, 1] Position [200, 98, 420, 292] BackgroundColor "darkGreen" MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off MaskType "FAST Nonlinear Wind Turbine" MaskDescription "This block contains the FAST S-Function and blocks that integrate the DOF accelerations t" "o get velocities and displacements." MaskInitialization "clear FAST_SFunc\n" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskPortRotate "default" MaskIconUnits "autoscale" System { Name "FAST Nonlinear Wind Turbine" Location [321, 277, 1205, 801] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Inport Name "Gen. Torque (Nm) and Power (W)" SID "3" Position [80, 33, 110, 47] IconDisplay "Port number" } Block { BlockType Inport Name "Yaw Position (rad) and Rate (rad/s)" SID "4" Position [80, 73, 110, 87] Port "2" IconDisplay "Port number" } Block { BlockType Inport Name "Blade Pitch Angles (rad)" SID "5" Position [80, 113, 110, 127] Port "3" IconDisplay "Port number" } Block { BlockType Demux Name "Demux" SID "6" Ports [1, 2] Position [475, 101, 480, 139] BackgroundColor "black" ShowName off Outputs "[NDOF, NumOuts]" } Block { BlockType Integrator Name "Integrator" SID "7" Ports [1, 1] Position [560, 95, 590, 125] ShowName off InitialCondition "qdot_init" Port { PortNumber 1 Name "qdot" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Integrator Name "Integrator1" SID "8" Ports [1, 1] Position [640, 94, 670, 126] ShowName off InitialCondition "q_init" Port { PortNumber 1 Name "q" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Mux Name "Mux1" SID "9" Ports [5, 1] Position [335, 23, 340, 217] ShowName off Inputs "5" DisplayOption "bar" } Block { BlockType "S-Function" Name "S-Function" SID "10" Ports [1, 1] Position [375, 81, 445, 159] BackgroundColor "magenta" FunctionName "FAST_SFunc" EnableBusSupport off } Block { BlockType SignalSpecification Name "Signal Specification1" SID "11" Position [200, 30, 300, 50] OutDataTypeStr "double" Dimensions "2" SignalType "real" } Block { BlockType SignalSpecification Name "Signal Specification2" SID "12" Position [200, 68, 300, 92] OutDataTypeStr "double" Dimensions "2" SignalType "real" } Block { BlockType Outport Name "OutData" SID "13" Position [520, 122, 550, 138] BackgroundColor "yellow" IconDisplay "Port number" } Line { Name "qdot" SrcBlock "Integrator" SrcPort 1 Points [20, 0] Branch { Labels [-1, 1] DstBlock "Integrator1" DstPort 1 } Branch { Points [0, 130; -310, 0; 0, -40] DstBlock "Mux1" DstPort 5 } } Line { SrcBlock "Gen. Torque (Nm) and Power (W)" SrcPort 1 DstBlock "Signal Specification1" DstPort 1 } Line { SrcBlock "S-Function" SrcPort 1 DstBlock "Demux" DstPort 1 } Line { Labels [0, 0] SrcBlock "Demux" SrcPort 1 DstBlock "Integrator" DstPort 1 } Line { SrcBlock "Demux" SrcPort 2 DstBlock "OutData" DstPort 1 } Line { SrcBlock "Mux1" SrcPort 1 DstBlock "S-Function" DstPort 1 } Line { SrcBlock "Blade Pitch Angles (rad)" SrcPort 1 DstBlock "Mux1" DstPort 3 } Line { SrcBlock "Yaw Position (rad) and Rate (rad/s)" SrcPort 1 DstBlock "Signal Specification2" DstPort 1 } Line { Name "q" Labels [0, 1] SrcBlock "Integrator1" SrcPort 1 Points [15, 0; 0, 160; -415, 0; 0, -110] DstBlock "Mux1" DstPort 4 } Line { SrcBlock "Signal Specification1" SrcPort 1 DstBlock "Mux1" DstPort 1 } Line { SrcBlock "Signal Specification2" SrcPort 1 DstBlock "Mux1" DstPort 2 } Annotation { Name "qdotdot" Position [508, 101] } Annotation { Name "q" Position [459, 251] } } } Block { BlockType SubSystem Name "Pitch Controller" SID "14" Ports [0, 1] Position [30, 239, 130, 281] MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off System { Name "Pitch Controller" Location [433, 403, 916, 538] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Constant Name "Blade Pitch Angles" SID "15" Position [55, 35, 85, 65] Value "zeros(1,NumBl)'" } Block { BlockType Outport Name "Out1" SID "16" Position [140, 43, 170, 57] IconDisplay "Port number" } Line { SrcBlock "Blade Pitch Angles" SrcPort 1 DstBlock "Out1" DstPort 1 } } } Block { BlockType ToWorkspace Name "To Workspace" SID "17" Ports [1] Position [70, 20, 130, 50] VariableName "Time" MaxDataPoints "inf" SampleTime "-1" SaveFormat "Array" } Block { BlockType SubSystem Name "Torque Controller" SID "18" Ports [0, 1] Position [30, 109, 130, 151] MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off System { Name "Torque Controller" Location [433, 403, 919, 560] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Constant Name "Electrical Power" SID "19" Position [55, 85, 85, 115] Value "0" } Block { BlockType Constant Name "Generator Torque" SID "20" Position [55, 30, 85, 60] Value "GenMoment" } Block { BlockType Mux Name "Mux" SID "21" Ports [2, 1] Position [200, 51, 205, 89] ShowName off Inputs "2" DisplayOption "bar" } Block { BlockType Outport Name "Out1" SID "22" Position [255, 63, 285, 77] IconDisplay "Port number" } Line { SrcBlock "Mux" SrcPort 1 DstBlock "Out1" DstPort 1 } Line { SrcBlock "Generator Torque" SrcPort 1 Points [45, 0; 0, 15] DstBlock "Mux" DstPort 1 } Line { SrcBlock "Electrical Power" SrcPort 1 Points [45, 0; 0, -20] DstBlock "Mux" DstPort 2 } } } Block { BlockType SubSystem Name "Yaw Controller" SID "23" Ports [0, 1] Position [30, 174, 130, 216] MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off System { Name "Yaw Controller" Location [433, 403, 907, 565] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Mux Name "Mux" SID "24" Ports [2, 1] Position [190, 56, 195, 94] ShowName off Inputs "2" DisplayOption "bar" } Block { BlockType Constant Name "Yaw Position" SID "25" Position [45, 30, 75, 60] Value "0" } Block { BlockType Constant Name "Yaw rate" SID "26" Position [45, 90, 75, 120] Value "0" } Block { BlockType Outport Name "Out1" SID "27" Position [245, 68, 275, 82] IconDisplay "Port number" } Line { SrcBlock "Mux" SrcPort 1 DstBlock "Out1" DstPort 1 } Line { SrcBlock "Yaw Position" SrcPort 1 Points [45, 0; 0, 20] DstBlock "Mux" DstPort 1 } Line { SrcBlock "Yaw rate" SrcPort 1 Points [45, 0; 0, -20] DstBlock "Mux" DstPort 2 } } } Block { BlockType ToWorkspace Name "qdotdot_out" SID "28" Ports [1] Position [485, 183, 555, 207] BackgroundColor "yellow" ShowName off VariableName "OutData" MaxDataPoints "inf" SampleTime "-1" SaveFormat "Array" } Line { SrcBlock "Clock" SrcPort 1 DstBlock "To Workspace" DstPort 1 } Line { SrcBlock "FAST Nonlinear Wind Turbine" SrcPort 1 DstBlock "qdotdot_out" DstPort 1 } Line { SrcBlock "Torque Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 1 } Line { SrcBlock "Yaw Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 2 } Line { SrcBlock "Pitch Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 3 } } }

Unfortunately I can’t upload my openloop.mdl. I did change the File-Names in Simsetp.m so they fit my simulation bot noting else. I also did not change anything in the OpenLopp.mdl. I try to get a “cleaner” Version of FAST but while I have no other I try to figure out where the problem is.

The code runs for approximately 30 seconds and the errors above are visible in the Command Window.

I assumed the OpenLoop.mdl is equivalent to “No Control”, since I don’t want a Control in my simulation.

Thank you for your help.

Julian

Hi Julian,

Could you post the text generated in the Matlab Command Window when you do run the simulation? Based on what I see in your code, it should start something like:

[code] -------------------------------------------------
1.run with ‘GenMoment’ Nm

*** Your FAST File Header Line ***

Running NWTC Subroutine Library (v1.06.00b-bjj, 07-Dec-2012).

Running FAST (v7.02.00c-bjj, 30-Nov-2012)-Compiled as S-Function for Simulink.[/code]
Also, the OpenLoop model supplied by NREL is “no control input from Simulink”. If you’ve set your primary FAST input file (.fst) to use a user-defined or built-in controller, it will still have control. For instance, we run the FAST CertTest using the OpenLoop model in Simulink (see the script Simulink_CertTest.m in the CertTest of the FAST archive) to get the same results as if we just ran the FAST CertTest using the FAST.exe file distributed in the archive.

Hi Bonnie,

thank you very much for your reply.

After I got a fresh version of FAST I could do some easier debugging and I finally got some errormessages in the Command Window.

This is my error code:

[code]

1.run with 0Nm

NREL 5.0 MW Baseline Wind Turbine for Use in Offshore Analysis.

Running FAST (v7.00.01a-bjj, 5-Nov-2010)-Compiled as S-Function for Simulink.
Linked with NWTC Subroutine Library (v1.02.00, 16-Mar-2010).

Heading of the FAST input file: NREL 5.0 MW Baseline Wind Turbine for Use in Offshore Analysis.

Aerodynamic loads calculated using AeroDyn (v13.00.00a-bjj, 31-Mar-2010).
Heading of the AeroDyn input file: NREL 5.0 MW offshore baseline aerodynamic input properties;
Compatible with AeroDyn v13.00.

Assuming …..\WindData\NoShr_15.wnd is a formatted HH wind file.
Reading 3 lines of data from the HH wind file.
WARNING: Yaw angle and rate are not commanded from Simulink model.
WARNING: Pitch angles are not commanded from Simulink model.

FAST_SFunc initialized with 55 inputs and 52 outputs.
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 3
VNW = 14.986, VNB = 101.82
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 4
VNW = 14.986, VNB = 341.27
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 5
VNW = 14.987, VNB = 783.62
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 6
VNW = 14.987, VNB = 1403.2
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 7
VNW = 14.988, VNB = 2730.1
WARNING: Induced velocity warning written 5 times. The message will not be repeated, though
the condition may persist.
WARNING: Small angle assumption violated in SUBROUTINE SmllRotTrans() due to a large blade
deflection. The solution may be inaccurate. Simulation continuing, but future warnings will be
suppressed.
FAST_SFunc completed.

Total Real Time: 0.775 seconds
Total CPU Time: 0.6396 seconds
Simulated Time: 4.50000E-02 seconds
Time Ratio (Sim/CPU): 7.03562E-02

Error using Simsetup_singleRun (line 24)
Output returned by S-function ‘FAST_SFunc’ in ‘FAST_OpenLoop/FAST Nonlinear Wind Turbine/S-Function’ during flag=3 call must be a real vector of length 52

Error in run (line 64)
evalin(‘caller’, [script ‘;’]);

Error in Start_Simulations (line 24)
run ([Simsetup_path ‘\Simsetup_singleRun.m’]);[/code]

I set all the control modes to 0 in the *.fst File. Concerning the error which is displayed in the Command Window: Is this due to the small TipRad (0.39 m) and the high tip speeds? What means VNB and VNS?

I want to simulate the whole windmill but in the first step I’m only interested in the plot c_m versus lambda and c_p versus lambda. If those errors are due to an assumption in FAST (e.g. Reynolds number = 10^6 ), can I circumvent them somehow?

Thank you very much!

Julian Michael

Hi Julian,

It looks like there are two issues:
(1) Your FAST model has some problems; perhaps it’s your modified control settings.
(2) Your Matlab script is generating errors.

I can’t help you with the first problem (I’m not a modeler), but I don’t think it is related to the second issue.

The second issue confuses me. It looks like your FAST_SFunc terminates (it writes “FAST_SFunc completed”), but then it is called again to return outputs (“flag=3”) without initializing first.

Here are some things you can check:
[]Can you run the FAST CertTest with the FAST_SFunc.mexw32 file you’re using? (run the Simulink_CertTest.m file in the FAST archive’s CertTest directory, making sure it finds and uses the correct .mexw32 file)[/]
[]Is your Read_FAST_Input.m script getting the correct OutList?[/]
[]The “Simulated Time” you show in your results is quite small. Is that the value of TMax in your input file?[/]

Hi Bonnie,

I don’t have a CertTest directory. So I checked the new FAST version on the website and realised I have no similar files in my directories. I’m afriad I can’t run this test with my files.

I can confirm this. I also checked the values of each entry, which also showed me the high deflection etc.

No it isn’t. For some reason the simulated time is allways 4.5EXP-02. In my *fst File TMax is set to 400. So Matlab only computes 2 or 3 integral time steps (DT = 0.015).