1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Small fix to revo sensor log processing. Also check in allan analysis.

This commit is contained in:
James Cotton 2012-01-26 23:30:10 -06:00
parent b4435d0b35
commit e0fc4c30ee
3 changed files with 1319 additions and 1 deletions

14
matlab/revo/allan.m Normal file
View File

@ -0,0 +1,14 @@
source = gyro;
clear data
data.freq = source(:,3)';
data.time = unwrap_time(source(:,end))'/1000;
data.rate = 1/mean(diff(data.time))
tau = 1/data.rate * round(logspace(0,7,200))
[retval, s, errorb, tau] = allan(data,tau,'gyro')
[~,~,gyro_residual] = regress(gyro(:,1)-mean(gyro(:,1)),[gyro(:,4)-mean(gyro(:,4)), (1:size(gyro,1))']);
data.freq = gyro_residual;
data.time = unwrap_time(source(:,end))'/1000;
data.rate = 1/mean(diff(data.time))
tau = 1/data.rate * round(logspace(0,7,200))
[retval, s, errorb, tau] = allan(data,tau,'gyro')

View File

@ -0,0 +1,1304 @@
Model {
Name "altitude_plant"
Version 7.8
MdlSubVersion 0
GraphicalInterface {
NumRootInports 1
Inport {
BusObject ""
Name "Altitude Setpoint"
}
NumRootOutports 3
Outport {
BusObject ""
BusOutputAsStruct "off"
Name "Altitude"
}
Outport {
BusObject ""
BusOutputAsStruct "off"
Name "Measured Altitude"
}
Outport {
BusObject ""
BusOutputAsStruct "off"
Name "Measured Accel"
}
ParameterArgumentNames ""
ComputedModelVersion "1.11"
NumModelReferences 0
NumTestPointedSignals 0
}
SavedCharacterEncoding "ISO-8859-1"
SaveDefaultBlockParams on
ScopeRefreshTime 0.035000
OverrideScopeRefreshTime on
DisableAllScopes off
DataTypeOverride "UseLocalSettings"
DataTypeOverrideAppliesTo "AllNumericTypes"
MinMaxOverflowLogging "UseLocalSettings"
MinMaxOverflowArchiveMode "Overwrite"
FPTRunName "Run 1"
MaxMDLFileLineLength 120
Created "Sun Jan 01 10:58:12 2012"
Creator "jcotton81"
UpdateHistory "UpdateHistoryNever"
ModifiedByFormat "%<Auto>"
LastModifiedBy "jcotton81"
ModifiedDateFormat "%<Auto>"
LastModifiedDate "Mon Jan 02 14:46:15 2012"
RTWModifiedTimeStamp 247320281
ModelVersionFormat "1.%<AutoIncrement:11>"
ConfigurationManager "None"
SampleTimeColors off
SampleTimeAnnotations off
LibraryLinkDisplay "disabled"
WideLines off
ShowLineDimensions off
ShowPortDataTypes off
ShowDesignRanges 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
Object {
$PropName "DataLoggingOverride"
$ObjectID 1
$ClassName "Simulink.SimulationData.ModelLoggingInfo"
model_ "altitude_plant"
overrideMode_ [0.0]
Array {
Type "Cell"
Dimension 1
Cell "altitude_plant"
PropName "logAsSpecifiedByModels_"
}
Array {
Type "Cell"
Dimension 1
Cell []
PropName "logAsSpecifiedByModelsSSIDs_"
}
}
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 2
Version "1.11.1"
Array {
Type "Handle"
Dimension 8
Simulink.SolverCC {
$ObjectID 3
Version "1.11.1"
StartTime "0.0"
StopTime "200.0"
AbsTol "auto"
FixedStep "auto"
InitialStep "auto"
MaxNumMinSteps "-1"
MaxOrder 5
ZcThreshold "auto"
ConsecutiveZCsStepRelTol "10*128*eps"
MaxConsecutiveZCs "1000"
ExtrapolationOrder 4
NumberNewtonIterations 1
MaxStep "auto"
MinStep "auto"
MaxConsecutiveMinStep "1"
RelTol "1e-3"
SolverMode "Auto"
ConcurrentTasks off
Solver "ode45"
SolverName "ode45"
SolverJacobianMethodControl "auto"
ShapePreserveControl "DisableAll"
ZeroCrossControl "UseLocalSettings"
ZeroCrossAlgorithm "Nonadaptive"
AlgebraicLoopSolver "TrustRegion"
SolverResetMethod "Fast"
PositivePriorityOrder off
AutoInsertRateTranBlk off
SampleTimeConstraint "Unconstrained"
InsertRTBMode "Whenever possible"
}
Simulink.DataIOCC {
$ObjectID 4
Version "1.11.1"
Decimation "1"
ExternalInput "[t, u]"
FinalStateName "xFinal"
InitialState "xInitial"
LimitDataPoints on
MaxDataPoints "1000"
LoadExternalInput on
LoadInitialState off
SaveFinalState off
SaveCompleteFinalSimState off
SaveFormat "Array"
SignalLoggingSaveFormat "ModelDataLogs"
SaveOutput on
SaveState off
SignalLogging on
DSMLogging on
InspectSignalLogs off
SaveTime on
ReturnWorkspaceOutputs off
StateSaveName "xout"
TimeSaveName "tout"
OutputSaveName "yout"
SignalLoggingName "logsout"
DSMLoggingName "dsmout"
OutputOption "RefineOutputTimes"
OutputTimes "[]"
ReturnWorkspaceOutputsName "out"
Refine "1"
}
Simulink.OptimizationCC {
$ObjectID 5
Version "1.11.1"
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
UseFloatMulNetSlope 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
AccelParallelForEachSubsystem on
}
Simulink.DebuggingCC {
$ObjectID 6
Version "1.11.1"
RTPrefix "error"
ConsistencyChecking "none"
ArrayBoundsChecking "none"
SignalInfNanChecking "none"
SignalRangeChecking "none"
ReadBeforeWriteMsg "UseLocalSettings"
WriteAfterWriteMsg "UseLocalSettings"
WriteAfterReadMsg "UseLocalSettings"
AlgebraicLoopMsg "warning"
ArtificialAlgebraicLoopMsg "warning"
SaveWithDisabledLinksMsg "warning"
SaveWithParameterizedLinksMsg "warning"
CheckSSInitialOutputMsg on
UnderspecifiedInitializationDetection "Classic"
MergeDetectMultiDrivingBlocksExec "none"
CheckExecutionContextPreStartOutputMsg off
CheckExecutionContextRuntimeOutputMsg off
SignalResolutionControl "UseLocalSettings"
BlockPriorityViolationMsg "warning"
MinStepSizeMsg "warning"
TimeAdjustmentMsg "none"
MaxConsecutiveZCsMsg "error"
MaskedZcDiagnostic "warning"
IgnoredZcDiagnostic "warning"
SolverPrmCheckMsg "warning"
InheritedTsInSrcMsg "warning"
DiscreteInheritContinuousMsg "warning"
MultiTaskDSMMsg "error"
MultiTaskCondExecSysMsg "error"
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 "Enable All"
SignalLabelMismatchMsg "none"
UnconnectedInputMsg "warning"
UnconnectedOutputMsg "warning"
UnconnectedLineMsg "warning"
SFcnCompatibilityMsg "none"
FrameProcessingCompatibilityMsg "warning"
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"
SimStateOlderReleaseMsg "error"
InitInArrayFormatMsg "warning"
StrictBusMsg "ErrorLevel1"
BusNameAdapt "WarnAndRepair"
NonBusSignalsTreatedAsBus "none"
LoggingUnavailableSignals "error"
BlockIODiagnostic "none"
SFUnusedDataAndEventsDiag "warning"
SFUnexpectedBacktrackingDiag "warning"
SFInvalidInputDataAccessInChartInitDiag "warning"
SFNoUnconditionalDefaultTransitionDiag "warning"
SFTransitionOutsideNaturalParentDiag "warning"
SFUnconditionalTransitionShadowingDiag "warning"
}
Simulink.HardwareCC {
$ObjectID 7
Version "1.11.1"
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 off
ProdEqTarget on
}
Simulink.ModelReferenceCC {
$ObjectID 8
Version "1.11.1"
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 9
Version "1.11.1"
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 10
Version "1.11.1"
Array {
Type "Cell"
Dimension 8
Cell "IncludeHyperlinkInReport"
Cell "GenerateTraceInfo"
Cell "GenerateTraceReport"
Cell "GenerateTraceReportSl"
Cell "GenerateTraceReportSf"
Cell "GenerateTraceReportEml"
Cell "GenerateSLWebview"
Cell "GenerateCodeMetricsReport"
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 off
GenerateTraceInfo off
GenerateTraceReport off
GenerateTraceReportSl off
GenerateTraceReportSf off
GenerateTraceReportEml off
GenerateCodeInfo off
GenerateSLWebview off
GenerateCodeMetricsReport off
RTWCompilerOptimization "Off"
CheckMdlBeforeBuild "Off"
CustomRebuildMode "OnUpdate"
Array {
Type "Handle"
Dimension 2
Simulink.CodeAppCC {
$ObjectID 11
Version "1.11.1"
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 12
Version "1.11.1"
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"
CodeExecutionProfiling off
ERTMultiwordLength 256
MultiwordLength 2048
GenerateFullHeader on
GenerateSampleERTMain off
GenerateTestInterfaces off
IsPILTarget off
ModelReferenceCompliant on
ParMdlRefBuildCompliant on
CompOptLevelCompliant on
ConcurrentExecutionCompliant 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
RTWCAPIRootIO off
GenerateASAP2 off
}
PropName "Components"
}
}
PropName "Components"
}
Name "Configuration"
CurrentDlgPage "Solver"
ConfigPrmDlgPosition [ 400, 210, 1280, 840 ]
}
PropName "ConfigurationSets"
}
Simulink.ConfigSet {
$PropName "ActiveConfigurationSet"
$ObjectID 2
}
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 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 Gain
Gain "1"
Multiplication "Element-wise(K.*u)"
ParamMin "[]"
ParamMax "[]"
ParamDataTypeStr "Inherit: Same as input"
OutMin "[]"
OutMax "[]"
OutDataTypeStr "Inherit: Same as input"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
SampleTime "-1"
}
Block {
BlockType Inport
Port "1"
OutputFunctionCall off
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 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 RandomNumber
Mean "0"
Variance "1"
Seed "0"
SampleTime "-1"
VectorParams1D on
}
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"
SFBlockType "NONE"
Variant off
GeneratePreprocessorConditionals off
}
Block {
BlockType Sum
IconShape "rectangular"
Inputs "++"
CollapseMode "All dimensions"
CollapseDim "1"
InputSameDT on
AccumDataTypeStr "Inherit: Inherit via internal rule"
OutMin "[]"
OutMax "[]"
OutDataTypeStr "Inherit: Same as first input"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
SampleTime "-1"
}
}
System {
Name "altitude_plant"
Location [2567, 115, 3338, 555]
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 "69"
Block {
BlockType Inport
Name "Altitude Setpoint"
SID "62"
Position [25, 133, 55, 147]
ZOrder -1
IconDisplay "Port number"
}
Block {
BlockType Sum
Name "Add"
SID "68"
Ports [2, 1]
Position [225, 127, 255, 158]
ZOrder -2
InputSameDT off
OutDataTypeStr "Inherit: Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Constant
Name "Constant"
SID "69"
Position [140, 80, 170, 110]
ZOrder -5
Value "0"
}
Block {
BlockType Reference
Name "PID Controller (2DOF)"
SID "67"
Ports [2, 1]
Position [140, 130, 195, 170]
ZOrder -7
LibraryVersion "1.256"
SourceBlock "simulink/Continuous/PID Controller (2DOF)"
SourceType "PID 2dof"
Controller "PID"
TimeDomain "Continuous-time"
SampleTime "1"
IntegratorMethod "Forward Euler"
FilterMethod "Forward Euler"
Form "Parallel"
P "0.1"
I "0.0"
D "0"
N "100"
b "1"
c "1"
InitialConditionSource "internal"
InitialConditionForIntegrator "0"
InitialConditionForFilter "0"
ExternalReset "none"
IgnoreLimit off
ZeroCross on
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
LinearizeAsGain off
AntiWindupMode "none"
Kb "1"
TrackingMode off
Kt "1"
RndMeth "Floor"
SaturateOnIntegerOverflow off
LockScale off
PParamMin "[]"
PParamMax "[]"
PParamDataTypeStr "Inherit: Inherit via internal rule"
IParamMin "[]"
IParamMax "[]"
IParamDataTypeStr "Inherit: Inherit via internal rule"
DParamMin "[]"
DParamMax "[]"
DParamDataTypeStr "Inherit: Inherit via internal rule"
NParamMin "[]"
NParamMax "[]"
NParamDataTypeStr "Inherit: Inherit via internal rule"
bParamMin "[]"
bParamMax "[]"
bParamDataTypeStr "Inherit: Inherit via internal rule"
cParamMin "[]"
cParamMax "[]"
cParamDataTypeStr "Inherit: Inherit via internal rule"
KbParamMin "[]"
KbParamMax "[]"
KbParamDataTypeStr "Inherit: Inherit via internal rule"
KtParamMin "[]"
KtParamMax "[]"
KtParamDataTypeStr "Inherit: Inherit via internal rule"
POutMin "[]"
POutMax "[]"
POutDataTypeStr "Inherit: Inherit via internal rule"
IOutMin "[]"
IOutMax "[]"
IOutDataTypeStr "Inherit: Inherit via internal rule"
DOutMin "[]"
DOutMax "[]"
DOutDataTypeStr "Inherit: Inherit via internal rule"
NOutMin "[]"
NOutMax "[]"
NOutDataTypeStr "Inherit: Inherit via internal rule"
bOutMin "[]"
bOutMax "[]"
bOutDataTypeStr "Inherit: Inherit via internal rule"
cOutMin "[]"
cOutMax "[]"
cOutDataTypeStr "Inherit: Inherit via internal rule"
KbOutMin "[]"
KbOutMax "[]"
KbOutDataTypeStr "Inherit: Inherit via internal rule"
KtOutMin "[]"
KtOutMax "[]"
KtOutDataTypeStr "Inherit: Inherit via internal rule"
IntegratorOutMin "[]"
IntegratorOutMax "[]"
IntegratorOutDataTypeStr "Inherit: Inherit via internal rule"
FilterOutMin "[]"
FilterOutMax "[]"
FilterOutDataTypeStr "Inherit: Inherit via internal rule"
SumOutMin "[]"
SumOutMax "[]"
SumOutDataTypeStr "Inherit: Inherit via internal rule"
Sum1OutMin "[]"
Sum1OutMax "[]"
Sum1OutDataTypeStr "Inherit: Inherit via internal rule"
Sum2OutMin "[]"
Sum2OutMax "[]"
Sum2OutDataTypeStr "Inherit: Inherit via internal rule"
Sum3OutMin "[]"
Sum3OutMax "[]"
Sum3OutDataTypeStr "Inherit: Inherit via internal rule"
SumI1OutMin "[]"
SumI1OutMax "[]"
SumI1OutDataTypeStr "Inherit: Inherit via internal rule"
SumI2OutMin "[]"
SumI2OutMax "[]"
SumI2OutDataTypeStr "Inherit: Inherit via internal rule"
SumI3OutMin "[]"
SumI3OutMax "[]"
SumI3OutDataTypeStr "Inherit: Inherit via internal rule"
SumDOutMin "[]"
SumDOutMax "[]"
SumDOutDataTypeStr "Inherit: Inherit via internal rule"
SumAccumDataTypeStr "Inherit: Inherit via internal rule"
Sum1AccumDataTypeStr "Inherit: Inherit via internal rule"
Sum2AccumDataTypeStr "Inherit: Inherit via internal rule"
Sum3AccumDataTypeStr "Inherit: Inherit via internal rule"
SumI1AccumDataTypeStr "Inherit: Inherit via internal rule"
SumI2AccumDataTypeStr "Inherit: Inherit via internal rule"
SumI3AccumDataTypeStr "Inherit: Inherit via internal rule"
SumDAccumDataTypeStr "Inherit: Inherit via internal rule"
SaturationOutMin "[]"
SaturationOutMax "[]"
SaturationOutDataTypeStr "Inherit: Same as input"
IntegratorContinuousStateAttributes "''"
IntegratorStateMustResolveToSignalObject off
IntegratorRTWStateStorageClass "Auto"
FilterContinuousStateAttributes "''"
FilterStateMustResolveToSignalObject off
FilterRTWStateStorageClass "Auto"
}
Block {
BlockType SubSystem
Name "Subsystem"
SID "57"
Ports [1, 3]
Position [300, 120, 440, 180]
MinAlgLoopOccurrences off
PropExecContextOutsideSubsystem off
RTWSystemCode "Auto"
FunctionWithSeparateData off
Opaque off
RequestExecContextInheritance off
MaskHideContents off
System {
Name "Subsystem"
Location [700, 127, 1473, 405]
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"
Block {
BlockType Inport
Name "Throttle"
SID "58"
Position [25, 33, 55, 47]
ZOrder -1
IconDisplay "Port number"
}
Block {
BlockType RandomNumber
Name "Accel Noise"
SID "24"
Position [195, 125, 225, 155]
ZOrder -15
SampleTime "0.1"
}
Block {
BlockType Sum
Name "Add"
SID "25"
Ports [2, 1]
Position [195, 32, 225, 63]
ZOrder -2
InputSameDT off
OutDataTypeStr "Inherit: Inherit via internal rule"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "Acceleration"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Sum
Name "Add1"
SID "26"
Ports [2, 1]
Position [260, 117, 290, 148]
ZOrder -2
InputSameDT off
OutDataTypeStr "Inherit: Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType Sum
Name "Add2"
SID "27"
Ports [2, 1]
Position [480, 87, 510, 118]
ZOrder -2
InputSameDT off
OutDataTypeStr "Inherit: Inherit via internal rule"
SaturateOnIntegerOverflow off
}
Block {
BlockType RandomNumber
Name "Altitude Noise"
SID "28"
Position [420, 95, 450, 125]
ZOrder -15
SampleTime "0.1"
}
Block {
BlockType Gain
Name "Gain"
SID "29"
Position [115, 25, 145, 55]
ZOrder -11
Gain "9.81"
ParamDataTypeStr "Inherit: Inherit via internal rule"
OutDataTypeStr "Inherit: Inherit via internal rule"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "Thrust"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Constant
Name "Gravity"
SID "30"
Position [115, 80, 145, 110]
ZOrder -5
Value "-9.81"
}
Block {
BlockType Integrator
Name "Integrator"
SID "31"
Ports [1, 1]
Position [305, 35, 335, 65]
ZOrder -2
Port {
PortNumber 1
Name "Velocity"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Integrator
Name "Integrator1"
SID "32"
Ports [1, 1]
Position [420, 35, 450, 65]
ZOrder -2
}
Block {
BlockType Outport
Name "Altitude"
SID "59"
Position [520, 43, 550, 57]
ZOrder -9
IconDisplay "Port number"
}
Block {
BlockType Outport
Name "Measured Altitude"
SID "60"
Position [570, 98, 600, 112]
ZOrder -9
Port "2"
IconDisplay "Port number"
}
Block {
BlockType Outport
Name "Measured Accel"
SID "61"
Position [335, 128, 365, 142]
ZOrder -9
Port "3"
IconDisplay "Port number"
}
Line {
SrcBlock "Add1"
SrcPort 1
DstBlock "Measured Accel"
DstPort 1
}
Line {
SrcBlock "Altitude Noise"
SrcPort 1
DstBlock "Add2"
DstPort 2
}
Line {
SrcBlock "Accel Noise"
SrcPort 1
DstBlock "Add1"
DstPort 2
}
Line {
SrcBlock "Integrator1"
SrcPort 1
Points [15, 0]
Branch {
Points [-5, 0]
DstBlock "Add2"
DstPort 1
}
Branch {
DstBlock "Altitude"
DstPort 1
}
}
Line {
Name "Velocity"
Labels [1, 0]
SrcBlock "Integrator"
SrcPort 1
DstBlock "Integrator1"
DstPort 1
}
Line {
Name "Acceleration"
SrcBlock "Add"
SrcPort 1
Points [15, 0]
Branch {
DstBlock "Add1"
DstPort 1
}
Branch {
Labels [1, 0]
DstBlock "Integrator"
DstPort 1
}
}
Line {
SrcBlock "Gravity"
SrcPort 1
Points [15, 0; 0, -40]
DstBlock "Add"
DstPort 2
}
Line {
Name "Thrust"
Labels [1, 0]
SrcBlock "Gain"
SrcPort 1
DstBlock "Add"
DstPort 1
}
Line {
SrcBlock "Add2"
SrcPort 1
DstBlock "Measured Altitude"
DstPort 1
}
Line {
SrcBlock "Throttle"
SrcPort 1
DstBlock "Gain"
DstPort 1
}
}
}
Block {
BlockType Outport
Name "Altitude"
SID "37"
Position [620, 123, 650, 137]
ZOrder -9
NamePlacement "alternate"
IconDisplay "Port number"
}
Block {
BlockType Outport
Name "Measured Altitude"
SID "38"
Position [685, 143, 715, 157]
ZOrder -9
Port "2"
IconDisplay "Port number"
}
Block {
BlockType Outport
Name "Measured Accel"
SID "39"
Position [485, 163, 515, 177]
ZOrder -9
Port "3"
IconDisplay "Port number"
}
Line {
SrcBlock "Subsystem"
SrcPort 1
DstBlock "Altitude"
DstPort 1
}
Line {
SrcBlock "Subsystem"
SrcPort 2
Points [105, 0]
Branch {
DstBlock "Measured Altitude"
DstPort 1
}
Branch {
Points [0, 55; -455, 0; 0, -45]
DstBlock "PID Controller (2DOF)"
DstPort 2
}
}
Line {
SrcBlock "Subsystem"
SrcPort 3
DstBlock "Measured Accel"
DstPort 1
}
Line {
SrcBlock "Altitude Setpoint"
SrcPort 1
DstBlock "PID Controller (2DOF)"
DstPort 1
}
Line {
SrcBlock "PID Controller (2DOF)"
SrcPort 1
DstBlock "Add"
DstPort 2
}
Line {
SrcBlock "Add"
SrcPort 1
Points [10, 0; 0, 5]
DstBlock "Subsystem"
DstPort 1
}
Line {
SrcBlock "Constant"
SrcPort 1
Points [35, 0]
DstBlock "Add"
DstPort 1
}
}
}

View File

@ -133,6 +133,6 @@ latitude(gps_idx+1:end) = [];
longitude(gps_idx+1:end) = [];
altitude(gps_idx+1:end) = [];
groundspeed(gps_idx+1:end) = [];
gps_satelites(gps_idx+1:end) = [];
gps_satellites(gps_idx+1:end) = [];
gps_time(gps_idx+1:end) = [];
baro(baro_idx+1:end,:) = [];