0 $QO9V=E<@ %1O;&5R86YC94"
+ "-O;G1R;VQL960 &9I;F1F;75M971H;V0 $-O4VEM=6QA=&EO;@ %-A=F5#:&%N9V53970 "
+ " $9-50 $)I9TUO9&5L X P !@ @ & 4 ( "
+ " ! D #@ # & \" 8 !0 @ $ \"0 . B "
+ "8 ( @ % \" $ ! 0 % 0 \"@ $ * 4W1R3&5N9W1H X X !@ "
+ "@ & 4 ( 0 $ ! D ( \" 1D . B 8 ( @ % \" "
+ "$ ! 0 % 0 \"@ $ * 4W1R3&5N9W1H X X !@ @ & 4 ( 0 $"
+ " ! D ( \" 1D . 6 $ 8 ( @ % \" $ ! 0 % 0 \"P "
+ "$ 6 ;F)R;V9P;W)T7!E !N86UE
0 . , 8 ( !@ % \" "
+ " 0 ) X P !@ @ ) @ 4 ( 0 $ ! ( 0 ! #@ #@"
+ " & \" 8 !0 @ ! 0 $ \"0 @ 3R>0 X P !@ @ ) @ 4"
+ " ( 0 $ ! ( 0 #@ #@ & \" 0 !0 @ ! !0 $ $ 4 "
+ " !&355M90 X P !@ @ ) @ 4 ( 0 $ ! ( 0 #@ # & \" D\""
+ " !0 @ ! 0 $ @ ! . B 8 ( @ % \" $ ! 0 "
+ " % 0 #0 $ - 9FUI;&QO9VQE=F5L X X !@ @ $ 4 ( 0 4 ! ! "
+ "% 97)R;W( . ( $ 8 ( @ % \" $ ! 0 % 0 $@ $ V 96YA8FQE "
+ " =7-EF4 . "
+ " . 8 ( ! % \" $ % 0 0 !0 # N,# Q #@ #@ & \" 8 "
+ " !0 @ ! 0 $ \"0 @ (!:0 X X !@ @ & 4 ( 0 $ ! "
+ " D ( $ . 0 8 ( ! % \" $ / 0 0 #P %]E;F9O0 X X !@ @ & 4 ( 0 $ "
+ " ! D ( $ . 2 8 ( ! % \" $ 4 0 0 % %]R="
+ "6YT:6UE7VQO9U]T;U]F:6QE X X !@ @ $ 4 ( 0 4 ! ! % 9F%L ( + # #X! 8 4 1DU),55T:6P 9FUI=&]O;&)O>\"YB;&]C:W, 9FEG=7)E2&%N"
+ "9&QE &ES3W!E;@!T86)'
+
+Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+Francisco Gomez-Lopez
+
+The authors can be contacted by email: luigiv at kth dot se
+
+This package is part of Rapid Parameter Identification ("RaPId") .
+
+RaPId is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+RaPId is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with RaPId. If not, see .
\ No newline at end of file
diff --git a/Examples/generator_aggregation/FMU/JModelica_transformed.fmu b/Examples/generator_aggregation/FMU/JModelica_transformed.fmu
new file mode 100644
index 0000000..77ac9c6
Binary files /dev/null and b/Examples/generator_aggregation/FMU/JModelica_transformed.fmu differ
diff --git a/Examples/generator_aggregation/container.mat b/Examples/generator_aggregation/container.mat
new file mode 100644
index 0000000..8acb078
Binary files /dev/null and b/Examples/generator_aggregation/container.mat differ
diff --git a/Examples/generator_aggregation/measuredDataO.mat b/Examples/generator_aggregation/measuredDataO.mat
new file mode 100644
index 0000000..41855f5
Binary files /dev/null and b/Examples/generator_aggregation/measuredDataO.mat differ
diff --git a/Examples/generator_aggregation/sim_model.mdl b/Examples/generator_aggregation/sim_model.mdl
new file mode 100644
index 0000000..d3a2fb9
--- /dev/null
+++ b/Examples/generator_aggregation/sim_model.mdl
@@ -0,0 +1,1728 @@
+Model {
+ Name "sim_model"
+ Version 8.0
+ MdlSubVersion 0
+ GraphicalInterface {
+ NumRootInports 0
+ NumRootOutports 0
+ ParameterArgumentNames ""
+ ComputedModelVersion "1.29"
+ NumModelReferences 0
+ NumTestPointedSignals 0
+ }
+ SavedCharacterEncoding "windows-1252"
+ SaveDefaultBlockParams on
+ ScopeRefreshTime 0.035000
+ OverrideScopeRefreshTime on
+ DisableAllScopes off
+ DataTypeOverride "UseLocalSettings"
+ DataTypeOverrideAppliesTo "AllNumericTypes"
+ MinMaxOverflowLogging "UseLocalSettings"
+ MinMaxOverflowArchiveMode "Overwrite"
+ FPTRunName "Run 1"
+ MaxMDLFileLineLength 120
+ Object {
+ $PropName "BdWindowsInfo"
+ $ObjectID 1
+ $ClassName "Simulink.BDWindowsInfo"
+ Object {
+ $PropName "WindowsInfo"
+ $ObjectID 2
+ $ClassName "Simulink.WindowInfo"
+ IsActive [1]
+ Location [1040.0, 444.0, 1097.0, 945.0]
+ Object {
+ $PropName "ModelBrowserInfo"
+ $ObjectID 3
+ $ClassName "Simulink.ModelBrowserInfo"
+ Visible [1]
+ DockPosition "Left"
+ Width [50]
+ Height [50]
+ Filter [9]
+ }
+ Object {
+ $PropName "ExplorerBarInfo"
+ $ObjectID 4
+ $ClassName "Simulink.ExplorerBarInfo"
+ Visible [1]
+ }
+ Object {
+ $PropName "EditorsInfo"
+ $ObjectID 5
+ $ClassName "Simulink.EditorInfo"
+ IsActive [1]
+ ViewObjType "SimulinkTopLevel"
+ LoadSaveID "0"
+ Extents [841.0, 702.0]
+ ZoomFactor [1.3598160150533136]
+ Offset [89.7044895448953, 83.704489544895452]
+ }
+ }
+ }
+ Created "Tue Sep 08 13:07:49 2015"
+ Creator "Tin Rabuzin"
+ UpdateHistory "UpdateHistoryNever"
+ ModifiedByFormat "%"
+ LastModifiedBy "Tin Rabuzin"
+ ModifiedDateFormat "%"
+ LastModifiedDate "Mon Sep 14 22:30:01 2015"
+ RTWModifiedTimeStamp 364170559
+ ModelVersionFormat "1.%"
+ 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 6
+ $ClassName "Simulink.SimulationData.ModelLoggingInfo"
+ model_ "equiv"
+ overrideMode_ [0.0]
+ Array {
+ Type "Cell"
+ Dimension 1
+ Cell "equiv"
+ 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 7
+ Version "1.12.1"
+ Array {
+ Type "Handle"
+ Dimension 9
+ Simulink.SolverCC {
+ $ObjectID 8
+ Version "1.12.1"
+ StartTime "0"
+ StopTime "20"
+ AbsTol "auto"
+ FixedStep "0.01"
+ 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"
+ EnableConcurrentExecution off
+ 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 9
+ Version "1.12.1"
+ Decimation "1"
+ ExternalInput "[t, u]"
+ FinalStateName "xFinal"
+ InitialState "xInitial"
+ LimitDataPoints on
+ MaxDataPoints "1000"
+ LoadExternalInput off
+ LoadInitialState off
+ SaveFinalState off
+ SaveCompleteFinalSimState off
+ SaveFormat "Array"
+ SignalLoggingSaveFormat "Dataset"
+ 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 10
+ Version "1.12.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
+ ParallelExecutionInRapidAccelerator on
+ }
+ Simulink.DebuggingCC {
+ $ObjectID 11
+ Version "1.12.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 "EnableAllAsError"
+ 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"
+ SFUndirectedBroadcastEventsDiag "warning"
+ SFTransitionActionBeforeConditionDiag "warning"
+ }
+ Simulink.HardwareCC {
+ $ObjectID 12
+ Version "1.12.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 13
+ Version "1.12.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 14
+ Version "1.12.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 15
+ Version "1.12.1"
+ Array {
+ Type "Cell"
+ Dimension 15
+ Cell "IncludeHyperlinkInReport"
+ Cell "GenerateTraceInfo"
+ Cell "GenerateTraceReport"
+ Cell "GenerateTraceReportSl"
+ Cell "GenerateTraceReportSf"
+ Cell "GenerateTraceReportEml"
+ Cell "PortableWordSizes"
+ Cell "GenerateWebview"
+ Cell "GenerateCodeMetricsReport"
+ Cell "GenerateCodeReplacementReport"
+ Cell "GenerateErtSFunction"
+ Cell "CreateSILPILBlock"
+ Cell "CodeExecutionProfiling"
+ Cell "CodeProfilingSaveOptions"
+ Cell "CodeProfilingInstrumentation"
+ PropName "DisabledProps"
+ }
+ SystemTargetFile "grt.tlc"
+ GenCodeOnly off
+ MakeCommand "make_rtw"
+ GenerateMakefile on
+ PackageGeneratedCodeAndArtifacts off
+ 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
+ PortableWordSizes off
+ GenerateErtSFunction off
+ CreateSILPILBlock "None"
+ CodeExecutionProfiling off
+ CodeExecutionProfileVariable "executionProfile"
+ CodeProfilingSaveOptions "SummaryOnly"
+ CodeProfilingInstrumentation off
+ TargetLang "C"
+ IncludeBusHierarchyInRTWFileBlockHierarchyMap off
+ IncludeERTFirstTime off
+ GenerateTraceInfo off
+ GenerateTraceReport off
+ GenerateTraceReportSl off
+ GenerateTraceReportSf off
+ GenerateTraceReportEml off
+ GenerateCodeInfo off
+ GenerateWebview off
+ GenerateCodeMetricsReport off
+ GenerateCodeReplacementReport off
+ RTWCompilerOptimization "Off"
+ CheckMdlBeforeBuild "Off"
+ CustomRebuildMode "OnUpdate"
+ Array {
+ Type "Handle"
+ Dimension 2
+ Simulink.CodeAppCC {
+ $ObjectID 16
+ Version "1.12.1"
+ Array {
+ Type "Cell"
+ Dimension 22
+ Cell "IgnoreCustomStorageClasses"
+ Cell "IgnoreTestpoints"
+ Cell "InsertBlockDesc"
+ Cell "InsertPolySpaceComments"
+ Cell "SFDataObjDesc"
+ Cell "MATLABFcnDesc"
+ Cell "SimulinkDataObjDesc"
+ Cell "DefineNamingRule"
+ Cell "SignalNamingRule"
+ Cell "ParamNamingRule"
+ Cell "InternalIdentifier"
+ 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
+ OperatorAnnotations 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
+ InternalIdentifier "Classic"
+ InlinedPrmAccess "Literals"
+ ReqsInCode off
+ UseSimReservedNames off
+ }
+ Simulink.GRTTargetCC {
+ $BackupClass "Simulink.TargetCC"
+ $ObjectID 17
+ Version "1.12.1"
+ Array {
+ Type "Cell"
+ Dimension 15
+ 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"
+ PropName "DisabledProps"
+ }
+ TargetFcnLib "ansi_tfl_table_tmw.mat"
+ TargetLibSuffix ""
+ TargetPreCompLibLocation ""
+ CodeReplacementLibrary "ANSI_C"
+ UtilityFuncGeneration "Auto"
+ ERTMultiwordTypeDef "System defined"
+ 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 on
+ 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"
+ ModelStepFunctionPrototypeControlCompliant off
+ CPPClassGenCompliant off
+ AutosarCompliant off
+ GRTInterface 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"
+ }
+ }
+ hdlcoderui.hdlcc {
+ $ObjectID 18
+ Version "1.12.1"
+ Description "HDL Coder custom configuration component"
+ Name "HDL Coder"
+ Array {
+ Type "Cell"
+ Dimension 1
+ Cell ""
+ PropName "HDLConfigFile"
+ }
+ HDLCActiveTab "0"
+ }
+ PropName "Components"
+ }
+ Name "Configuration"
+ CurrentDlgPage "Solver"
+ ConfigPrmDlgPosition [ 0, 0, 880, 630 ]
+ }
+ PropName "ConfigurationSets"
+ }
+ Simulink.ConfigSet {
+ $PropName "ActiveConfigurationSet"
+ $ObjectID 7
+ }
+ Object {
+ $PropName "DataTransfer"
+ $ObjectID 19
+ $ClassName "Simulink.GlobalDataTransfer"
+ DefaultTransitionBetweenSyncTasks "Ensure deterministic transfer (maximum delay)"
+ DefaultTransitionBetweenAsyncTasks "Ensure data integrity only"
+ DefaultTransitionBetweenContTasks "Ensure deterministic transfer (minimum delay)"
+ DefaultExtrapolationMethodBetweenContTasks "None"
+ AutoInsertRateTranBlk [0]
+ }
+ ExplicitPartitioning off
+ 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"
+ }
+ MaskDefaults {
+ SelfModifiable "off"
+ IconFrame "on"
+ IconOpaque "on"
+ RunInitForIconRedraw "off"
+ IconRotate "none"
+ PortRotate "default"
+ IconUnits "autoscale"
+ }
+ MaskParameterDefaults {
+ Evaluate "on"
+ Tunable "on"
+ NeverSave "off"
+ Internal "off"
+ ReadOnly "off"
+ Enabled "on"
+ Visible "on"
+ ToolTip "on"
+ }
+ BlockParameterDefaults {
+ Block {
+ BlockType Demux
+ Outputs "4"
+ DisplayOption "none"
+ BusSelectionMode off
+ }
+ Block {
+ BlockType FromWorkspace
+ VariableName "simulink_input"
+ OutDataTypeStr "Inherit: auto"
+ SampleTime "-1"
+ Interpolate on
+ ZeroCross off
+ OutputAfterFinalValue "Extrapolation"
+ }
+ Block {
+ BlockType Mux
+ Inputs "4"
+ DisplayOption "none"
+ UseBusObject off
+ BusObject "BusObject"
+ NonVirtualBus off
+ }
+ Block {
+ BlockType Scope
+ ModelBased off
+ TickLabels "OneTimeTick"
+ ZoomMode "on"
+ Grid "on"
+ TimeRange "auto"
+ YMin "-5"
+ YMax "5"
+ SaveToWorkspace off
+ SaveName "ScopeData"
+ DataFormat "Array"
+ LimitDataPoints on
+ MaxDataPoints "5000"
+ Decimation "1"
+ SampleInput off
+ SampleTime "-1"
+ }
+ Block {
+ BlockType ToWorkspace
+ VariableName "simulink_output"
+ MaxDataPoints "1000"
+ Decimation "1"
+ SampleTime "0"
+ SaveFormat "Array"
+ FixptAsFi off
+ NumInputs "1"
+ }
+ }
+ System {
+ Name "sim_model"
+ Location [1040, 444, 2137, 1389]
+ Open on
+ ModelBrowserVisibility on
+ 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 "135"
+ ReportName "simulink-default.rpt"
+ SIDHighWatermark "30"
+ Block {
+ BlockType Demux
+ Name "Demux"
+ SID "4"
+ Ports [1, 3]
+ Position [335, 291, 340, 469]
+ ZOrder 4
+ ShowName off
+ Outputs "3"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Scope
+ Name "ETERM"
+ SID "12"
+ Ports [1]
+ Position [650, 293, 680, 327]
+ ZOrder 12
+ Floating off
+ Location [6, 386, 654, 629]
+ Open off
+ NumInputPorts "1"
+ List {
+ ListType AxesTitles
+ axes1 "%"
+ }
+ List {
+ ListType ScopeGraphics
+ FigureColor "[0.5 0.5 0.5]"
+ AxesColor "[0 0 0]"
+ AxesTickColor "[1 1 1]"
+ LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]"
+ LineStyles "-|-|-|-|-|-"
+ LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]"
+ MarkerStyles "none|none|none|none|none|none"
+ }
+ ShowLegends off
+ TimeRange "20"
+ YMin "1.05"
+ YMax "1.06"
+ DataFormat "StructureWithTime"
+ SampleTime "0"
+ }
+ Block {
+ BlockType Reference
+ Name "FMUme"
+ SID "30"
+ Description "Simulates an FMU for Model Exchange 1.0 or Model Exchange 2.0."
+ Ports [0, 3]
+ Position [100, 94, 265, 236]
+ ZOrder 20
+ LibraryVersion "1.159"
+ UserDataPersistent on
+ UserData "DataTag0"
+ SourceBlock "fmu_me_lib/FMU ME"
+ SourceType ""
+ }
+ Block {
+ BlockType FromWorkspace
+ Name "From Workspace"
+ SID "16"
+ Position [150, 368, 215, 392]
+ ZOrder 16
+ VariableName "dataMeasuredS"
+ SampleTime "0"
+ ZeroCross on
+ }
+ Block {
+ BlockType Mux
+ Name "Mux"
+ SID "8"
+ Ports [2, 1]
+ Position [610, 291, 615, 329]
+ ZOrder 8
+ ShowName off
+ Inputs "2"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Mux
+ Name "Mux1"
+ SID "9"
+ Ports [2, 1]
+ Position [610, 351, 615, 389]
+ ZOrder 9
+ ShowName off
+ Inputs "2"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Mux
+ Name "Mux2"
+ SID "10"
+ Ports [2, 1]
+ Position [610, 411, 615, 449]
+ ZOrder 10
+ ShowName off
+ Inputs "2"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Mux
+ Name "Mux3"
+ SID "11"
+ Ports [3, 1]
+ Position [610, 97, 615, 233]
+ ZOrder 11
+ ShowName off
+ Inputs "3"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Scope
+ Name "P"
+ SID "14"
+ Ports [1]
+ Position [650, 414, 680, 446]
+ ZOrder 14
+ Floating off
+ Location [13, 822, 562, 1061]
+ Open off
+ NumInputPorts "1"
+ List {
+ ListType AxesTitles
+ axes1 "%"
+ }
+ List {
+ ListType ScopeGraphics
+ FigureColor "[0.5 0.5 0.5]"
+ AxesColor "[0 0 0]"
+ AxesTickColor "[1 1 1]"
+ LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]"
+ LineStyles "-|-|-|-|-|-"
+ LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]"
+ MarkerStyles "none|none|none|none|none|none"
+ }
+ ShowLegends off
+ TimeRange "18"
+ YMin "0.499"
+ YMax "0.5015"
+ SaveName "ScopeData2"
+ DataFormat "StructureWithTime"
+ SampleTime "0"
+ }
+ Block {
+ BlockType Scope
+ Name "Q"
+ SID "13"
+ Ports [1]
+ Position [650, 354, 680, 386]
+ ZOrder 13
+ Floating off
+ Location [6, 854, 660, 1061]
+ Open off
+ NumInputPorts "1"
+ ZoomMode "xonly"
+ List {
+ ListType AxesTitles
+ axes1 "%"
+ }
+ List {
+ ListType ScopeGraphics
+ FigureColor "[0.5 0.5 0.5]"
+ AxesColor "[0 0 0]"
+ AxesTickColor "[1 1 1]"
+ LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]"
+ LineStyles "-|-|-|-|-|-"
+ LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]"
+ MarkerStyles "none|none|none|none|none|none"
+ }
+ ShowLegends off
+ YMin "0"
+ YMax "2"
+ SaveName "ScopeData1"
+ DataFormat "StructureWithTime"
+ SampleTime "0"
+ }
+ Block {
+ BlockType ToWorkspace
+ Name "To Workspace"
+ SID "2"
+ Ports [1]
+ Position [635, 150, 695, 180]
+ ZOrder 2
+ VariableName "simout"
+ MaxDataPoints "inf"
+ SampleTime "-1"
+ SaveFormat "Structure With Time"
+ }
+ Line {
+ SrcBlock "From Workspace"
+ SrcPort 1
+ DstBlock "Demux"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Demux"
+ SrcPort 3
+ DstBlock "Mux2"
+ DstPort 2
+ }
+ Line {
+ SrcBlock "Demux"
+ SrcPort 2
+ DstBlock "Mux1"
+ DstPort 2
+ }
+ Line {
+ SrcBlock "Demux"
+ SrcPort 1
+ DstBlock "Mux"
+ DstPort 2
+ }
+ Line {
+ SrcBlock "Mux3"
+ SrcPort 1
+ DstBlock "To Workspace"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Mux"
+ SrcPort 1
+ DstBlock "ETERM"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Mux1"
+ SrcPort 1
+ DstBlock "Q"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Mux2"
+ SrcPort 1
+ DstBlock "P"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "FMUme"
+ SrcPort 1
+ Points [98, 0]
+ Branch {
+ Points [0, 180]
+ DstBlock "Mux"
+ DstPort 1
+ }
+ Branch {
+ DstBlock "Mux3"
+ DstPort 1
+ }
+ }
+ Line {
+ SrcBlock "FMUme"
+ SrcPort 3
+ Points [207, 0]
+ Branch {
+ Points [0, 210]
+ DstBlock "Mux2"
+ DstPort 1
+ }
+ Branch {
+ DstBlock "Mux3"
+ DstPort 3
+ }
+ }
+ Line {
+ SrcBlock "FMUme"
+ SrcPort 2
+ Points [155, 0]
+ Branch {
+ Points [0, 195]
+ DstBlock "Mux1"
+ DstPort 1
+ }
+ Branch {
+ DstBlock "Mux3"
+ DstPort 2
+ }
+ }
+ }
+}
+MatData {
+ NumRecords 1
+ DataRecord {
+ Tag DataTag0
+ Data " %)30 . &+L 8 ( @ % \" $ ! 0 % 0 # $ D 1DU5 "
+ " 1U5) 0FQO8VM#;VYF:6< X P$ !@ @ \" 4 ( 0 $ ! 4"
+ " ! 5 0 *@ !-;V1E;$1A=&$ !$969U86QT17AP97)I;65N= !-;V1E;$1E7-T96US7T5X86UP;&5S7W1H979E;FEN7V5Q=6EV86QE;G1?=')A;G-F;W)M960R . 4 8 ( ! "
+ " % \" $ @ 0 0 ( #5E,#0 X X !@ @ & 4 ( 0 $ ! D ( "
+ " . . 8 ( !@ % \" $ ! 0 ) \" #@ #@ & \" "
+ " 8 !0 @ ! 0 $ \"0 @ \"!X0 X X !@ @ & 4 ( 0"
+ " $ ! D ( . 2 8 ( @ % \" $ 0 % 0 !0 "
+ " $ / ;F%M90!I9'@ '1Y<&4 X \" !@ @ \" 4 ( 0 ! 4 ! 1 0 "
+ " $0 !N86UE &ED> ='EP90 !$:7)E8W1$97!E;F1E;F-Y . 8 $ "
+ " 8 ( @ % \" $ ! 0 % 0 # $ P 4F5L;V%D4&]R=', ;3$ ;3( "
+ " ;3, #@ # & \" D\" !0 @ ! 0 $ @ ! . . "
+ "8 ( !@ % \" $ ! 0 ) \" ! #@ #@ & \" 8 !0 "
+ " @ ! 0 $ \"0 @ #P/PX X !@ @ & 4 ( 0 $ ! "
+ "D ( . F 8 ( $0 ! $ ! !-0T]3 0 !H !F;6ET;V]L8F]X+F)L;V-K\"YB;&]C:W,N9W5I+D=520 "
+ " . 2 8 ( #0 % \" 8 ! 0 & & -T\" 0 $ \" # X "
+ " \" !@ @ \" 4 ( 0 $ ! 4 ! % 0 4 !486< X X !@ @ "
+ " & 4 ( 0 $ ! D ( . D , 8 ( @ % \" $ "
+ " ! 0 % 0 %P $ !S 5&%B,0 !486(R %-T7-T96U&=6QL3F%M90 #@ % ! & \" ( "
+ " !0 @ ! 0 $ !0 $ < ! !P $9I;'1E<@ #@ @! & \" ( !0 @ ! "
+ " 0 $ !0 $ L ! (0 %-T 8 ( @ % "
+ "\" $ ! 0 % 0 !P $ ' 4W1R:6YG . , 8 ( ! % \" "
+ " 0 0 X P !@ @ ) @ 4 ( 0 $ ! ( 0 #@ #@ & \""
+ " 8 !0 @ ! 0 $ \"0 @ X ! !@ @ $ 4 ( 0"
+ " L ! ! + 97%U:78O1DU5;64 X \"(!0 !@ @ \" 4 ( 0 $ ! "
+ " 4 ! ' 0 \", !T7!E !N86UE0 . , 8 ( !@ "
+ "% \" 0 ) X P !@ @ ) @ 4 ( 0 $ ! ( 0 "
+ " #@ #@ & \" 8 !0 @ ! 0 $ \"0 @ R Y0 X P !@ @ )"
+ " @ 4 ( 0 $ ! ( 0 ! #@ #@ & \" 0 !0 @ ! !0 $ "
+ " $ 4 !&355M90 X P !@ @ ) @ 4 ( 0 $ ! ( 0 #@ # & "
+ " \" D\" !0 @ ! 0 $ @ ! . B 8 ( @ % \" $ ! "
+ " 0 % 0 #0 $ - 9FUI;&QO9VQE=F5L X X !@ @ $ 4 ( 0 4 ! "
+ " ! % 97)R;W( . ( $ 8 ( @ % \" $ ! 0 % 0 $@ $ V 9"
+ "6YA8FQE =7-E%]I=&5R X P !@ @ $ "
+ " 4 ( 0 , ! ! P Q,# #@ #@ & \" 8 !0 @ ! 0 $ \"0 "
+ " @ N0 X X !@ @ & 4 ( 0 $ ! D ( . 2 "
+ "8 ( ! % \" $ 3 0 0 $P %]N;&5?7-T96US7T5X86UP;&5S7W1H979E;FEN7V5Q=6EV86QE;G1?=')A;G-F;W)M960R+F1L; . F 8 "
+ " ( ! % \" $ !D 0 0 9 $,Z7%5S97)S7%1)3E)!0GXQ7$%P<$1A=&%<3&]C86Q<5&5M<%QF;7"
+ "5<='!A,3(V-V(Q.%]B.68W7S0X-C1?83-E85\\Q,F1D-S(R86,P93=<;6]D96Q$97-C ( '@\" \"P P ^ 0 & % $9-"
+ "23%5=&EL &9M:71O;VQB;W@N8FQO8VMS &9I9W5R94AA;F1L90!I
+
+Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+Francisco Gomez-Lopez
+
+The authors can be contacted by email: luigiv at kth dot se
+
+This package is part of Rapid Parameter Identification ("RaPId") .
+
+RaPId is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+RaPId is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with RaPId. If not, see .
\ No newline at end of file
diff --git a/Examples/line_equivalent/FMU/Dymola_transformedIO2.fmu b/Examples/line_equivalent/FMU/Dymola_transformedIO2.fmu
new file mode 100644
index 0000000..1fbb3ea
Binary files /dev/null and b/Examples/line_equivalent/FMU/Dymola_transformedIO2.fmu differ
diff --git a/Examples/line_equivalent/FMU/JModelica_transformedIO2.fmu b/Examples/line_equivalent/FMU/JModelica_transformedIO2.fmu
new file mode 100644
index 0000000..0b04faa
Binary files /dev/null and b/Examples/line_equivalent/FMU/JModelica_transformedIO2.fmu differ
diff --git a/Examples/line_equivalent/inputDataO.mat b/Examples/line_equivalent/inputDataO.mat
new file mode 100644
index 0000000..49827d5
Binary files /dev/null and b/Examples/line_equivalent/inputDataO.mat differ
diff --git a/Examples/line_equivalent/line_equivalent_container.mat b/Examples/line_equivalent/line_equivalent_container.mat
new file mode 100644
index 0000000..a312957
Binary files /dev/null and b/Examples/line_equivalent/line_equivalent_container.mat differ
diff --git a/Examples/line_equivalent/measuredDataO.mat b/Examples/line_equivalent/measuredDataO.mat
new file mode 100644
index 0000000..94160f6
Binary files /dev/null and b/Examples/line_equivalent/measuredDataO.mat differ
diff --git a/Examples/line_equivalent/sim_model.mdl b/Examples/line_equivalent/sim_model.mdl
new file mode 100644
index 0000000..ba0b9bc
--- /dev/null
+++ b/Examples/line_equivalent/sim_model.mdl
@@ -0,0 +1,1719 @@
+Model {
+ Name "sim_model"
+ Version 8.0
+ MdlSubVersion 0
+ GraphicalInterface {
+ NumRootInports 0
+ NumRootOutports 0
+ ParameterArgumentNames ""
+ ComputedModelVersion "1.19"
+ NumModelReferences 0
+ NumTestPointedSignals 0
+ }
+ SavedCharacterEncoding "windows-1252"
+ slprops.hdlmdlprops {
+ $PropName "HDLParams"
+ $ObjectID 1
+ Array {
+ Type "Cell"
+ Dimension 2
+ Cell "HDLSubsystem"
+ Cell "sim_model"
+ PropName "mdlProps"
+ }
+ }
+ SaveDefaultBlockParams on
+ ScopeRefreshTime 0.035000
+ OverrideScopeRefreshTime on
+ DisableAllScopes off
+ DataTypeOverride "UseLocalSettings"
+ DataTypeOverrideAppliesTo "AllNumericTypes"
+ MinMaxOverflowLogging "UseLocalSettings"
+ MinMaxOverflowArchiveMode "Overwrite"
+ FPTRunName "Run 1"
+ MaxMDLFileLineLength 120
+ Object {
+ $PropName "BdWindowsInfo"
+ $ObjectID 2
+ $ClassName "Simulink.BDWindowsInfo"
+ Object {
+ $PropName "WindowsInfo"
+ $ObjectID 3
+ $ClassName "Simulink.WindowInfo"
+ IsActive [1]
+ Location [1302.0, 148.0, 1033.0, 949.0]
+ Object {
+ $PropName "ModelBrowserInfo"
+ $ObjectID 4
+ $ClassName "Simulink.ModelBrowserInfo"
+ Visible [1]
+ DockPosition "Left"
+ Width [50]
+ Height [50]
+ Filter [9]
+ }
+ Object {
+ $PropName "ExplorerBarInfo"
+ $ObjectID 5
+ $ClassName "Simulink.ExplorerBarInfo"
+ Visible [1]
+ }
+ Object {
+ $PropName "EditorsInfo"
+ $ObjectID 6
+ $ClassName "Simulink.EditorInfo"
+ IsActive [1]
+ ViewObjType "SimulinkTopLevel"
+ LoadSaveID "0"
+ Extents [777.0, 706.0]
+ ZoomFactor [1.0740276035131742]
+ Offset [-2.5350467289719631, -41.669392523364536]
+ }
+ }
+ }
+ Created "Thu Sep 10 22:08:52 2015"
+ Creator "Tin Rabuzin"
+ UpdateHistory "UpdateHistoryNever"
+ ModifiedByFormat "%"
+ LastModifiedBy "Tin Rabuzin"
+ ModifiedDateFormat "%"
+ LastModifiedDate "Mon Sep 14 15:25:06 2015"
+ RTWModifiedTimeStamp 364145105
+ ModelVersionFormat "1.%"
+ 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 7
+ $ClassName "Simulink.SimulationData.ModelLoggingInfo"
+ model_ "sim_model"
+ overrideMode_ [0.0]
+ Array {
+ Type "Cell"
+ Dimension 1
+ Cell "sim_model"
+ 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 8
+ Version "1.12.1"
+ Array {
+ Type "Handle"
+ Dimension 9
+ Simulink.SolverCC {
+ $ObjectID 9
+ Version "1.12.1"
+ StartTime "0.0"
+ StopTime "10.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"
+ EnableConcurrentExecution off
+ 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 10
+ Version "1.12.1"
+ Decimation "1"
+ ExternalInput "[t, u]"
+ FinalStateName "xFinal"
+ InitialState "xInitial"
+ LimitDataPoints on
+ MaxDataPoints "1000"
+ LoadExternalInput off
+ LoadInitialState off
+ SaveFinalState off
+ SaveCompleteFinalSimState off
+ SaveFormat "Array"
+ SignalLoggingSaveFormat "Dataset"
+ 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 11
+ Version "1.12.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
+ ParallelExecutionInRapidAccelerator on
+ }
+ Simulink.DebuggingCC {
+ $ObjectID 12
+ Version "1.12.1"
+ RTPrefix "error"
+ ConsistencyChecking "none"
+ ArrayBoundsChecking "none"
+ SignalInfNanChecking "none"
+ SignalRangeChecking "none"
+ ReadBeforeWriteMsg "UseLocalSettings"
+ WriteAfterWriteMsg "UseLocalSettings"
+ WriteAfterReadMsg "UseLocalSettings"
+ AlgebraicLoopMsg "error"
+ 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 "none"
+ 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 "EnableAllAsError"
+ 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"
+ SFUndirectedBroadcastEventsDiag "warning"
+ SFTransitionActionBeforeConditionDiag "warning"
+ }
+ Simulink.HardwareCC {
+ $ObjectID 13
+ Version "1.12.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 14
+ Version "1.12.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 15
+ Version "1.12.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 16
+ Version "1.12.1"
+ Array {
+ Type "Cell"
+ Dimension 15
+ Cell "IncludeHyperlinkInReport"
+ Cell "GenerateTraceInfo"
+ Cell "GenerateTraceReport"
+ Cell "GenerateTraceReportSl"
+ Cell "GenerateTraceReportSf"
+ Cell "GenerateTraceReportEml"
+ Cell "PortableWordSizes"
+ Cell "GenerateWebview"
+ Cell "GenerateCodeMetricsReport"
+ Cell "GenerateCodeReplacementReport"
+ Cell "GenerateErtSFunction"
+ Cell "CreateSILPILBlock"
+ Cell "CodeExecutionProfiling"
+ Cell "CodeProfilingSaveOptions"
+ Cell "CodeProfilingInstrumentation"
+ PropName "DisabledProps"
+ }
+ SystemTargetFile "grt.tlc"
+ GenCodeOnly off
+ MakeCommand "make_rtw"
+ GenerateMakefile on
+ PackageGeneratedCodeAndArtifacts off
+ 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
+ PortableWordSizes off
+ GenerateErtSFunction off
+ CreateSILPILBlock "None"
+ CodeExecutionProfiling off
+ CodeExecutionProfileVariable "executionProfile"
+ CodeProfilingSaveOptions "SummaryOnly"
+ CodeProfilingInstrumentation off
+ TargetLang "C"
+ IncludeBusHierarchyInRTWFileBlockHierarchyMap off
+ IncludeERTFirstTime off
+ GenerateTraceInfo off
+ GenerateTraceReport off
+ GenerateTraceReportSl off
+ GenerateTraceReportSf off
+ GenerateTraceReportEml off
+ GenerateCodeInfo off
+ GenerateWebview off
+ GenerateCodeMetricsReport off
+ GenerateCodeReplacementReport off
+ RTWCompilerOptimization "Off"
+ CheckMdlBeforeBuild "Off"
+ CustomRebuildMode "OnUpdate"
+ Array {
+ Type "Handle"
+ Dimension 2
+ Simulink.CodeAppCC {
+ $ObjectID 17
+ Version "1.12.1"
+ Array {
+ Type "Cell"
+ Dimension 22
+ Cell "IgnoreCustomStorageClasses"
+ Cell "IgnoreTestpoints"
+ Cell "InsertBlockDesc"
+ Cell "InsertPolySpaceComments"
+ Cell "SFDataObjDesc"
+ Cell "MATLABFcnDesc"
+ Cell "SimulinkDataObjDesc"
+ Cell "DefineNamingRule"
+ Cell "SignalNamingRule"
+ Cell "ParamNamingRule"
+ Cell "InternalIdentifier"
+ 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
+ OperatorAnnotations 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
+ InternalIdentifier "Classic"
+ InlinedPrmAccess "Literals"
+ ReqsInCode off
+ UseSimReservedNames off
+ }
+ Simulink.GRTTargetCC {
+ $BackupClass "Simulink.TargetCC"
+ $ObjectID 18
+ Version "1.12.1"
+ Array {
+ Type "Cell"
+ Dimension 15
+ 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"
+ PropName "DisabledProps"
+ }
+ TargetFcnLib "ansi_tfl_table_tmw.mat"
+ TargetLibSuffix ""
+ TargetPreCompLibLocation ""
+ CodeReplacementLibrary "ANSI_C"
+ UtilityFuncGeneration "Auto"
+ ERTMultiwordTypeDef "System defined"
+ 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 on
+ 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"
+ ModelStepFunctionPrototypeControlCompliant off
+ CPPClassGenCompliant off
+ AutosarCompliant off
+ GRTInterface 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"
+ }
+ }
+ hdlcoderui.hdlcc {
+ $ObjectID 19
+ Version "1.12.1"
+ Description "HDL Coder custom configuration component"
+ Name "HDL Coder"
+ Array {
+ Type "Cell"
+ Dimension 1
+ Cell ""
+ PropName "HDLConfigFile"
+ }
+ HDLCActiveTab "0"
+ }
+ PropName "Components"
+ }
+ Name "Configuration"
+ CurrentDlgPage "Diagnostics"
+ ConfigPrmDlgPosition [ 1275, 326, 2487, 1436 ]
+ }
+ PropName "ConfigurationSets"
+ }
+ Simulink.ConfigSet {
+ $PropName "ActiveConfigurationSet"
+ $ObjectID 8
+ }
+ Object {
+ $PropName "DataTransfer"
+ $ObjectID 20
+ $ClassName "Simulink.GlobalDataTransfer"
+ DefaultTransitionBetweenSyncTasks "Ensure deterministic transfer (maximum delay)"
+ DefaultTransitionBetweenAsyncTasks "Ensure data integrity only"
+ DefaultTransitionBetweenContTasks "Ensure deterministic transfer (minimum delay)"
+ DefaultExtrapolationMethodBetweenContTasks "None"
+ AutoInsertRateTranBlk [0]
+ }
+ ExplicitPartitioning off
+ 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"
+ }
+ MaskDefaults {
+ SelfModifiable "off"
+ IconFrame "on"
+ IconOpaque "on"
+ RunInitForIconRedraw "off"
+ IconRotate "none"
+ PortRotate "default"
+ IconUnits "autoscale"
+ }
+ MaskParameterDefaults {
+ Evaluate "on"
+ Tunable "on"
+ NeverSave "off"
+ Internal "off"
+ ReadOnly "off"
+ Enabled "on"
+ Visible "on"
+ ToolTip "on"
+ }
+ BlockParameterDefaults {
+ Block {
+ BlockType Demux
+ Outputs "4"
+ DisplayOption "none"
+ BusSelectionMode off
+ }
+ Block {
+ BlockType FromWorkspace
+ VariableName "simulink_input"
+ OutDataTypeStr "Inherit: auto"
+ SampleTime "-1"
+ Interpolate on
+ ZeroCross off
+ OutputAfterFinalValue "Extrapolation"
+ }
+ Block {
+ BlockType Mux
+ Inputs "4"
+ DisplayOption "none"
+ UseBusObject off
+ BusObject "BusObject"
+ NonVirtualBus off
+ }
+ Block {
+ BlockType Scope
+ ModelBased off
+ TickLabels "OneTimeTick"
+ ZoomMode "on"
+ Grid "on"
+ TimeRange "auto"
+ YMin "-5"
+ YMax "5"
+ SaveToWorkspace off
+ SaveName "ScopeData"
+ DataFormat "Array"
+ LimitDataPoints on
+ MaxDataPoints "5000"
+ Decimation "1"
+ SampleInput off
+ SampleTime "-1"
+ }
+ Block {
+ BlockType ToWorkspace
+ VariableName "simulink_output"
+ MaxDataPoints "1000"
+ Decimation "1"
+ SampleTime "0"
+ SaveFormat "Array"
+ FixptAsFi off
+ NumInputs "1"
+ }
+ }
+ System {
+ Name "sim_model"
+ Location [1302, 148, 2335, 1097]
+ Open on
+ ModelBrowserVisibility on
+ 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 "107"
+ ReportName "simulink-default.rpt"
+ SIDHighWatermark "13"
+ Block {
+ BlockType Demux
+ Name "Demux"
+ SID "2"
+ Ports [1, 3]
+ Position [305, 375, 310, 515]
+ ZOrder 13
+ ShowName off
+ Outputs "3"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType FromWorkspace
+ Name "From Workspace"
+ SID "3"
+ Position [210, 433, 275, 457]
+ ZOrder 21
+ VariableName "dataMeasuredS"
+ SampleTime "0"
+ ZeroCross on
+ }
+ Block {
+ BlockType FromWorkspace
+ Name "From Workspace1"
+ SID "4"
+ Position [20, 118, 85, 142]
+ ZOrder 22
+ VariableName "inputSignalS"
+ SampleTime "0"
+ ZeroCross on
+ }
+ Block {
+ BlockType Mux
+ Name "Mux"
+ SID "5"
+ Ports [3, 1]
+ Position [615, 60, 620, 200]
+ ZOrder 14
+ ShowName off
+ Inputs "3"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Mux
+ Name "Mux1"
+ SID "6"
+ Ports [2, 1]
+ Position [615, 371, 620, 409]
+ ZOrder 15
+ ShowName off
+ Inputs "2"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Mux
+ Name "Mux2"
+ SID "7"
+ Ports [2, 1]
+ Position [615, 416, 620, 454]
+ ZOrder 16
+ ShowName off
+ Inputs "2"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Mux
+ Name "Mux3"
+ SID "8"
+ Ports [2, 1]
+ Position [615, 461, 620, 499]
+ ZOrder 17
+ ShowName off
+ Inputs "2"
+ DisplayOption "bar"
+ }
+ Block {
+ BlockType Scope
+ Name "Scope"
+ SID "9"
+ Ports [1]
+ Position [660, 374, 690, 406]
+ ZOrder 18
+ Floating off
+ Location [188, 390, 512, 629]
+ Open off
+ NumInputPorts "1"
+ List {
+ ListType AxesTitles
+ axes1 "%"
+ }
+ List {
+ ListType ScopeGraphics
+ FigureColor "[0.5 0.5 0.5]"
+ AxesColor "[0 0 0]"
+ AxesTickColor "[1 1 1]"
+ LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]"
+ LineStyles "-|-|-|-|-|-"
+ LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]"
+ MarkerStyles "none|none|none|none|none|none"
+ }
+ ShowLegends off
+ DataFormat "StructureWithTime"
+ SampleTime "0"
+ }
+ Block {
+ BlockType Scope
+ Name "Scope1"
+ SID "10"
+ Ports [1]
+ Position [660, 419, 690, 451]
+ ZOrder 19
+ Floating off
+ Location [188, 390, 512, 629]
+ Open off
+ NumInputPorts "1"
+ List {
+ ListType AxesTitles
+ axes1 "%"
+ }
+ ShowLegends off
+ SaveName "ScopeData1"
+ DataFormat "StructureWithTime"
+ SampleTime "0"
+ }
+ Block {
+ BlockType Scope
+ Name "Scope2"
+ SID "11"
+ Ports [1]
+ Position [660, 464, 690, 496]
+ ZOrder 20
+ Floating off
+ Location [909, 822, 1702, 1061]
+ Open off
+ NumInputPorts "1"
+ List {
+ ListType AxesTitles
+ axes1 "%"
+ }
+ List {
+ ListType ScopeGraphics
+ FigureColor "[0.5 0.5 0.5]"
+ AxesColor "[0 0 0]"
+ AxesTickColor "[1 1 1]"
+ LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]"
+ LineStyles "-|-|-|-|-|-"
+ LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]"
+ MarkerStyles "none|none|none|none|none|none"
+ }
+ ShowLegends off
+ YMin "0.399"
+ YMax "0.411"
+ SaveName "ScopeData2"
+ DataFormat "StructureWithTime"
+ SampleTime "0"
+ }
+ Block {
+ BlockType ToWorkspace
+ Name "To Workspace"
+ SID "12"
+ Ports [1]
+ Position [645, 115, 705, 145]
+ ZOrder 23
+ VariableName "simout"
+ MaxDataPoints "inf"
+ SampleTime "-1"
+ SaveFormat "Structure With Time"
+ }
+ Block {
+ BlockType Reference
+ Name "transformedIO2"
+ SID "13"
+ Description "Simulates an FMU for Model Exchange 1.0 or Model Exchange 2.0."
+ Ports [1, 3]
+ Position [160, 59, 325, 201]
+ ZOrder 24
+ LibraryVersion "1.159"
+ UserDataPersistent on
+ UserData "DataTag0"
+ SourceBlock "fmu_me_lib/FMU ME"
+ SourceType ""
+ }
+ Line {
+ SrcBlock "transformedIO2"
+ SrcPort 1
+ Points [54, 0]
+ Branch {
+ Points [0, 295]
+ DstBlock "Mux1"
+ DstPort 1
+ }
+ Branch {
+ DstBlock "Mux"
+ DstPort 1
+ }
+ }
+ Line {
+ SrcBlock "transformedIO2"
+ SrcPort 2
+ Points [91, 0]
+ Branch {
+ Points [0, 295]
+ DstBlock "Mux2"
+ DstPort 1
+ }
+ Branch {
+ DstBlock "Mux"
+ DstPort 2
+ }
+ }
+ Line {
+ SrcBlock "transformedIO2"
+ SrcPort 3
+ Points [128, 0]
+ Branch {
+ Points [0, 295]
+ DstBlock "Mux3"
+ DstPort 1
+ }
+ Branch {
+ DstBlock "Mux"
+ DstPort 3
+ }
+ }
+ Line {
+ SrcBlock "Mux1"
+ SrcPort 1
+ DstBlock "Scope"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Mux2"
+ SrcPort 1
+ DstBlock "Scope1"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Mux3"
+ SrcPort 1
+ DstBlock "Scope2"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Demux"
+ SrcPort 1
+ DstBlock "Mux1"
+ DstPort 2
+ }
+ Line {
+ SrcBlock "Demux"
+ SrcPort 2
+ DstBlock "Mux2"
+ DstPort 2
+ }
+ Line {
+ SrcBlock "Demux"
+ SrcPort 3
+ DstBlock "Mux3"
+ DstPort 2
+ }
+ Line {
+ SrcBlock "From Workspace"
+ SrcPort 1
+ DstBlock "Demux"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "From Workspace1"
+ SrcPort 1
+ DstBlock "transformedIO2"
+ DstPort 1
+ }
+ Line {
+ SrcBlock "Mux"
+ SrcPort 1
+ DstBlock "To Workspace"
+ DstPort 1
+ }
+ }
+}
+MatData {
+ NumRecords 1
+ DataRecord {
+ Tag DataTag0
+ Data " %)30 . T+0 8 ( @ % \" $ ! 0 % 0 # $ D 1DU5 "
+ " 1U5) 0FQO8VM#;VYF:6< X #8$ !@ @ \" 4 ( 0 $ ! 4"
+ " ! 5 0 *@ !-;V1E;$1A=&$ !$969U86QT17AP97)I;65N= !-;V1E;$1E 7!E . 0 "
+ " 8 ( ! % \" $ , 0 0 # '!R969?9&ES='5R8@ . . 8 ( !@ "
+ " % \" $ ! 0 ) \" $'9 #@ #@ & \" 8 !0 @ ! 0"
+ " $ \"0 @ X \" !@ @ \" 4 ( 0 ! 4 ! 1 "
+ "0 $0 !N86UE &ED> ='EP90 !$:7)E8W1$97!E;F1E;F-Y . 8 $"
+ " 8 ( @ % \" $ ! 0 % 0 # $ P 4F5L;V%D4&]R=', ;3$ ;3( "
+ " ;3, #@ # & \" D\" !0 @ ! 0 $ @ ! . . "
+ " 8 ( !@ % \" $ ! 0 ) \" ! #@ #@ & \" 8 !0 "
+ " @ ! 0 $ \"0 @ X X !@ @ & 4 ( 0 $ ! "
+ " D ( . F 8 ( $0 ! $ ! !-0T]3 0 !H !F;6ET;V]L8F]X+F)L;V-K\"YB;&]C:W,N9W5I+D=520 "
+ " . 2 8 ( #0 % \" 8 ! 0 & & -T\" 0 $ \" # "
+ "X \" !@ @ \" 4 ( 0 $ ! 4 ! % 0 4 !486< X X !@ "
+ "@ & 4 ( 0 $ ! D ( . @ , 8 ( @ % \" $"
+ " ! 0 % 0 %P $ !S 5&%B,0 !486(R %-T7-T96U&=6QL3F%M90 #@ % ! & \" ( "
+ " !0 @ ! 0 $ !0 $ < ! !P $9I;'1E<@ #@ @! & \" ( !0 @ "
+ "! 0 $ !0 $ L ! (0 %-T 8 ( @ % "
+ " \" $ ! 0 % 0 !P $ ' 4W1R:6YG . , 8 ( ! % \" "
+ " 0 0 X P !@ @ ) @ 4 ( 0 $ ! ( 0 #@ #@ & "
+ "\" 8 !0 @ ! 0 $ \"0 @ X P !@ @ $ 4 ( "
+ " ! ! #@ (@% & \" ( !0 @ ! 0 $ !0 $ < ! ("
+ "P '1R9653 !T0 $QO9V=E<@ %1O;&5R86YC94-O;G1R;VQL960 &9I;F1F;75M971H;V0 "
+ " $-O4VEM=6QA=&EO;@ %-A=F5#:&%N9V53970 $9-50 $)I9TUO9&5L "
+ " X P !@ @ & 4 ( ! D #@ # & \" "
+ " 8 !0 @ $ \"0 . B 8 ( @ % \" $ ! 0"
+ " % 0 \"@ $ * 4W1R3&5N9W1H X X !@ @ & 4 ( 0 $ ! "
+ " D ( \" 1D . B 8 ( @ % \" $ ! 0 % 0 \"@ $ * 4W"
+ "1R3&5N9W1H X X !@ @ & 4 ( 0 $ ! D ( \" 1D . 2 0"
+ " 8 ( @ % \" $ ! 0 % 0 \"P $ 6 ;F)R;V9P;W)T7!E !N86UE
D 8 ( @ % \" $ ! 0 % 0 #@ $ J ;F)R;V9P;W)T
%]I=&5R X P "
+ " !@ @ $ 4 ( 0 , ! ! P Q,# #@ #@ & \" 8 !0 @ ! "
+ " 0 $ \"0 @ (!#0 X X !@ @ & 4 ( 0 $ ! D ( "
+ " . 2 8 ( ! % \" $ 3 0 0 $P %]N;&5?2YI;0 #@ # & "
+ " \" 0 !0 @ ! 0 $ $ ! # . . 8 ( !@ % \" $ ! "
+ " 0 ) \" 0%% #@ #@ & \" 8 !0 @ ! 0 $ \"0 @ "
+ " X !( !@ @ $ 4 ( 0 !, ! ! 3 8V]N2YR90 "
+ " #@ # & \" 0 !0 @ ! 0 $ $ ! # . . 8 ( !@ % "
+ " \" $ ! 0 ) \" @%% #@ #@ & \" 8 !0 @ ! 0 $ "
+ " \"0 @ X !( !@ @ $ 4 ( 0 !$ ! ! 1 8V]N&%M<&QE7-T96US7T5X86UP;&5S7W1R86YS9F]R;6"
+ "5D24\\R+F1L; . F 8 ( ! % \" $ !D 0 0 9 $,Z7%5S97)S7%1)3E)!0GXQ7$"
+ "%P<$1A=&%<3&]C86Q<5&5M<%QF;75<='!D931F9C(X,U]A8SAD7S1C.3=?.&-D9E\\S9#EB-V1F9C,U-F%<;6]D96Q$97-C ( '@\" \"P "
+ "P ^ 0 & % $9-23%5=&EL &9M:71O;VQB;W@N8FQO8VMS &9I9W5R94AA;F1L90!I
+
+Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+Francisco Gomez-Lopez
+
+The authors can be contacted by email: luigiv at kth dot se
+
+This file is part of Rapid Parameter Identification ("RaPId") .
+
+RaPId is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+RaPId is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with RaPId. If not, see .
+
diff --git a/Sources/core/RaPIdClass.m b/Sources/core/RaPIdClass.m
new file mode 100644
index 0000000..b292c87
--- /dev/null
+++ b/Sources/core/RaPIdClass.m
@@ -0,0 +1,121 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+classdef RaPIdClass
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other ] = cg_algo(RaPIdObject)
+%CG_ALGO applying fminunc to compute the minimum of the objective function
+%defined by the parameter identification problem settings must contain the
+%fields:
+% - settings.p0, initial guess for the vector of parameters
+% - settings.cgOptions, string containing a command providing the
+% optimset for the matlab function fminunc, can please refer to the
+% doc fminunc
+options = eval(RaPIdObject.cgOptions);
+sol = fminunc(@func,RaPIdObject.experimentSettings.p_0,options);
+other = [];
+end
\ No newline at end of file
diff --git a/Sources/core/algos/fmincon_algo.m b/Sources/core/algos/fmincon_algo.m
new file mode 100644
index 0000000..804bf8e
--- /dev/null
+++ b/Sources/core/algos/fmincon_algo.m
@@ -0,0 +1,46 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other] = fmincon_algo(RaPIdObject)
+%FMINCON_ALGO applying fmincon to compute the minimum of the objective
+%function defined by the parameter identification problem settings must
+%contain the fields:
+% - settings.p0, initial guess for the vector of parameters
+% - settings.p_min, vector of minimum values for all parameters;
+% - settings.p_max, vector of maximum values for all parameters;
+% - settings.fminconOptions, string representing a command setting the
+% options for the matlab function fminunc, can consist of the
+% optimset function, please refer to doc fmincon
+options = eval(RaPIdObject.fminconSettings);
+funcwrapper = @(x) func(x, RaPIdObject);
+
+if isempty(options)
+ sol = fmincon(funcwrapper,RaPIdObject.experimentSettings.p_0,[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max);
+else
+ sol = fmincon(funcwrapper,RaPIdObject.experimentSettings.p_0,[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[],options);
+end
+other = [];
+
+end
+
+
diff --git a/Sources/core/algos/gaExt_algo.m b/Sources/core/algos/gaExt_algo.m
new file mode 100644
index 0000000..84a623b
--- /dev/null
+++ b/Sources/core/algos/gaExt_algo.m
@@ -0,0 +1,55 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other] = gaExt_algo(RaPIdObject)
+%GAEXT_ALGO applying matlab ga function to compute the minimum of the
+% objective function defined by the parameter identification problem
+% settings must contain:
+% - p0, initial guess for the value of the parameter vector
+% - p_min, vector containing the minimal values of all parameters
+% - p_max, vector containing the maximal values of all parameters
+% - gaExtOptions, string containing a command providing an optimset for
+% the matlab ga function, see the doc for the ga function
+
+
+% options = psooptimset();
+% ga(@rastr,2, [],[],[],[],[], [],[],options)
+% sol = ga(@func,length(settings.p0),[],[],[],[],settings.p_min,settings.p_max);
+options = eval(RaPIdObject.gaExtOptions);
+sol = ga(@func,length(RaPIdObject.experimentSettings.p_0),[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[],options);
+other = [];
+if RaPIdObject.experimentSettings.verbose
+ part.p = RaPIdObject.experimentSettings.p_0;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.beginning =fitness;
+ part.p = sol;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.end = fitness;
+end
+end
\ No newline at end of file
diff --git a/Sources/core/algos/ga_algo.m b/Sources/core/algos/ga_algo.m
new file mode 100644
index 0000000..032200c
--- /dev/null
+++ b/Sources/core/algos/ga_algo.m
@@ -0,0 +1,56 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other ] = ga_algo(RaPIdObject)
+%GA_ALGO applying OWN_GA to compute the minimum of the objective
+%function defined by the parameter identification problem
+% settings.ga_options must contain the fields:
+% - nbCromosomes, number of chromosome (vectors of parameters) for
+% every iterations
+% - nbCroossOver1,2, number of crossover operations applied to the
+% chromosomes
+% - nbMutations, number of mutation operations applied to the
+% chromosomes
+% - nbReproduction, number of reproduction operations applied to the
+% chromosomes
+% - limit, number of iteration to the process of the Genetic
+% Algorithm
+% - fitnessStopRatio, minimal ration currentFitness/intial_Fitness,
+% if the ratio becomes lower than this real number, the algorithm
+% exits
+% - headSize1,2,3, number of chromosomes involved respectivelly in
+% the crossovers1/2 and mutations
+% - nbReinjection, number of random chromosomes that are kept alive
+% even if not performing well
+% - nRandMin, minimum of initial particles to be generated
+% randomly, restricts the number of particles to be set on a grid
+% regularly spaced out in the parameter space, see the function
+% GenerateOrganisedSwarm
+% - p0s, matrix whose rows are different initial guesses for the
+% vector of parameters
+% - storeData, boolean allowing to store all the best fitness and
+% particles at every iterations (get's big very quickly)
+[ sol, other] = own_ga(RaPIdObject,@func);
+end
+
+
diff --git a/Sources/core/algos/knitro_algo.m b/Sources/core/algos/knitro_algo.m
new file mode 100644
index 0000000..b1a0c70
--- /dev/null
+++ b/Sources/core/algos/knitro_algo.m
@@ -0,0 +1,67 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other] = knitro_algo(RaPIdObject)
+%KNITRO_ALGO applies the ktrlink function from the KNITRO toolbox to
+%compute the minimum of the objective function defined by the parameter
+%identification problem
+% settings must have as a fields:
+% - p0, vector containing an initial guess for the vector of parameters
+% - p_min, vector containing the minimal values acceptable for every
+% parameter of the parametere vector
+% - p_min, vector containing the maximal values acceptable for every
+% parameter of the parametere vector
+% - kn_options.knOptions, a string containing a command allowing the
+% specification of the optimset for the function KTRLINK, please refer to
+% the documentation of this function (can be left empty)
+% - kn_options.knOptionsFile, a string containing the path to a
+% configuration file for KTRLINK, see the doc of the so-called functions
+% for more details, needs to be left empty if not used
+% - verbose, if verbose is anything else than zero, the algorithm will
+% save some information and output it in second output argument (used for
+% debugging)
+options = eval(RaPIdObject.knitroSettings.knOptions);
+if isempty(RaPIdObject.knitroSettings.knOptionsFile)&&isempty(options)
+ sol = ktrlink(@func,RaPIdObject.experimentSettings.p_0,[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max);
+elseif isempty(RaPIdObject.knitroSettings.knOptionsFile)
+ sol = ktrlink(@func,RaPIdObject.experimentSettings.p_0,[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[],options);
+else
+ str = RaPIdObject.knitroSettings.knOptionsFile;
+ sol = ktrlink(@func,RaPIdObject.experimentSettings.p_0,[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[],options,str );
+end
+% storage of historic data
+if RaPIdObject.experimentSettings.verbose
+ part.p = RaPIdObject.experimentSettings.p_0;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.beginning =fitness;
+ part.p = sol;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.end = fitness;
+end
+end
\ No newline at end of file
diff --git a/Sources/core/algos/naive_algo.m b/Sources/core/algos/naive_algo.m
new file mode 100644
index 0000000..f1c218d
--- /dev/null
+++ b/Sources/core/algos/naive_algo.m
@@ -0,0 +1,45 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [sol,other] = naive_algo(RaPIdObject)
+%NAIVE_ALGO applies iteratively 1D gradient methods in n = card{vector of
+%parameters} perpendicular directions until a certain fitness or a number
+%of iterations is reached, the settings struct should contain:
+% - naive_options.tolerance1, minimal bound for the ratio
+% currentFitness/initialFitness, when this value is reached, the
+% algorithm stops
+% - naive_options.tolerance2, minimal bound for the ratio
+% currentFitness/initialFitness, when this value is reached, the
+% algorithm stops, second loop
+% - naive_options.iterations,2,3 number maximal of iterations for three
+% different levels of loops
+% - verbose, should be anything other than 0 only if debug info needs to
+% be displayed in console
+ [sol,other] = naive(RaPIdObject, @func);
+end
+
+
+
+
+
+
diff --git a/Sources/core/algos/nm_algo.m b/Sources/core/algos/nm_algo.m
new file mode 100644
index 0000000..0420181
--- /dev/null
+++ b/Sources/core/algos/nm_algo.m
@@ -0,0 +1,55 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other] = nm_algo(RaPIdObject)
+%NM_ALGO applies the FMINSEARCH matlab function to compute the minimum of
+%the objective function defined by the parameter identification problem.
+% settings contain the fields:
+% - p0, vector representing the initial guess for the vector of
+% parameters
+% - nmOptions, a string which, when evaluated, provides an optimset
+% to be provided to FMINSEARCH, see the documentation for the
+% aforementioned function.
+% - verbose, verbose can be anything other than 0 if debuf info is
+% needed in console
+
+options = eval(RaPIdObject.nmSettings);
+options.MaxFunEvals=RaPIdObject.experimentSettings.nbMaxIterations;
+
+[sol, other] = fminsearch(@func,RaPIdObject.experimentSettings.p_0,options);
+%other = [];
+if RaPIdObject.experimentSettings.verbose
+ part.p = RaPIdObject.experimentSettings.p_0;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.beginning =fitness;
+ part.p = sol;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.end = fitness;
+end
+end
\ No newline at end of file
diff --git a/Sources/core/algos/pf_algo.m b/Sources/core/algos/pf_algo.m
new file mode 100644
index 0000000..175219d
--- /dev/null
+++ b/Sources/core/algos/pf_algo.m
@@ -0,0 +1,39 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, historic] = pf_algo(RaPIdObject)
+%Particle Filter
+%
+% settings should include a struct field name pso_options containing:
+% - overall best position to the next sample of the speed
+% - nb_particles: number of particles in the swarm
+% - storeData, boolean allowing to store all the best fitness and
+% particles at every iterations (get's big very quickly)
+[ sol, historic] = pfNew(RaPIdObject,@func);
+end
+
+
+
+
+
+
diff --git a/Sources/core/algos/psoExt_algo.m b/Sources/core/algos/psoExt_algo.m
new file mode 100644
index 0000000..de2eca5
--- /dev/null
+++ b/Sources/core/algos/psoExt_algo.m
@@ -0,0 +1,53 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other] = psoExt_algo(RaPIdObject)
+%PSOEXT_ALGO applies PSO from the toolbox "psopt" to compute the minimum of
+%the objective function defined by the parameter identification problem
+% settings contains the fields:
+% - p0, initial guess for the vector of parameters
+% - psoExtOptions, a string which, when evaluated, gives the optimset
+% to be provided to the PSO function. Check the documentation of the
+% function PSO
+% - verbose, can be anything else than 0 if debugging information is
+% needed
+
+options = eval(RaPIdObject.psoExtSettings);
+% pso(fitnessfcn,nvars,Aineq,bineq,Aeq,beq,LB,UB,nonlcon,options)
+sol = pso(@func,length(RaPIdObject.experimentSettings.p_0),[],[],[],[],RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[],options);
+other = [];
+if RaPIdObject.experimentSettings.verbose
+ part.p = RaPIdObject.experimentSettings.p_0;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.beginning =fitness;
+ part.p = sol;
+ [simuRes] = rapid_simuSystem( part,RaPIdObject);
+ for k=1:size(simuRes,2)
+ fitness=fitness+rapid_objectiveFunction2(RaPIdObject.experimentData.realData(i_s,k),simuRes(:,k),RaPIdObject,1);
+ end
+ other.end = fitness;
+end
+end
\ No newline at end of file
diff --git a/Sources/core/algos/pso_algo.m b/Sources/core/algos/pso_algo.m
new file mode 100644
index 0000000..85aaba1
--- /dev/null
+++ b/Sources/core/algos/pso_algo.m
@@ -0,0 +1,71 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [sol, historic] = pso_algo(RaPIdObject)
+%PSO_ALGO Applies the particle swar optimisation function OWN_PSO and
+%applies it to the parameter identification problem specified.
+% Takes as argument the settings struct in which the data to be matched
+% by the parameter estimation was integrated by the function rapid.m It
+% starts by generating nb_particle particles (value set in
+% settings.pso_options). The initial particles are partly randomlu chosen
+% and partly spans the parameter space, being regularly spaced out within
+% the bounds specified by p_min and p_max the objective function is
+% evaluated at every iterations, after each has been given a speed which
+% is determined by random parameters and influenced by the position of
+% the overall best solution found and the particle personal best position
+% The function returns the historic of all the best position and best
+% fitness at every iteration of the process and the swarm at final time
+% if required.
+%
+% settings should include a struct field name pso_options containing:
+% - kick_multiplier: when the speed becomes lower than
+% norm(v_max)*kick_multiplier, v_max being the speed (computed
+% internally) which would lead the particle as far as possible
+% inside the space defined by p_min/p_max
+% - alpha1: multiplier on the contribution of the last sample of the
+% particle's speed to it's next sample
+% - alpha2: multiplier on the contribution of the distance to the
+% particle's personal best position to the next sample of
+% the speed
+% - alpha3: multiplier on the contribution of the distance to the swarm's
+% overall best position to the next sample of the speed
+% - limit: number maximal of iterations in the speeds updates
+% - fitnessStopRatio: the algorithm stops if the best fitness reaches
+% initialFitness*fitnessStopRatio
+% - nb_particles: number of particles in the swarm
+% - nRandMin, minimum of initial particles to be generated
+% randomly, restricts the number of particles to be set on a grid
+% regularly spaced out in the parameter space, see function
+% generateOrganisedSwarm
+% - p0s, matrix whose rows are different initial guesses for the
+% vector of parameters
+% - storeData, boolean allowing to store all the best fitness and
+% particles at every iterations (get's big very quickly)
+[ sol, historic] = own_pso(RaPIdObject,@func);
+end
+
+
+
+
+
+
diff --git a/Sources/core/functions/algoFunctions/Icon b/Sources/core/functions/algoFunctions/Icon
new file mode 100644
index 0000000..e69de29
diff --git a/Sources/core/functions/algoFunctions/chromosome.m b/Sources/core/functions/algoFunctions/chromosome.m
new file mode 100644
index 0000000..6d29768
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/chromosome.m
@@ -0,0 +1,186 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+classdef chromosome < matlab.mixin.Copyable
+ %CHROMOSOME Class representing a chromosome, entity of the parameter
+ % space.
+ % The chromosome is characterised by genes (parameters) and is able to
+ % organise crossovers with other chromosomes or to undergo a mutation
+ % attributes:
+ % p_min,p_max: limit the search path, must be defined in
+ % settings.p_mxx
+ % p: position of the particle, i.e. vector of parameters
+ % fitness: objective function evaluated at position p
+ properties
+ p_min = 0;
+ p_max = 0;
+ p = 0;
+ n = 0;
+ fitness = Inf; % how good it is with regard with the cost function (0 is ideal)
+ end
+
+ methods
+ %% Constructors
+ % constructor generating the initial position randomly
+ function obj = chromosome(pmin,pmax,p, varargin)
+ if nargin ==0
+ % Allow initalization of chromosome-arrays
+ else
+ if nargin == 3
+ N=1;
+ else
+ N=varargin{1};
+ pN=length(p);
+ end
+ obj(N) = chromosome;
+ assert(isempty(p) || iscell(p),'Starting position must be given as cell-array')
+ assert(length(pmax) == length(pmin),'wrong size for pmin or pmax');
+ for ii=1:N
+ obj(ii).p_min = pmin;
+ obj(ii).p_max = pmax;
+ obj(ii).n = length(pmin);
+ if isempty(p)
+ obj(ii).p = (obj(ii).p_max - obj(ii).p_min).*rand(obj(ii).n,1)' + obj(ii).p_min;
+ else
+ if ii<=pN
+ obj(ii).p = p{ii};
+ else
+ obj(ii).p = (obj(ii).p_max - obj(ii).p_min).*rand(obj(ii).n,1)' + obj(ii).p_min;
+ end
+ end
+ end
+ end
+ end
+
+% % constructor receiving the initial position
+% function obj = chromosome2(pm,pM,pos,verbose)
+% if length(pM) ~= length(pm)
+% throw('wrong size for pM or pm');
+% end
+% obj.p_min = pm;
+% obj.p_max = pM;
+% obj.n = length(pm);
+% obj.p = pos;
+% end
+% Sort
+ function [obj,idx]=sort(obj,varargin)
+ %sort object array with respect to 'Fitness' property
+ [~,idx]=sort([obj.fitness],varargin{:});
+ obj=obj(idx);
+ end
+ %% Mutation
+ % One gene is chosen randomly and changed with a truncated normal
+ % distribution of variance decreasing with the iterations
+ % (power 5 chosen arbitrarily, could be parametrised)
+ function [obj, out_indices] = mutate(obj,nbMutations,n_iter,n_final)
+ nObjplus1=length(obj)+1;
+ for ii=1:nbMutations
+ chromosomeIndex=randperm(nObjplus1-2+ii,1);
+ [obj, mutatedChromosomeIndex]=obj.duplicateChromosome(chromosomeIndex);
+ % index = ceil(obj.n*rand(1,1));
+ geneIndex=randi([1 obj(1).n]);
+ pp = inf;
+ while pp>obj(mutatedChromosomeIndex).p_max(geneIndex) || pp
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [prob] = gaussianKernelProbability(particle, survivedParticles, sigma)
+
+prob = 1;
+
+for i=1:size(survivedParticles,1)
+ diff = survivedParticles(i,:)-particle;
+ sq_diff = diff*diff';
+ prob = prob * exp(-sq_diff/(2*sigma^2));
+end
diff --git a/Sources/core/functions/algoFunctions/generateOrganisedSwarm.m b/Sources/core/functions/algoFunctions/generateOrganisedSwarm.m
new file mode 100644
index 0000000..c501fa9
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/generateOrganisedSwarm.m
@@ -0,0 +1,57 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function list = generateOrganisedSwarm( nbParticles, nminRand,p_min,p_max,p0s )
+%GENERATEORGANISEDSWARM Create a list of particles to be given to the
+%constructor of chromosome or particle (depends on the algorithm in use)
+% nbParticles: number total of particles to be created
+% nminRand: number minimal of particles that will have to be generated
+% randomly
+% p0s: particles that have to be in the list (they might come from
+% computations performed in other methods for example)
+% this means that we'll try to generate a grid of nbParticles - nminRand -p0s
+% regularly spaced particles in the parameter space
+% we'll try to have a "cubical grid", that is to say, the discretisation
+% of space will be the same on orthogonal directions (there are as
+% many points to the grid between p_min(1) and p_max(1) as between p_min(i)
+% and p_max(i))
+%
+list = {p0s};
+n_a = floor(((nbParticles - nminRand)-size(p0s,1))^(1/length(p_min)));
+if n_a > 1
+ for i = 1:length(p_min)
+ t{i} = p_min(i):(p_max(i)-p_min(i))/(n_a-1):p_max(i);
+ end
+
+ bulk = t{end}';
+ for k = length(t)-1:-1:1
+ bulk2 = [];
+ for j = 1:n_a
+ bulk2 = [bulk2;t{k}(j)*ones(n_a^(length(t)-k),1) bulk];
+ end
+ bulk = bulk2;
+ end
+ rndMat = rand(nbParticles-size(p0s,1)-n_a^length(p_min),length(p_min));
+ list = {p0s;bulk};%;rndMat.*repmat((p_max-p_min),size(rndMat,1),1) + repmat(p_min,size(rndMat,1),1)
+end
+end
diff --git a/Sources/core/functions/algoFunctions/generateRandomParticle.m b/Sources/core/functions/algoFunctions/generateRandomParticle.m
new file mode 100644
index 0000000..55ecddf
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/generateRandomParticle.m
@@ -0,0 +1,27 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [particle] = generateRandomParticle(min_value, max_value)
+
+particle = unifrnd(min_value, max_value);
+end
\ No newline at end of file
diff --git a/Sources/core/functions/algoFunctions/insertAtPosition.m b/Sources/core/functions/algoFunctions/insertAtPosition.m
new file mode 100644
index 0000000..a364b53
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/insertAtPosition.m
@@ -0,0 +1,47 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ list, cell ] = insertAtPosition( list, cell, index )
+%INSERTATPOSITION insert the index of the element number index at the
+% correct position in a list ordering the chromosomes by increasing fitness
+% /!\ to test more thoroughly...
+% list, list already existant of sorted particles
+% cell, struct containing the whole mass of particles
+% index, index in the cell of the particle we would like to add to the
+% list
+if isempty(list)
+ list = index;
+else
+ for i = 1:length(list)
+ if cell{list(i)}.fitness >= cell{index}.fitness
+ list = [list(1:i-1) index list(i:end)];
+ break;
+ end
+ if i == length(list)
+ list = [list index];
+ end
+ end
+end
+
+end
+
diff --git a/Sources/core/functions/algoFunctions/naive.m b/Sources/core/functions/algoFunctions/naive.m
new file mode 100644
index 0000000..cf701b7
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/naive.m
@@ -0,0 +1,108 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [sol,other] = naive(RaPIdObject,func)
+%NAIVE applies iteratively 1D gradient methods in n = card{vector of
+%parameters} perpendicular directions until a certain fitness or a number
+%of iterations is reached, the settings struct should contain:
+% - naive_options.tolerance1, minimal bound for the ratio
+% currentFitness/initialFitness, when this value is reached, the
+% algorithm stops
+% - naive_options.tolerance2, minimal bound for the ratio
+% currentFitness/initialFitness, when this value is reached, the
+% algorithm stops, second loop
+% - naive_options.iterations,2,3 number maximal of iterations for three
+% different levels of loops
+% - verbose, should be anything other than 0 only if debug info needs to
+% be displayed in console
+other = [];
+
+%NAIVE_ALGO
+part = particle(RaPIdObject.experimentSettings.p_0,RaPIdObject.experimentSettings.p_0,RaPIdObject.experimentSettings.p_0);
+part.p = RaPIdObject.experimentSettings.p_0;
+part.fitness = func(part.p,RaPIdObject);
+verbose=RaPIdObject.experimentSettings.verbose;
+% while abs(initialFitness - particle.fitness) > settings.tolerance1
+for k=1:RaPIdObject.naiveSettings.iterations3
+ noSolutionYet = true;
+ while noSolutionYet
+ A=rand(length(part.p));
+
+ B=A'*A ;
+ [P,D] = eig(B); % P's columns are an orthonormal basis of the particle space
+ if ((P'*P - eye(length(part.p)))>eps)
+ % error, some vectors are not orthonormal, repeat the random matrix draw again
+ else
+ noSolutionYet = false;
+ end
+ P = eye(length(part.p));
+ end
+ % while abs(initialFitness - particle.fitness) > settings.tolerance1
+ initialFitness = part.fitness;
+ for l=1:RaPIdObject.naiveSettings.iterations2
+ if verbose
+ sprintf(strcat('outer ',int2str(l),'***************'))
+ end
+ for i = 1:length(part.p)
+
+ fitnessForVector = inf;
+ for j=1:RaPIdObject.naiveSettings.iterations
+ if verbose
+ sprintf(strcat('inner ',int2str(j)))
+ end
+ alpha = 1;
+ fitnessPos = part.fitness;
+ while alpha > RaPIdObject.naiveSettings.tolerance2
+ particle2 = part;
+ particle2.p = alpha*P(:,i)'+part.p;
+ particle2.fitness = func(particle2.p,RaPIdObject);
+ if part.fitness > particle2.fitness
+ part = particle2;
+ else
+ alpha = alpha/2;
+ end
+ end
+ alpha = -1;
+ while abs(alpha) > RaPIdObject.naiveSettings.tolerance2
+ particle2 = part;
+ particle2.p = alpha*P(:,i)'+part.p;
+ particle2.fitness = func(particle2.p,RaPIdObject);
+ if part.fitness > particle2.fitness
+ part = particle2;
+ else
+ alpha = alpha/2;
+ end
+ end
+ fitnessForVector = part.fitness;
+ end
+ end
+ end
+ % end
+ sol = part.p;
+end
+
+
+
+
+
+
diff --git a/Sources/core/functions/algoFunctions/nmoutfun.m b/Sources/core/functions/algoFunctions/nmoutfun.m
new file mode 100644
index 0000000..2b39ec4
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/nmoutfun.m
@@ -0,0 +1,33 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function stop = nmoutfun(x, optimValues, state)
+stop = false;
+%hold on;
+if strcmp(state,'iter')
+ history(1,end+1)=optimValues.funcCount;
+ history(2,end)=optimValues.fval;
+ stairs(history(1,:),history(2,:));
+ drawnow
+end
+end
\ No newline at end of file
diff --git a/Sources/core/functions/algoFunctions/own_ga.m b/Sources/core/functions/algoFunctions/own_ga.m
new file mode 100644
index 0000000..ca3f7e1
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/own_ga.m
@@ -0,0 +1,138 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, other] = own_ga(RaPIdObject,func)
+%OWN_GA computes the minimum of the objective function defined by the
+%parameter identification problem gaSettings must contain the
+%fields:
+% - nbCromosomes, number of chromosome (vectors of parameters) for
+% every iterations
+% - nbCroossOver1,2, number of crossover operations applied to the
+% chromosomes
+% - nbMutations, number of mutation operations applied to the
+% chromosomes
+% - nbReproduction, number of reproduction operations applied to the
+% chromosomes
+% - limit, number of iteration to the process of the Genetic
+% Algorithm
+% - fitnessStopRatio, minimal ration currentFitness/intial_Fitness,
+% if the ratio becomes lower than this real number, the algorithm
+% exits
+% - headSize1,2,3, number of chromosomes involved respectivelly in
+% the crossovers1/2 and mutations
+% - nbReinjection, number of random chromosomes that are kept alive
+% even if not performing well
+% - nRandMin, minimum of initial particles to be generated
+% randomly, restricts the number of particles to be set on a grid
+% regularly spaced out in the parameter space, see the function
+% GenerateOrganisedSwarm
+% - p0s, matrix whose rows are different initial guesses for the
+% vector of parameters
+% - saveHist, boolean allowing to store all the best fitness and
+% particles at every iterations (get's big very quickly)
+global nbIterations
+nbIterations=0;
+
+% fetch parameters of the ga algorithm
+
+gaSettings=RaPIdObject.gaSettings;
+saveHist=RaPIdObject.experimentSettings.saveHist;
+nbCromosomes = gaSettings.nbCromosomes;
+nbCroossOver1 = gaSettings.nbCroossOver1;
+nbCroossOver2 = gaSettings.nbCroossOver2;
+nbMutations = gaSettings.nbMutations;
+nbReproduction = gaSettings.nbReproduction;
+headSize1 = gaSettings.headSize1;
+headSize2 = gaSettings.headSize2;
+headSize3 = gaSettings.headSize3;
+limit = RaPIdObject.experimentSettings.maxIterations; % hundred iterations, chosen randomly, the terminal condition should be better
+best = 1e66;
+bestP = [];
+verbose=RaPIdObject.experimentSettings.verbose;
+T=ChromosomeArray(nbCromosomes+2*(nbCroossOver1+nbCroossOver2)+nbMutations);
+% creating the cell through initialisation of chromosomes
+% should also include a grid and an initial guess just like for pso
+list = generateOrganisedSwarm(nbCromosomes, gaSettings.nRandMin,RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,RaPIdObject.experimentSettings.p_0);
+for k=1:length(list)
+ T.createChromosome(RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,list{k});
+end
+for k=1:nbCromosomes-length(list)
+ T.createChromosome(RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[]);
+end
+
+%% compute the fitness of every generated chromosome
+for k = T.pointerToLastOldChromosome+1:T.pointerToNewChromosome-1
+ % debug info display
+ if verbose&&mod(k,10) == 0
+ sprintf(strcat('iteration ',int2str(k),' in ga initialisation'));
+ end
+ fitness = func(T.ChromosomeList(k).p, RaPIdObject);
+ T.ChromosomeList(k).fitness = fitness;
+end
+T.pointerToLastOldChromosome=k;
+sort(T,'ascend');
+best = T.ChromosomeList(1).fitness;
+bestP = T.ChromosomeList(1).p;
+%% Body
+iteration = 0;
+
+while iteration < limit %%&& best(end) > best_i*gaSettings.fitnessStopRatio
+ % debug info display
+ if verbose&&mod(iteration,10) == 0
+ sprintf(strcat('iteration ',int2str(iteration),' in ga body'));
+ end
+ T.doCrossOverType1(nbCroossOver1); % Check that this is correct wrt headSize1!!! Can be mistake in original code aswell
+ for k=T.pointerToLastOldChromosome+1:T.pointerToNewChromosome-1
+ T.ChromosomeList(k).fitness=func(T.ChromosomeList(k).p,RaPIdObject);
+ end
+ T.pointerToLastOldChromosome=k;
+ T.doCrossOverType2(nbCroossOver2); % Check that this is correct wrt headSize2!!! Can be mistake in original code aswell
+ for k=T.pointerToLastOldChromosome+1:T.pointerToNewChromosome-1
+ T.ChromosomeList(k).fitness=func(T.ChromosomeList(k).p,RaPIdObject);
+ end
+ T.pointerToLastOldChromosome=k;
+ T.mutateRandomChromosomes(nbCroossOver2, iteration, limit);% Check that this is correct wrt headSize3!!! Can be mistake in original code aswell
+ for k=T.pointerToLastOldChromosome+1:T.pointerToNewChromosome-1
+ T.ChromosomeList(k).fitness=func(T.ChromosomeList(k).p,RaPIdObject);
+ end
+ T.pointerToLastOldChromosome=k;
+ sort(T.ChromosomeList,'ascend');
+ %% Evolution: who survives to this round
+ T.survivalOfTheFittest(nbCromosomes);
+ iteration = iteration + 1;
+ disp(['i = ' num2str(iteration) '. Best parameters: ' num2str(bestP(1,:)) ' with fitness = ' num2str(best)])
+ if saveHist
+ best = [best;T.ChromosomeList(1).fitness];
+ bestP = [bestP;T.ChromosomeList(1).p];
+ else
+ best = T.ChromosomeList(1).fitness;
+ bestP = T.ChromosomeList(1).p;
+ end
+end
+sol = bestP;
+other.fitness = best;
+other.chromosome = T.ChromosomeList;
+delete(T);
+end
+
+
diff --git a/Sources/core/functions/algoFunctions/own_pf.m b/Sources/core/functions/algoFunctions/own_pf.m
new file mode 100644
index 0000000..9bbd455
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/own_pf.m
@@ -0,0 +1,153 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+% function pf_track(Z,X,VERBOSE)
+% Performs the particle filter tracking
+% Inputs:
+% Z: 2xK
+% X: 2xK
+% VERBOSE: 1x1
+% VERBOSE \in {0: no visual output, 1: information about end resutls, 2: shows particles}
+function [ sol, historic,settings] = own_pf(settings,func) % excluded VERBOSE
+%Parameter Initialization
+%if nargin < 3; VERBOSE = 2; end;
+%params.state_space_dimension = 3; % substitute with number of parameters
+%params.Sigma_Q = diag([100 100]); % measurement noise covariance matrix
+%params.M = 1000;
+%settings.nbParticles=1000;
+%params.motion_type = 2; %0=fixed, 1=linear, 2=circular
+%params.v_0 = 2*pi*200/688;
+%params.theta_0 = 0;
+%params.omega_0 = 2*pi/688;
+%params.state_space_bound = [640;480];
+params.thresh_avg_likelihood = 0.0001; % to add into settings
+RESAMPLE_METHOD = 1; % 0=vanilla resampling, 1=systematic resampling; % to add into settings
+%switch params.state_space_dimension
+ % case 2
+ % params.Sigma_R = diag([2 2]); % process noise covariance matrix
+ % if params.omega_0; error('2D state space can not use omega_0'); end;
+ % case 3
+ params.Sigma_R = diag([2 2 0.01]);
+%end
+dt = 1;
+%%
+% Variable Initialization
+%close all;
+% Initialise the particle space
+list = generateOrganisedSwarm( settings.pf_options.nb_particles, settings.pf_options.nRandMin,settings.p_min,settings.p_max,settings.pf_options.p0s);
+
+% S.X = [rand(1, params.M)*params.state_space_bound(1); % sampling uniformly from the state space
+% rand(1, params.M)*params.state_space_bound(2)];
+% if params.state_space_dimension > 2
+% S.X = [S.X;rand(1, params.M)*2*pi - pi];
+% end
+
+S.W = 1/params.M * ones(1,params.M); % initialize equal weights
+%K = size(Z,2); % number of observations
+%mean_S = zeros(2,K);
+%figure(1);
+%clf;
+%%
+% Particle Filter Algorithm
+for i = 1 : K %end when
+ %S_bar = pf_predict(S,params,dt); % the same role as parameters given to func to produce the fitness per each particle
+ %z = Z(:,i); % measurements
+
+ S_bar = pf_weight(S_bar,z,params); % also in the func
+ switch RESAMPLE_METHOD
+ case 0
+ S = multinomial_resample(S_bar);
+ case 1
+ S = systematic_resample(S_bar);
+ end
+ mean_S(:,i) = mean(S.X(1:2,:),2); % compute the center of the distribution
+% if VERBOSE > 1
+ plot(Z(1,i),Z(2,i),'rx','MarkerSize',10);
+ hold on;
+ plot(X(1,i),X(2,i),'go','MarkerSize',20);
+ plot(S.X(1,:),S.X(2,:),'b.');
+ hold off;
+ axis([0 640 0 480]);
+ title(sprintf('timestep %d of %d',i,K));
+ drawnow;
+% end
+end
+%%
+% Analyzing the estimates
+err_z = sqrt(sum((Z - X).^2,1));
+err_xhat = sqrt(sum((X - mean_S).^2,1));
+merr_z = mean(err_z);
+merr_xhat = mean(err_xhat);
+stderr_z = std(err_z);
+stderr_xhat = std(err_xhat);
+format compact;
+display(sprintf('absolute error analysis: measurements: %0.1f +- %0.1f, estimates: %0.1f +- %0.1f',merr_z,stderr_z, merr_xhat,stderr_xhat));
+% if VERBOSE
+ figure(3);
+ clf;
+ plot(err_z,'r-');
+ hold on;
+ plot(err_xhat,'b-');
+ title(sprintf('absolute error analysis: measurements: %0.1f \\pm %0.1f, estimates: %0.1f \\pm %0.1f',merr_z,stderr_z, merr_xhat,stderr_xhat));
+% if VERBOSE > 1
+% figure(2);
+% visualize_vision_data(Z,X,mean_S);
+% end
+% end
+end
+
+% function S = multinomial_resample(S_bar)
+% Inputs:
+% S_bar(t): structure
+% Outputs:
+% S(t): structure
+function S = multinomial_resample(S_bar)
+cdf = cumsum(S_bar.W);
+M = size(S_bar.X,2);
+S.X = zeros(size(S_bar.X));
+for m = 1 : M
+ r_m = rand;
+ i = find(cdf >= r_m,1,'first');
+ S.X(:,m) = S_bar.X(:,i);
+end
+S.W = 1/M*ones(size(S_bar.W));
+end
+
+% function S = systematic_resample(S_bar)
+% This function performs systematic re-sampling
+% Inputs:
+% S_bar(t): structure
+% Outputs:
+% S(t): structure
+function S = systematic_resample(S_bar)
+cdf = cumsum(S_bar.W);
+M = size(S_bar.X,2);
+S.X = zeros(size(S_bar.X));
+r_0 = rand / M;
+for m = 1 : M
+ i = find(cdf >= r_0,1,'first');
+ S.X(:,m) = S_bar.X(:,i);
+ r_0 = r_0 + 1/M;
+end
+S.W = 1/M*ones(size(S_bar.W));
+end
\ No newline at end of file
diff --git a/Sources/core/functions/algoFunctions/own_pso.m b/Sources/core/functions/algoFunctions/own_pso.m
new file mode 100644
index 0000000..dceddf4
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/own_pso.m
@@ -0,0 +1,168 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [sol, historic] = own_pso(RaPIdObject,func)
+%OWN_PSO Applies the particle swar optimisation function OWN_PSO and
+%applies it to the parameter identification problem specified.
+% Takes as argument the settings struct in which the data to be matched
+% by the parameter estimation was integrated by the function rapid.m It
+% starts by generating nb_particle particles (value set in
+% settings.pso_options). The initial particles are partly randomlu chosen
+% and partly spans the parameter space, being regularly spaced out within
+% the bounds specified by p_min and p_max the objective function is
+% evaluated at every iterations, after each has been given a speed which
+% is determined by random parameters and influenced by the position of
+% the overall best solution found and the particle personal best position
+% The function returns the historic of all the best position and best
+% fitness at every iteration of the process and the swarm at final time
+% if required.
+%
+% settings should include a struct field name pso_options containing:
+% - kick_multiplier: when the speed becomes lower than
+% norm(v_max)*kick_multiplier, v_max being the speed (computed
+% internally) which would lead the particle as far as possible
+% inside the space defined by p_min/p_max
+% - alpha1: multiplier on the contribution of the last sample of the
+% particle's speed to it's next sample
+% - alpha2: multiplier on the contribution of the distance to the
+% particle's personal best position to the next sample of
+% the speed
+% - alpha3: multiplier on the contribution of the distance to the swarm's
+% overall best position to the next sample of the speed
+% - limit: number maximal of iterations in the speeds updates
+% - fitnessStopRatio: the algorithm stops if the best fitness reaches
+% initialFitness*fitnessStopRatio
+% - nb_particles: number of particles in the swarm
+% - nRandMin, minimum of initial particles to be generated
+% randomly, restricts the number of particles to be set on a grid
+% regularly spaced out in the parameter space, see function
+% generateOrganisedSwarm
+% - p0s, matrix whose rows are different initial guesses for the
+% vector of parameters
+% - saveHist, boolean allowing to store all the best fitness and
+% particles at every iterations (get's big very quickly)
+
+global nbIterations
+nbIterations=0;
+alpha1 = RaPIdObject.psoSettings.alpha1;
+alpha2 = RaPIdObject.psoSettings.alpha2;
+alpha3 = RaPIdObject.psoSettings.alpha3;
+limit = RaPIdObject.experimentSettings.maxIterations;
+best = 1e66;
+bestP = [];
+
+best = func(RaPIdObject.experimentSettings.p_0, RaPIdObject);
+bestP=RaPIdObject.experimentSettings.p_0;
+fit_store=[0;best];
+%% Init the swarm: give positions to all particles
+list = generateOrganisedSwarm( RaPIdObject.psoSettings.nb_particles, RaPIdObject.psoSettings.nRandMin,RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,RaPIdObject.experimentSettings.p_0);
+for i = 1:size(list,1)
+ swarm{i} = particle(RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,list{i});
+end
+for i = size(list,1)+1:RaPIdObject.psoSettings.nb_particles
+ swarm{i} = particle(RaPIdObject.experimentSettings.p_min,RaPIdObject.experimentSettings.p_max,[]);
+end
+% we should modify this to include the possibility of having a grid along
+% with the randomly drawn particles
+iteration = 2;
+%% init the algorithm, set the best position and fitness to every particle
+% and to the overall best
+verbose=RaPIdObject.experimentSettings.verbose;
+for i = 1:length(swarm)
+ % debug info display
+ if verbose&&mod(i,10)==0
+ sprintf(strcat('init particle ',int2str(i),' in pso'));
+ end
+ fitness = func(swarm{i}.p, RaPIdObject);
+ swarm{i} = swarm{i}.setBest(fitness);
+ if fitness < best
+ best = fitness;
+ bestP = swarm{i}.p;
+ fit_store(1,1)=1;
+ fit_store(2,1)=fitness;
+ end
+end
+best_H = [best];
+bestP_H = [bestP];
+disp(['i = 1. Best parameters: ' num2str(bestP) ' with fitness = ' num2str(best)])
+worst_pointer=1;
+%% Algorithm's body
+% speed update loop
+while iteration <= limit&&best_H(end) >= best_H(worst_pointer)*RaPIdObject.psoSettings.fitnessStopRatio
+ % debug info display
+ if verbose&&mod(iteration,10) == 0
+ sprintf(strcat('iteration ',int2str(iteration),' in pso body'));
+ end
+ % loop on all the particles of the swarm
+ for i = 1:length(swarm)
+ % debug info display
+ if verbose&&mod(i,10) == 0
+ sprintf(strcat('particle ',int2str(iteration)));
+ end
+ % update of the particle's speed
+ swarm{i}.v = alpha1 * rand * swarm{i}.v + alpha2*rand(1,length(swarm{i}.p)).*(swarm{i}.bestPos - swarm{i}.p) + alpha3*rand(1,length(swarm{i}.p)).*(bestP - swarm{i}.p);
+ % kicks the particle when it's starting to get stuck (position converges)
+ if norm(swarm{i}.v) < norm(swarm{i}.v_max)*RaPIdObject.psoSettings.kick_multiplier
+ r = 2*rand(1,length(swarm{i}.p))-1;
+ swarm{i}.v = (r + swarm{i}.v)*norm(swarm{i}.v_max)/norm(r+swarm{i}.v);
+ end
+ % change the position according to the speed update and update best
+ % fitness and best position
+ swarm{i} = swarm{i}.updatePart();
+ fitness = func(swarm{i}.p, RaPIdObject);
+ if fitness < swarm{i}.bestValue
+ swarm{i}.bestPos = swarm{i}.p;
+ swarm{i}.bestValue = fitness;
+ %swarm{i}.setBest(fitness);
+ end
+ if fitness < best
+ disp(['i = ' num2str(iteration) '. Best parameters: ' num2str(swarm{i}.p) ' with fitness = ' num2str(fitness)])
+ bestP = swarm{i}.p;
+ best = fitness;
+ fit_store([1,2],end+1)=[iteration*RaPIdObject.psoSettings.nb_particles + i;fitness];
+ end
+
+ end
+ iteration = iteration + 1;
+
+ if RaPIdObject.experimentSettings.saveHist
+ best_H = [best_H; best];
+ bestP_H = [bestP_H; bestP];
+ if ~isfinite(Best_H(worst_pointer))
+ worst_pointer=max(best_H(isfinite(best_H)));
+ end
+ end
+end
+if ~RaPIdObject.experimentSettings.saveHist
+ best_H=best;
+ bestP_H=bestP;
+end
+sol = bestP;
+historic.best_H = best_H;
+historic.bestP_H = bestP_H;
+historic.swarm = swarm;
+historic.fit_store=fit_store;
+end
+
+
+
diff --git a/Sources/core/functions/algoFunctions/particle.m b/Sources/core/functions/algoFunctions/particle.m
new file mode 100644
index 0000000..9d8ce02
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/particle.m
@@ -0,0 +1,116 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+classdef particle
+ %PARTICLE
+ % Class representing a particle in the parameter space
+ % The speed of the particle is given in increment (no sampling time involved)
+ % particle is characterized by its position
+ % p: position of the particle, i.e vector of parameters
+ % v: speed, give the next position
+ % p_min, p_max: vector defining the size of the parameter space,
+ % these values constrain v to a limited space
+ % bestPos, bestValue: we keep in memory a trace of where and how the
+ % particule best behaved form the first iteration
+ % positions: historic of the positions for plotting, if plot = true
+ % given through the function update, don't forget to take into account
+ % v_min and v_max before calling this function
+ % use horizontal vector everywhere
+ %
+ % Methods:
+ % updatePart: apply the speed to the particle and update the
+ % position, v needs to be redefined just before calling this
+ % function
+ % setBest: to define and reccord the bestPosition, not a part
+ % of the method updatePart since the fitness computation is
+ % exterior to the particle
+
+ properties
+ v_min = 0;
+ v_max = 0;
+ p_min = 0;
+ p_max = 0;
+ v = 0;
+ p = 0;
+ n = 0;
+ Ts = 0;
+ bestPos;
+ bestValue ;
+ plot = false;
+ positions = [];
+ fitness;
+ end
+
+ methods
+ function obj = particle(pm,pM,p)
+ if length(pM) ~= length(pm)
+ throw('wrong size for pM or pm');
+ end
+ obj.p_min = pm;
+ obj.p_max = pM;
+ obj.n = length(pm);
+ if isempty(p)
+ obj.p = (obj.p_max - obj.p_min).*rand(obj.n,1)' + obj.p_min;
+ else
+ obj.p = p;
+ end
+ obj.v_max = (obj.p_max - obj.p);
+ obj.v_min = (obj.p_min - obj.p);
+ obj.v = (obj.v_max - obj.v_min).*rand(obj.n,1)' + obj.v_min;
+ obj.plot = false;
+ end
+
+ function obj = particleV(pm,pM,verbose)
+ if length(pM) ~= length(pm)
+ throw('wrong size for pM or pm');
+ end
+ obj.p_min = pm;
+ obj.p_max = pM;
+ obj.n = length(pm);
+ obj.p = (obj.p_max - obj.p_min).*rand(obj.n,1)' + obj.p_min;
+ obj.v_max = (obj.p_max - obj.p);
+ obj.v_min = (obj.p_min - obj.p);
+ obj.v = (obj.v_max - obj.v_min).*rand(obj.n,1)' + obj.v_min;
+ obj.plot = verbose; % boolean for plotting
+ end
+
+ function obj = updatePart(obj)
+ obj.v = max(min(obj.v,obj.v_max),obj.v_min);
+ obj.p = obj.p + obj.v;
+ obj.v_max = obj.p_max - obj.p;
+ obj.v_min = obj.p_min - obj.p;
+ obj.positions = [obj.positions, obj.p'];
+
+ end
+
+ function obj = setBest(obj,value)
+ obj.bestPos = obj.p;
+ obj.bestValue = value;
+ end
+
+
+
+ end
+
+end
+
diff --git a/Sources/core/functions/algoFunctions/pfNew.m b/Sources/core/functions/algoFunctions/pfNew.m
new file mode 100644
index 0000000..ad947de
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/pfNew.m
@@ -0,0 +1,123 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [sol, historic] = pfNew(RaPIdObject,func)
+
+
+
+min_value=RaPIdObject.experimentSettings.p_min; %min_value = [0, 0];
+max_value=RaPIdObject.experimentSettings.p_max; %max_value = [2, 2];
+num_params = length(RaPIdObject.experimentSettings.p_min); %2;
+
+num_epochs = RaPIdObject.experimentSettings.maxIterations; %10;
+if isempty(RaPIdObject.pfSettings)
+ RaPIdObject.pfSettings.nb_particles=100;
+ RaPIdObject.pfSettings.prune_threshold=0.1;
+ RaPIdObject.pfSettings.kernel_sigma=1;
+
+end
+num_particles = RaPIdObject.pfSettings.nb_particles; %100;
+threshold = RaPIdObject.pfSettings.prune_threshold; %0.1;
+sigma = RaPIdObject.pfSettings.kernel_sigma; %1;
+max_tries=10000;
+
+
+if RaPIdObject.experimentSettings.saveHist
+ particles_H=zeros(num_epoch*num_particles, num_params);
+end
+
+figure_handle=figure;
+
+particles=zeros(num_particles,num_params);
+particles(1,:)=RaPIdObject.experimentSettings.p_0;
+for k=2:num_params
+ particles(:,num_params) = unifrnd(min_value(k), max_value(k), num_particles, 1);
+end
+
+% particles
+figure(figure_handle);
+plot_handle=plot(particles(:,1), particles(:,2), 'x');
+
+set(plot_handle,'YDataSource','particles(:,2)')
+set(plot_handle,'XDataSource','particles(:,1)')
+drawnow();
+refreshdata(plot_handle, 'caller')
+
+
+%Start iterating
+
+for epoch=1:num_epochs
+
+ %Weight particles
+
+ [weights,~] = pfWeighting(RaPIdObject,particles, func);
+
+ % Prune particles
+
+ surviving_inds = (weights > (min(weights) + (1-threshold)*(max(weights)-min(weights))));
+ survivedParticles = particles(surviving_inds,:);
+ survivedWeights = weights(surviving_inds);
+ num_particles_remaining=sum(surviving_inds);
+
+ % Resampling
+
+ newParticles = [survivedParticles; zeros(num_particles-num_particles_remaining,num_params)];
+ counter=0;
+ while num_particles_remaining < num_particles
+ counter=counter+1;
+ randomParticle = generateRandomParticle(min_value, max_value);
+ probParticle = gaussianKernelProbability(randomParticle, survivedParticles, sigma);
+ if isempty(survivedWeights) || (unifrnd(0, max(survivedWeights)) < probParticle) || counter >= max_tries % dont want to have infinity loops
+ num_particles_remaining=num_particles_remaining+1;
+ newParticles(num_particles_remaining,:) = randomParticle;
+ end
+ end
+
+
+
+ if RaPIdObject.experimentSettings.saveHist
+ particles_H(((epoch-1)*num_particles + 1:num_particles ),num_params) = newParticles;
+ end
+
+ particles = newParticles;
+ refreshdata(plot_handle, 'caller')
+ drawnow()
+
+end
+
+%Define the best particle
+
+[weights,fitness] = pfWeighting(RaPIdObject,particles,func);
+
+[~, I] = sort(weights, 'descend');
+
+sol=particles(I(1), :);
+%'Best particle:\n'
+disp(fitness(I(1), :));
+historic.particles_H=particles_H;
+
+end
+
+
+
+
diff --git a/Sources/core/functions/algoFunctions/pfWeighting.m b/Sources/core/functions/algoFunctions/pfWeighting.m
new file mode 100644
index 0000000..8b01ff9
--- /dev/null
+++ b/Sources/core/functions/algoFunctions/pfWeighting.m
@@ -0,0 +1,46 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [weights,fitness] = pfWeighting(RaPIdObject,particles,func)
+
+% mean = [1 1];
+% sigma = 0.6;
+% cum_sum=0;
+weights = zeros(length(particles(:,1)),1);
+fitness=zeros(length(particles(:,1)),1);
+for k=1:length(fitness)
+ fitness(k) = func(particles(k,:),RaPIdObject); % dangerous since func could possibly leave []
+% diff = particles(i,:)-mean;
+% sq_diff = diff*diff';
+% weights = [weights; 1/sqrt(2*pi*sigma^2)*exp(-sq_diff/(2*sigma^2))];
+end
+
+cum_sum=sum(fitness);
+
+for k=1:length(fitness)
+ weights(k)=1-(fitness(k)/cum_sum);
+end
+
+
+
+
\ No newline at end of file
diff --git a/Sources/core/functions/rapidFunctions/Chromosome.m b/Sources/core/functions/rapidFunctions/Chromosome.m
new file mode 100644
index 0000000..2ca81f5
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/Chromosome.m
@@ -0,0 +1,84 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+classdef Chromosome < matlab.mixin.Copyable
+ %CHROMOSOME Class representing a chromosome, entity of the parameter
+ % space.
+ % The chromosome is characterised by genes (parameters) and is able to
+ % organise crossovers with other chromosomes or to undergo a mutation
+ % attributes:
+ % p_min,p_max: limit the search path, must be defined in
+ % settings.p_mxx
+ % p: position of the particle, i.e. vector of parameters
+ % fitness: objective function evaluated at position p
+ properties
+ p_min = 0;
+ p_max = 0;
+ p = 0;
+ n = 0;
+ fitness = Inf; % how good it is with regard with the cost function (0 is ideal)
+ end
+ methods
+ %% Constructor
+ % constructor generating the initial position randomly
+ function obj = Chromosome(pmin,pmax,p, varargin)
+ if nargin ==0
+ % Allow initalization of chromosome-arrays
+ else
+ obj = Chromosome;
+ %assert(isempty(p) || iscell(p),'Starting position must be given as cell-array')
+ assert(length(pmax) == length(pmin),'wrong size for pmin or pmax');
+
+ obj.p_min = pmin;
+ obj.p_max = pmax;
+ obj.n = length(pmin);
+ if isempty(p)
+ obj.p = (obj.p_max - obj.p_min).*rand(obj.n,1)' + obj.p_min;
+ else
+ if obj.n==length(p)
+ obj.p = p;
+ else
+ obj.p = (obj.p_max - obj.p_min).*rand(obj.n,1)' + obj.p_min;
+ end
+ end
+ end
+ end
+ %% Set specified Genes
+ function genes = getGenes(obj,geneList)
+ genes = obj.p(geneList);
+ end % change its own genes
+ %% Get specified Genes
+ function obj = setGenes(obj,genesToCross,genes)
+ obj.p(genesToCross) = genes;
+ obj.fitness=Inf;
+ end
+ %% Get random Genes
+ function [genesToCross,genes] = getRandomGenes(obj)
+ nb_exchange = ceil((obj.n-1)*rand(1,1));
+ ls = randperm(obj.n);
+ genesToCross = ls(1:nb_exchange);
+ genes = obj.p(genesToCross);
+ end
+ end
+end
+
diff --git a/Sources/core/functions/rapidFunctions/ChromosomeArray.m b/Sources/core/functions/rapidFunctions/ChromosomeArray.m
new file mode 100644
index 0000000..27306e3
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/ChromosomeArray.m
@@ -0,0 +1,135 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+classdef ChromosomeArray < handle
+ properties
+ ChromosomeList=Chromosome % the main Chromosome array
+ pointerToLastOldChromosome % ptr to place for last old Chromosomes
+ pointerToNewChromosome % ptr to place for new Chromosomes
+ listOfUnfitted % unused as of now
+ end
+ methods
+ %% Constructor which create the object and pre-allocates an array of Chromosomes
+ function obj = ChromosomeArray(n) % Pre-allocate Array
+ for n=n:-1:1 % counting backwards for Memory pre-allocation
+ obj.ChromosomeList(n)=Chromosome();
+ end
+ obj.pointerToNewChromosome=1;
+ obj.pointerToLastOldChromosome=0;
+ end
+ %% Create new chromosome
+ function obj=createChromosome(obj,pmin,pmax,p) % Create actual Chromosomes
+ ii=obj.pointerToNewChromosome;
+ assert(length(pmax) == length(pmin),'wrong size for pmin or pmax');
+ obj.ChromosomeList(ii).p_min = pmin;
+ obj.ChromosomeList(ii).p_max = pmax;
+ obj.ChromosomeList(ii).n = length(pmin);
+ if isempty(p) || length(pmin) ~= length(p)
+ obj.ChromosomeList(ii).p = (pmax - pmin).*rand(obj.ChromosomeList(ii).n,1)' + pmin;
+ else
+ obj.ChromosomeList(ii).p = p;
+ end
+ obj.pointerToNewChromosome=obj.pointerToNewChromosome+1;
+ end
+ %% Sort according to fitness
+ function obj=sort(obj,varargin)
+ %sort Chromosome array with respect to 'Fitness' property
+ [~,idx]=sort([obj.ChromosomeList(1:(obj.pointerToNewChromosome-1)).fitness],varargin{:});
+ obj.ChromosomeList(1:obj.pointerToNewChromosome-1)=obj.ChromosomeList(idx);
+ end
+ %% Duplicate specified chromosomes
+ function obj=duplicateChromosome(obj, index)
+ obj.ChromosomeList(obj.pointerToNewChromosome)=copy(obj.ChromosomeList(index));
+ obj.pointerToNewChromosome=obj.pointerToNewChromosome+1;
+ end
+ %% Mutation
+ % Wherein genes are chosen randomly and changed with a truncated normal
+ % distribution of variance decreasing with the iterations
+ % (power of 5 chosen arbitrarily, could be parametrised)
+ function obj = mutateRandomChromosomes(obj,nbMutations,n_iter,n_final)
+ for ii=1:nbMutations
+ pointerToMutatingChromosome=obj.pointerToNewChromosome;
+ chromosomeIndex=randperm(pointerToMutatingChromosome-1,1);
+ obj.duplicateChromosome(chromosomeIndex);
+ geneIndex=randi([1 obj.ChromosomeList(1).n]);
+ mutatedGenes = inf;
+ while mutatedGenes>obj.ChromosomeList(pointerToMutatingChromosome).p_max(geneIndex) || mutatedGenes
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function fitness = func(p,RaPIdObject)
+%FUNC Function computing the fitness of a vector of parameter
+% p: vector of parameter to be tested
+% fitness: fitness of the vector of parameters, calculated relatively to
+% an objective function
+% see: rapid_simuSystem and rapid_objectiveFunction
+% It requires the global variable settings_ to be declared before call to
+% this function (in the toolbox this declaration is done in rapid)
+% settings should contain all the appropriate parameters
+% in this function are used the parameters relative to the simulink model
+% settings should contain:
+% - Ts, sampling time (not meaningful if variable step method is chosen)
+% - tf, final time for the simulation
+% - intMethod, integration method (solver used)
+
+global nbIterations;
+
+if ~isempty(nbIterations) && (nbIterations > RaPIdObject.experimentSettings.maxIterations)
+ %error('Toolbox stopped because we reached the max number of iteration, you can ignore the error message and continue');
+end
+switch RaPIdObject.experimentSettings.solverMode
+ case 'ODE'
+ [simuRes] = rapid_ODEsolve(p,RaPIdObject);
+ case 'Simulink'
+ [simuRes] = rapid_simuSystem(p,RaPIdObject);
+ otherwise
+ error('In "mySettings.mode": You must select either "ODE" (internal ODE-solvers) or "Simulink"');
+end
+if isempty(simuRes)
+ fitness=1e66;
+else
+ fitness=rapid_objectiveFunction(RaPIdObject.experimentData.referenceOutdata,simuRes,RaPIdObject);
+ if length(fitness) > 1
+ error('problem with fitness size')
+ end
+end
+
+end
\ No newline at end of file
diff --git a/Sources/core/functions/rapidFunctions/matlab.mat b/Sources/core/functions/rapidFunctions/matlab.mat
new file mode 100644
index 0000000..c401c70
Binary files /dev/null and b/Sources/core/functions/rapidFunctions/matlab.mat differ
diff --git a/Sources/core/functions/rapidFunctions/rapid.m b/Sources/core/functions/rapidFunctions/rapid.m
new file mode 100644
index 0000000..17e8529
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/rapid.m
@@ -0,0 +1,272 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [ sol, historic,RaPIdObject] = rapid(RaPIdObject)
+%RAPID main function of the rapid toolbox RaPId
+% the settings struct must contain the fields:
+% - realData: vector of measured output data used in the system identification
+% - realTime: vector of time instant corresponding to the measurements in
+% realData
+% - modelName: string, name of the simulink model used for
+% simulation, this model should include a FMU ME block loaded with
+% the appropriate *.fmu file and configured with the appropriate
+% outputs, and a toworkspace block saving the output data
+% - fmuOutData: cell of strings containing the names of the measured
+% output configured in the FMU ME block
+% - parameterNames: cell of strings containing the names of the paramet
+% -ers to be identified
+% - scopeName: string containing the name of the struct saving the
+% output data (from toworkspace block)
+% - blockName: string containing the name of the FMU ME block
+% - Ts: sampling time of the system
+% - tf: final time of the simulation
+% - methodName : string containing the name of the identification
+% method used, use 'pso' (particle swarm), 'ga' (genetic algo.),
+% 'naive', 'cg' (conjugate gradient), 'nm' (nelder-meade),
+% 'combi' (pso+nm)
+% - p0: initial guess for the parameter vector, used by 'fmincon'
+% 'nm' and and 'cg' methods,
+% - pso_options: struct to be used if methodName = 'pso' ga_options:
+% struct to be used if methodName = 'ga' naive_options: struct to be
+% used if methodName = 'naive' cg_options: struct to be used if
+% - methodName = 'cg' nm_options: struct to be used if methodName =
+% 'nm' gaExtOptions: struct to be used if methodName = 'gaExt'
+% - psoExtOptions: struct to be used if methodName = 'psoExt'
+% - psoExtPath: string leading to the path of the psoopt toolbox to
+% be used if and only if methodName = 'psoExt' kn_options.
+% - kn_options.path2Knitro: string leading to the path of the psoopt
+% toolbox to be used if and only if methodName = 'psoExt'
+% fmincon_options
+% - kn_options.knOptions: struct to be used if methodName = 'knitro'
+% - kn_options.knOptionsFile: string to be used if methodName = 'knitro'
+% - path2data: string containing the path to the measured output data
+% - dataT: string to evaluate once the file pointed at by path2data
+% is loaded in memory to get a row vector containing the time
+% instants at which the outputs were measured
+% - dataY: string to evaluate once the file pointed at by path2data
+% is loaded in memory to get a matrix whose row vectors are the
+% different output signals measured
+% - t0_fitness: time at which the computation of the objective
+% fonction should begin, allows the user to negates the wrong
+% initialisation of the system (for example). Should be smaller than
+% tf...
+% lastSimu: output signals from the last simulation run
+% combi_options.firstMethod: first of two methods to be used one
+% after the other
+% combi_options.firstMethod: second of two methods to be used one
+% after the other
+% p_min: min value for the parameters
+% p_max: max values for the parameters
+% intMethod: string containing the name of an integration method, can
+% be fixed or variable step method
+% path2simulinkModel: path to the simulink model in use
+% cost: int giving the type of cost, for now, 2 is quadratic
+% objective: struct describing the objective function giving the
+% fitness, this object is detailed in rapid_objectiveFunction
+% verbose: integer, for now only two levels, on off
+% %%
+% /!\ fields of settings not to fill in yourself: realData, realTime,
+% lastSimu
+% See the respective algos for few words on the parameters to provide
+% them
+
+
+
+%% Check and set the in-data to the model
+if ~isempty(RaPIdObject.experimentData.pathToInData)
+ if exist(RaPIdObject.experimentData.pathToInData,'file') % Indata exist on absolute path
+ load(RaPIdObject.experimentData.pathToInData);
+ elseif exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentData.pathToInData),'file') %File exist on relative path
+ load(fullfile(evalin('base','pwd'),RaPIdObject.experimentData.pathToInData));
+ else
+ error('In-data file could not be found! Use an empty string if no in-data should be loaded!')
+ end
+
+ try
+ timeInputT = eval(RaPIdObject.experimentData.expressionInDataTime);
+ inputT = eval(RaPIdObject.experimentData.expressionInData);
+ if isrow(timeInputT)
+ timeInputT=transpose(timeInputT);
+ end
+ if length(timeInputT) == size(inputT,1)
+ inputSignalS = [timeInputT,inputT];
+ elseif length(timeInputT) == size(inputT,2)
+ inputSignalS = [timeInputT,inputT'];
+ else
+ error('Check consistency of measured input data.');
+ end
+ RaPIdObject.experimentData.IndataMatrix=inputSignalS;
+ assignin('base','inputSignalS',inputSignalS)
+ catch err
+ disp(err.message);
+ end
+end
+
+%% Check and set the reference data which will be used for fitness-calculation
+if ~isempty(RaPIdObject.experimentData.pathToReferenceData)
+ if exist(RaPIdObject.experimentData.pathToReferenceData,'file') % Reference data file exist on absolute path
+ load(RaPIdObject.experimentData.pathToReferenceData);
+ elseif exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentData.pathToReferenceData),'file') %Reference data file exist on relative path
+ load(fullfile(evalin('base','pwd'),RaPIdObject.experimentData.pathToReferenceData));
+ else
+ error('No reference file could be found!')
+ end
+ try
+ load(RaPIdObject.experimentData.pathToReferenceData);
+ timeOutputT=eval(RaPIdObject.experimentData.expressionReferenceTime);
+ outputT=eval(RaPIdObject.experimentData.expressionReferenceData);
+ if isrow(timeOutputT)
+ timeOutputT=transpose(timeOutputT);
+ end
+ [timeOutputT, i_t]=unique(timeOutputT); % remove double time-stamps
+ outputT = outputT(i_t,:);
+ if length(timeOutputT) == size(outputT,1)
+ dataMeasuredS = [timeOutputT,outputT];
+ elseif length(timeOutputT) == size(outputT,2)
+ dataMeasuredS = [timeOutputT,transpose(outputT(:,i_t))];
+ else
+ error('Check consistency of output data.');
+ end
+ RaPIdObject.experimentData.referenceTime=dataMeasuredS(:,1);
+ RaPIdObject.experimentData.referenceOutdata=dataMeasuredS(:,2:end);
+ assignin('base','dataMeasuredS',dataMeasuredS)
+ catch err
+ disp(err.message);
+ end
+
+end
+
+%% Load FMU in either Simulink or in Matlab depending on preferred method
+switch RaPIdObject.experimentSettings.solverMode
+ case 'Simulink'
+ tmp=[];
+ if exist(RaPIdObject.experimentSettings.pathToSimulinkModel,'file')
+ tmp=RaPIdObject.experimentSettings.pathToSimulinkModel;
+ elseif ~exist(RaPIdObject.experimentSettings.pathToSimulinkModel,'file') && exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToSimulinkModel),'file')
+ tmp=fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToSimulinkModel);
+ end
+ if strcmpi(RaPIdObject.experimentSettings.displayMode, 'hide')
+ if strcmp(gcs,RaPIdObject.experimentSettings.blockName) % check if model already loaded
+ tmp_name=tempfile;
+ close_system(gcs, fullfile(pwd,tmp_name)) % save it as back-up
+ disp(strcat('Saved opened Simulink model to', fullfile(pwd,tmp_name)))
+ end
+ load_system(tmp);
+ elseif strcmp(RaPIdObject.experimentSettings.displayMode, 'show') && strcmp(gcs,RaPIdObject.experimentSettings.blockName) % check if model already loaded
+ %NOP, do nothing
+ else
+ open_system(tmp);
+ end
+
+ case 'ODE'
+ try
+ if exist(RaPIdObject.experimentSettings.pathToFmuModel,'file') % FMU exist on absolute path
+ fmu = FMUModelME1(RaPIdObject.experimentSettings.pathToFmuModel,'Loglevel','warning'); % or change to loadFMU?
+ elseif ~exist(RaPIdObject.experimentSettings.pathToFmuModel,'file') && exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToFmuModel),'file') %FMU exist on relative path
+ fmu = FMUModelME1(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToFmuModel),'Loglevel','warning'); % or change to loadFMU?
+ else
+ error('FMU file could not be found!')
+ end
+ catch err
+ if strcmp(err.message,'Failed load the FMU model. See the log for more details')
+ error('Failed to load FMU. Check that the FMU is a valid FMI 1.0 Model-Exchange FMU-file')
+ else
+ disp(err);
+ rethrow(err);
+ end
+ end
+end
+
+%% Check that fitness objective && post-processing function are OK
+if ~isfield(RaPIdObject.experimentSettings,'outputPostProcessing')
+ RaPIdObject.experimentSettings.outputPostProcessing=@(x)x; % create default function which does nothing
+end
+
+if isrow(RaPIdObject.experimentSettings.objective_weights) % should not be row
+ RaPIdObject.experimentSettings.objective_weights=transpose(RaPIdObject.experimentSettings.objective_weights);
+end
+
+%% Selecting the chosen opimtization method
+switch RaPIdObject.experimentSettings.optimizationAlgorithm
+ case 'pso'
+ [sol, historic] = pso_algo(RaPIdObject);
+ case 'ga'
+ [ sol, historic] = ga_algo(RaPIdObject);
+ case 'naive'
+ sol = naive_algo(RaPIdObject);
+ historic = [];
+ case 'cg'
+ [ sol, historic] = cg_algo(RaPIdObject);
+ case 'nm'
+ [ sol, historic ] = nm_algo(RaPIdObject);
+ case 'combi'
+ RaPIdObject.experimentSettings.methodName = RaPIdObject.combiSettings.firstMethod;
+ [sol1,historic1] = rapid( RaPIdObject);
+ RaPIdObject.experimentSettings.methodName = RaPIdObject.combiSettings.secondMetod;
+ RaPIdObject.experimentSettings.p_0 = sol1;
+ [sol,historic2] = rapid(RaPIdObject);
+ historic.sol1 = sol1;
+ historic.historic1 = historic1;
+ historic.historic2 = historic2;
+ case 'psoExt'
+ [ sol, historic] = psoExt_algo(RaPIdObject);
+ case 'gaExt'
+ [ sol, historic] = gaExt_algo(RaPIdObject);
+ case 'knitro'
+ [ sol, historic] = knitro_algo(RaPIdObject);
+ case 'fmincon'
+ [ sol, historic] = fmincon_algo(RaPIdObject);
+ case 'pfNew'
+ [ sol, historic] = pf_algo(RaPIdObject);
+ otherwise
+ errorWrongMethodName
+end
+
+%% Cleaning up after the optimization
+switch RaPIdObject.experimentSettings.solverMode
+ case 'Simulink'
+ switch RaPIdObject.experimentSettings.displayMode
+ case 'show'
+ % NOP
+ otherwise
+ close_system(RaPIdObject.experimentSettings.modelName,0)
+ end
+ case 'ODE'
+ if exist('fmu','var')
+ if fmu.isInstantiated
+ fmu.fmiFreeModelInstance;
+ end
+ delete(fmu)
+ clearvars fmu
+ RaPIdObject.fmuHandle=[];
+ end
+ clear rapid_ODEsolve
+end
+disp(sol)
+finishup = onCleanup(@(x)cleanFunc);
+
+end
+function cleanFunc(varargin)
+ clear(rapid_ODEsolve)
+ delete(timerfind('Tag', 'ODEtimeout'));
+end
\ No newline at end of file
diff --git a/Sources/core/functions/rapidFunctions/rapid_ODEsolve.m b/Sources/core/functions/rapidFunctions/rapid_ODEsolve.m
new file mode 100644
index 0000000..7bc1e99
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/rapid_ODEsolve.m
@@ -0,0 +1,124 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [res] = rapid_ODEsolve(newParameters,RaPIdObject)
+%RAPID_SIMUSYSTEM Function simulating the FMU by solving it using one of
+%the ODE solvers of Matlab.
+%
+% The settings struct must include:
+% parameterNames: cell of strings with all the names of the parameters
+% ordered in a way agreeing to the the parameter vector part.p
+%
+% blockName: string containing the name of the FMU_ME block in the
+% simulink model
+% scopeName: name of the variable created by the to workspace object
+% blockName: name of the FMUme block preceded of the simulink model name
+% and of the character "/", example: 'variable/FMUme'
+% scopeName: name of the variable created by a "To Workspace" component
+% in the simulink model. The To Workspace component must be set to
+% generate a structure with time and takes as an input a vector (from a
+% mux) containing all outputs.
+% This function should never be called, the function FUNC does all the job
+% for you
+% --------> See the help for FUNC
+persistent inputconf outconf
+
+if isempty(inputconf)
+ if isprop(RaPIdObject,'fmuInputNames') && iscell(RaPIdObject.fmuInputNames)
+ for k=1:length(RaPIdObject.fmuInputNames)
+ inputconf{k}.name=RaPIdObject.fmuInputNames{k};
+ inputconf{k}.vec=RaPIdObject.experimentData.IndataMatrix(:,[1,k+1]);
+ end
+ outconf.name=RaPIdObject.fmuOutputNames;
+ else
+ inputconf=[];
+ end
+end
+
+if exist(RaPIdObject.experimentSettings.pathToFmuModel,'file') % FMU exist on absolute path
+ fmu = FMUModelME1(RaPIdObject.experimentSettings.pathToFmuModel,'Loglevel','warning'); % or change to loadFMU?
+elseif ~exist(RaPIdObject.experimentSettings.pathToFmuModel,'file') && exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToFmuModel),'file') %FMU exist on relative path
+ fmu = FMUModelME1(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToFmuModel),'Loglevel','warning'); % or change to loadFMU?
+else
+ error('FMU file could not be found!')
+end
+
+parameterNames=RaPIdObject.parameterNames;
+maxInstantiateAttempts=1;
+timeouts=1;
+if ~fmu.isInstantiated
+ for k=1:maxInstantiateAttempts
+ try
+ fmu.fmiInstantiateModel
+ break;
+ catch err
+ %disp(err.message)
+ %pause(timeouts)
+ end
+ end
+ if ~fmu.isInstantiated
+ tmp=fmu.fmupath;
+ try
+ % clearvars('fmu');
+ pause(timeouts)
+ fmu=[];
+ fmu=FMUModelME1(tmp);
+ fmu.fmiInstantiateModel;
+ catch err
+ disp('Error while trying to create new fmu?');
+ disp(err);
+
+ end
+ end
+end
+for l = 1:length(newParameters)
+ fmu.setValue(parameterNames{l},newParameters(l));
+end
+% simulate the system, this is done in the base-workspace
+
+
+try %needs fixes!
+ apa=fmu.fmiInitialize;
+ tspan=0:RaPIdObject.experimentSettings.ts:RaPIdObject.experimentSettings.tf; % needs fixing
+ options=odeset('MaxStep',10*RaPIdObject.experimentSettings.ts,'RelTol', 1^-4 ); % just a temporary hack with ts
+ [time,res,yname]=fmu.simulate([0 RaPIdObject.experimentSettings.tf],'Output',outconf,'Input',inputconf,'Options',options,'Solver',RaPIdObject.experimentSettings.integrationMethod);
+ fmu=[];
+ if ~isempty(res)
+ res=RaPIdObject.experimentSettings.postProcessing(res); % this is a user-defined function
+ end
+ if isempty(time)
+ error('please make sure the To Workspace component in the simulink model outputs a struct with time')
+ end
+ %% Do something with res here!
+ realTime=RaPIdObject.experimentData.referenceTime;
+ res = rapid_interpolate(time,res,realTime);
+catch err
+ if ~strcmp(err.message,'Simulation timed out')
+ disp(err.message);
+ end
+ disp(err)
+ disp(err)
+ res=[];
+ return;
+end
+end
diff --git a/Sources/core/functions/rapidFunctions/rapid_interpolate.m b/Sources/core/functions/rapidFunctions/rapid_interpolate.m
new file mode 100644
index 0000000..f2bd30a
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/rapid_interpolate.m
@@ -0,0 +1,47 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function interpolatedData = rapid_interpolate(simulationTime,simulationData, referenceTime)
+%RAPID_INTERPOLATE generates an interpolation of the simulated data at the
+%instants found in the reference measurements. This allows direct comparison of the
+%measured data with the simulated data.
+%
+% Assume everything is in column form
+assert(iscolumn(simulationTime),'The time of the simulation is not a column vector.')
+assert(size(simulationData,1)==length(simulationTime),'The simulated outdata is not in column form.')
+
+interpolatedData=zeros(length(referenceTime),size(simulationData,2)); %pre-allocate
+
+for k = 1:size(simulationData,2)
+ [simulationTime,i_s] = unique(simulationTime);
+ try
+ interpolatedData(:,k)=interp1(simulationTime,simulationData(i_s,k),referenceTime)';
+ catch err
+ disp('error in interpolate, some debug info:')
+ disp(err)
+ size(referenceTime)
+ size(simulationTime)
+ rethrow(err);
+ end
+end
+end
\ No newline at end of file
diff --git a/Sources/core/functions/rapidFunctions/rapid_objectiveFunction.m b/Sources/core/functions/rapidFunctions/rapid_objectiveFunction.m
new file mode 100644
index 0000000..70f07af
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/rapid_objectiveFunction.m
@@ -0,0 +1,67 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function fitness = rapid_objectiveFunction(referenceResults,simulatedResults,RaPIdObject)
+%RAPID_OBJECTIVEFUNCTION computes a fitness according to a fitness criterion
+% realRes is data used for matching, from measurments
+% simuRes is the data we want to have matching realRes
+% the two of them are under the shape [[x[1];y[1]] [x[2];y[2]] ... [x[nStep];y[nStep]]]
+%
+% settings has to contain the fields
+% cost: integer, for quadratic cost the value is 2
+% objective: struct adapted to the method chosen
+% if cost = 2, objective contains the field:
+% vect: nb_parameters*nb_parameters weight matrix, should take
+% into account the respective outputs scaling
+% This function should never be called, the function FUNC does all the job
+% for you
+% --------> See the help for FUNC
+
+ % simuResvector = rapid_interpolate(realTime,simuTime,simuRes); % here we perform the interpolation
+ % interpolation is need since in most cases the measured output signals
+ % and the simulated output signals weren't sampled at the same sampling instants.
+ % after interpolation simuRes contains the simulated output evaluated
+ % at the same time instant as settings.realTime
+
+assert(all(size(simulatedResults)==size(referenceResults)),'The size of reference and simulation data is not the same.')
+
+delta = abs(referenceResults-simulatedResults);
+switch RaPIdObject.experimentSettings.cost_type
+ % Add your case here and set the RaPIdObject accordingly if you
+ % want to compute the fitness function differently.
+ case 1, % norm 2 error cost function
+ fitness = sum(sum(delta.*delta));
+ case 2,
+ weights = RaPIdObject.experimentSettings.objective_weights;
+ fitness=sum(sum(delta.*delta*weights));
+ otherwise
+ errorWrongCost
+end
+if (isnan(fitness))
+ disp(delta(isnan(delta.*delta)))
+ error('Something went wrong when calculating the fitness, check the vectors supplied to the objective function');
+end
+end
+
+
+
diff --git a/Sources/core/functions/rapidFunctions/rapid_simuSystem.m b/Sources/core/functions/rapidFunctions/rapid_simuSystem.m
new file mode 100644
index 0000000..0e43949
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/rapid_simuSystem.m
@@ -0,0 +1,89 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [res] = rapid_simuSystem(newParameters,RaPIdObject)
+%RAPID_SIMUSYSTEM Function simulating the simulink model using the values
+%for the parameter vector given as input
+% part: particle or chromosome, any kind of object having for field p, a
+% vector of parameters of appropriate size settings: settings struct used
+% everywhere in RaPId res: matrix whose columns are outputs of the
+% simulink model The simulink model should contain a FMI_ME block loaded
+% with the appropriate *.fmu file and with the appropriate variables
+% selected as outputs
+%
+% The settings struct must include:
+% path2simulinkModel: path to... simulink model
+% modelName: sumulink model name without ".mdl"
+% parameterNames: cell of strings with all the names of the parameters
+% ordered in a way agreeing to the the parameter vector part.p
+%
+% blockName: string containing the name of the FMU_ME block in the
+% simulink model
+% scopeName: name of the variable created by the to workspace object
+% blockName: name of the FMUme block preceded of the simulink model name
+% and of the character "/", example: 'variable/FMUme'
+% scopeName: name of the variable created by a "To Workspace" component
+% in the simulink model. The To Workspace component must be set to
+% generate a structure with time and takes as an input a vector (from a
+% mux) containing all outputs.
+% This function should never be called, the function FUNC does all the job
+% for you
+% --------> See the help for FUNC
+global nbIterations
+parameterName = RaPIdObject.parameterNames;
+for l = 1:length(newParameters)
+ fmuSetValueSimulink(RaPIdObject.experimentSettings.blockName,parameterName{l},num2str(newParameters(l))); % set FMU-block parameters
+end
+
+try
+% output=sim(settings.modelName,'SaveOutput','on','OutputSaveName','simout','StartTime','0','FixedStep',num2str(settings.Ts),'StopTime',num2str(settings.tf),'Solver',settings.intMethod,'TimeOut',10, 'LoadExternalInput', 'on','ExternalInput', '[settings.realTime settings.realData]');
+ [stuff,output]=evalc('sim(RaPIdObject.experimentSettings.modelName,''SaveOutput'',''on'',''OutputSaveName'',''simout'',''StartTime'',''0'',''FixedStep'',num2str(RaPIdObject.experimentSettings.ts),''StopTime'',num2str(RaPIdObject.experimentSettings.tf),''Solver'',RaPIdObject.experimentSettings.integrationMethod,''TimeOut'',1)');
+ if RaPIdObject.experimentSettings.verbose
+ disp(stuff);
+ end
+ tmp=get(output,'simout');
+ res=tmp.signals.values;
+ time=tmp.time;
+catch err
+ if strcmp(err.identifier,'Simulink:Commands:SimTimeExceededTimeOut')
+ res=[];
+ return;
+ elseif strcmp(err.identifier,'Simulink:SFunctions:SFcnErrorStatus')
+ res=[];
+ return;
+
+ else
+ disp(err.identifier);
+ res=[];
+ return;
+ end
+ %disp(err.message);
+ %rethrow(err);
+end
+
+if isempty(time)
+ error('Make sure the To Workspace component in the simulink model outputs a struct with time')
+end
+res = rapid_interpolate(time,res,RaPIdObject.experimentData.referenceTime);
+nbIterations = nbIterations + 1; % debug variable, how many times was the system simulated...
+end
\ No newline at end of file
diff --git a/Sources/core/functions/rapidFunctions/rapid_simuSystem2.m b/Sources/core/functions/rapidFunctions/rapid_simuSystem2.m
new file mode 100644
index 0000000..3262963
--- /dev/null
+++ b/Sources/core/functions/rapidFunctions/rapid_simuSystem2.m
@@ -0,0 +1,182 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function [res,fitness,settings] = rapid_ODEsolve( part,settings )
+%RAPID_SIMUSYSTEM Function simulating the simulink model using the values
+%for the parameter vector given as input
+% part: particle or chromosome, any kind of object having for field p, a
+% vector of parameters of appropriate size settings: settings struct used
+% everywhere in RaPId res: matrix whose columns are outputs of the
+% simulink model The simulink model should contain a FMI_ME block loaded
+% with the appropriate *.fmu file and with the appropriate variables
+% selected as outputs
+%
+% The settings struct must include:
+% path2simulinkModel: path to... simulink model
+% modelName: sumulink model name without ".mdl"
+% parameterNames: cell of strings with all the names of the parameters
+% ordered in a way agreeing to the the parameter vector part.p
+%
+% blockName: string containing the name of the FMU_ME block in the
+% simulink model
+% scopeName: name of the variable created by the to workspace object
+% blockName: name of the FMUme block preceded of the simulink model name
+% and of the character "/", example: 'variable/FMUme'
+% scopeName: name of the variable created by a "To Workspace" component
+% in the simulink model. The To Workspace component must be set to
+% generate a structure with time and takes as an input a vector (from a
+% mux) containing all outputs.
+% This function should never be called, the function FUNC does all the job
+% for you
+% --------> See the help for FUNC
+global fmu
+res=[];
+if ~fmu.isInstantiated
+ fmu.fmiInstantiateModel;
+ fmu.fmiSetDebugLogging(true)
+end
+T=timer('StartDelay',10, 'Period', 10.0,'ExecutionMode','singleShot');
+T.TimerFcn={@mycallback,T};
+cleanupObj = onCleanup(@()mycleanupfunc(T));
+for l = 1:length(part.p)
+ parameterName = settings.parameterNames(l);
+ p = part.p(l);
+ fmu.setValue(parameterName,p);
+end
+% simulate the system, this is done in the workspace of rapid.m where the
+% simulation settings were defineds
+outconf.name=settings.fmuOutData;
+try
+ start(T)
+ fmu.fmiInitialize;
+fmu.getValue(parameterName);
+tspan=[0:settings.Ts*20:settings.tf];
+options=odeset('MaxStep',settings.Ts*20,'RelTol', 1^-3 );
+time=[];
+[time,yout,yname]=fmu.simulate(tspan,'Output',outconf,'Options',options);
+stop(T)
+
+
+if isempty(time)
+ error('please make sure the To Workspace component in the simulink model outputs a struct with time')
+end
+
+res(:,1)=yout(:,1);
+res(:,2)=yout(:,2);
+res(:,3)=yout(:,3);
+res(:,4)=yout(:,4);
+res(:,5)=yout(:,5);
+res(:,6)=yout(:,6);
+res(:,7)=yout(:,7);
+res(:,8)=yout(:,8);
+
+% res(:,7)=yout(:,7).*yout(:,9)+yout(:,8).*yout(:,10);
+% res(:,8)=yout(:,8).*yout(:,9)-yout(:,7).*yout(:,10);
+
+% res(:,1)=yout(:,1).*yout(:,3)+yout(:,2).*yout(:,4);
+% res(:,2)=yout(:,2).*yout(:,3)-yout(:,1).*yout(:,4);
+% res(:,3)=sqrt(yout(:,5).^2 +yout(:,6).^2);
+% res(:,4)=sqrt(yout(:,7).^2 +yout(:,8).^2);
+
+simuTime=time';
+settings.lastSimu.res = res';
+fitness=0;
+realRes=settings.realData;
+realTime=settings.realTime;
+k = find(realTime>=settings.t0_fitness,1); % we remove the samples preceding the time t0_fitness, these first samples ain't taken into account in the computation of the fitness
+realRes = realRes(:,k:end);
+realTime = realTime(:,k:end);
+l=find(simuTime>=settings.t0_fitness,1);
+simuRes = res(:,l:end)';
+simuTime = simuTime(:,l:end);
+
+
+if (simuTime(end)= 3
+ T=varargin{3};
+ else
+ T=obj;
+ end
+ strcmp(obj.Name,T.Name)
+ nargin
+ stop(obj)
+ c=(clock);
+ if fmu.isInstantiated
+ disp([num2str(c(4)) ':' num2str(c(5)) ':' num2str(c(6)) ': Simulation timed-out?'])
+ warning('off', 'FMIT:MEX:CallfmiTerminate');
+ output=fmu.fmi_terminate();
+ disp(num2str(output))
+ warning('on', 'FMIT:MEX:CallfmiTerminate');
+ fmu.fmiFreeModelInstance;
+ fmu.fmi_error('something');
+ %error('Simulation timed out');
+ end
+end
+function mycleanupfunc(T,varargin)
+ if ~isempty(T)
+ stop(T)
+ delete(T)
+ end
+end
diff --git a/Sources/core/init/data.mat b/Sources/core/init/data.mat
new file mode 100644
index 0000000..fd6a796
Binary files /dev/null and b/Sources/core/init/data.mat differ
diff --git a/Sources/core/init/dataMeasuredS.mat b/Sources/core/init/dataMeasuredS.mat
new file mode 100644
index 0000000..e2bd004
Binary files /dev/null and b/Sources/core/init/dataMeasuredS.mat differ
diff --git a/Sources/core/init/err.mat b/Sources/core/init/err.mat
new file mode 100644
index 0000000..7570df9
Binary files /dev/null and b/Sources/core/init/err.mat differ
diff --git a/Sources/core/init/inputSignalS.mat b/Sources/core/init/inputSignalS.mat
new file mode 100644
index 0000000..51e273b
Binary files /dev/null and b/Sources/core/init/inputSignalS.mat differ
diff --git a/Sources/core/init/sol.mat b/Sources/core/init/sol.mat
new file mode 100644
index 0000000..4ece144
Binary files /dev/null and b/Sources/core/init/sol.mat differ
diff --git a/Sources/data.mat b/Sources/data.mat
new file mode 100644
index 0000000..3873888
Binary files /dev/null and b/Sources/data.mat differ
diff --git a/Sources/getPathToRapid.m b/Sources/getPathToRapid.m
new file mode 100644
index 0000000..bb72b8c
--- /dev/null
+++ b/Sources/getPathToRapid.m
@@ -0,0 +1,34 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function pathstring = getPathToRapid()
+%getPathToRapid returns the path to the root of the RaPId folder
+% Detailed explanation goes here
+tryathstring=fileparts(mfilename('fullpath'));
+
+catch
+ p err
+ disp(err.message);
+ error('Check that RaPiD is installed correctly!');
+end
+
diff --git a/Sources/gui/gaSettings.fig b/Sources/gui/gaSettings.fig
new file mode 100644
index 0000000..2a5e5c8
Binary files /dev/null and b/Sources/gui/gaSettings.fig differ
diff --git a/Sources/gui/gaSettings.m b/Sources/gui/gaSettings.m
new file mode 100644
index 0000000..9993563
--- /dev/null
+++ b/Sources/gui/gaSettings.m
@@ -0,0 +1,416 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+function varargout = gaSettings(varargin)
+% GASETTINGS MATLAB code for gaSettings.fig
+% GASETTINGS, by itself, creates a new GASETTINGS or raises the existing
+% singleton*.
+%
+% H = GASETTINGS returns the handle to a new GASETTINGS or the handle to
+% the existing singleton*.
+%
+% GASETTINGS('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in GASETTINGS.M with the given input arguments.
+%
+% GASETTINGS('Property','Value',...) creates a new GASETTINGS or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before gaSettings_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to gaSettings_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help gaSettings
+
+% Last Modified by GUIDE v2.5 22-May-2013 11:24:01
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @gaSettings_OpeningFcn, ...
+ 'gui_OutputFcn', @gaSettings_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before gaSettings is made visible.
+function gaSettings_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to gaSettings (see VARARGIN)
+
+% Choose default command line output for gaSettings
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+ga_options=RaPIdObject.gaSettings;
+try
+ set(handles.edit1,'String',ga_options.nbCromosomes);
+ set(handles.edit2,'String',ga_options.nbCroossOver1);
+ set(handles.edit3,'String',ga_options.nbCroossOver2);
+ set(handles.edit4,'String',ga_options.nbMutations);
+ set(handles.edit5,'String',ga_options.nbReproduction);
+ set(handles.edit6,'String',ga_options.limit);
+ set(handles.edit7,'String',ga_options.fitnessStopRatio);
+ set(handles.edit8,'String',ga_options.headSize1);
+ set(handles.edit9,'String',ga_options.headSize2);
+ set(handles.edit10,'String',ga_options.headSize3);
+ set(handles.edit11,'String',ga_options.nbReinjection);
+ set(handles.edit13,'String',ga_options.nRandMin);
+catch error
+ disp(error.message);
+end
+
+
+
+% UIWAIT makes gaSettings wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = gaSettings_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit6_Callback(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit6 as text
+% str2double(get(hObject,'String')) returns contents of edit6 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit7_Callback(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit7 as text
+% str2double(get(hObject,'String')) returns contents of edit7 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit7_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit8_Callback(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit8 as text
+% str2double(get(hObject,'String')) returns contents of edit8 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit8_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit9_Callback(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit9 as text
+% str2double(get(hObject,'String')) returns contents of edit9 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit9_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit10_Callback(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit10 as text
+% str2double(get(hObject,'String')) returns contents of edit10 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit10_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit11_Callback(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit11 as text
+% str2double(get(hObject,'String')) returns contents of edit11 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit11_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+ga_options.nbCromosomes = eval(get(handles.edit1,'String'));
+ga_options.nbCroossOver1 = eval(get(handles.edit2,'String'));
+ga_options.nbCroossOver2 = eval(get(handles.edit3,'String'));
+ga_options.nbMutations = eval(get(handles.edit4,'String'));
+ga_options.nbReproduction = eval(get(handles.edit5,'String'));
+ga_options.limit = eval(get(handles.edit6,'String'));
+ga_options.fitnessStopRatio = eval(get(handles.edit7,'String'));
+ga_options.headSize1 = eval(get(handles.edit8,'String'));
+ga_options.headSize2 = eval(get(handles.edit9,'String'));
+ga_options.headSize3 = eval(get(handles.edit10,'String'));
+ga_options.nbReinjection = eval(get(handles.edit11,'String'));
+ga_options.nRandMin = eval(get(handles.edit13,'String'));
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+RaPIdObject.gaSettings=ga_options;
+close(gcf)
+
+
+
+function edit13_Callback(hObject, eventdata, handles)
+% hObject handle to edit13 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit13 as text
+% str2double(get(hObject,'String')) returns contents of edit13 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit13_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit13 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
diff --git a/Sources/gui/generalSettings.fig b/Sources/gui/generalSettings.fig
new file mode 100644
index 0000000..13ef7b6
Binary files /dev/null and b/Sources/gui/generalSettings.fig differ
diff --git a/Sources/gui/generalSettings.m b/Sources/gui/generalSettings.m
new file mode 100644
index 0000000..ffcfa9a
--- /dev/null
+++ b/Sources/gui/generalSettings.m
@@ -0,0 +1,792 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = generalSettings(varargin)
+% GENERALSETTINGS MATLAB code for generalSettings.fig
+% GENERALSETTINGS, by itself, creates a new GENERALSETTINGS or raises the existing
+% singleton*.
+%
+% H = GENERALSETTINGS returns the handle to a new GENERALSETTINGS or the handle to
+% the existing singleton*.
+%
+% GENERALSETTINGS('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in GENERALSETTINGS.M with the given input arguments.
+%
+% GENERALSETTINGS('Property','Value',...) creates a new GENERALSETTINGS or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before generalSettings_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to generalSettings_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help generalSettings
+
+% Last Modified by GUIDE v2.5 09-Sep-2015 21:22:00
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @generalSettings_OpeningFcn, ...
+ 'gui_OutputFcn', @generalSettings_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before generalSettings is made visible.
+function generalSettings_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to generalSettings (see VARARGIN)
+
+% Choose default command line output for generalSettings
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+
+% UIWAIT makes generalSettings wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+set(handles.edit1,'String',RaPIdObject.experimentSettings.ts);
+set(handles.edit2,'String',RaPIdObject.experimentSettings.tf);
+set(handles.edit11,'String',RaPIdObject.experimentSettings.integrationMethod);
+set(handles.togglebutton1,'Value',RaPIdObject.experimentSettings.saveHist);
+set(handles.edit9,'String',num2str(RaPIdObject.experimentSettings.cost_type));
+dummy=cellstr(['';'']); %make sure that we have no empty cell arrays
+if ~isempty(RaPIdObject.fmuInputNames)
+ tmp1=(RaPIdObject.fmuInputNames);
+else
+ tmp1=dummy;
+end
+if ~isfield(RaPIdObject.experimentSettings,'objective') || isfield(RaPIdObject.experimentSettings.objective,'vect')
+ tmp7=num2cell(RaPIdObject.experimentSettings.objective.vect);
+else
+ tmp7=[];
+end
+maxAlloc=max([length(tmp1),length(RaPIdObject.fmuOutputNames),length(RaPIdObject.parameterNames)])+1; %allocate space for the longest vector and and an extra editable field
+dataAlloc=cell(7,maxAlloc);
+dataAlloc(1,1:length(tmp1))=tmp1;
+dataAlloc(2,1:length(RaPIdObject.fmuOutputNames))=RaPIdObject.fmuOutputNames;
+dataAlloc(3,1:length(RaPIdObject.parameterNames))=RaPIdObject.parameterNames;
+dataAlloc(4,1:length(RaPIdObject.experimentSettings.p_min))=num2cell(RaPIdObject.experimentSettings.p_min);
+dataAlloc(5,1:length(RaPIdObject.experimentSettings.p_max))=num2cell(RaPIdObject.experimentSettings.p_max);
+dataAlloc(6,1:length(RaPIdObject.experimentSettings.p_0))=num2cell(RaPIdObject.experimentSettings.p_0);
+dataAlloc(7,1:length(tmp7))=tmp7;
+set(handles.InputNames,'Data',dataAlloc);
+set(handles.InputNames,'ColumnEditable',true(ones(1,maxAlloc)));
+tmp8=cell([1,maxAlloc]);
+tmp8=cellfun(@(x){'char'},tmp8);
+set(handles.InputNames,'ColumnFormat',tmp8);
+if (get(handles.togglebutton1,'Value'))==1
+ set(handles.togglebutton1,'String','Save History: On')
+else
+ set(handles.togglebutton1,'String','Save History: Off')
+end
+if RaPIdObject.experimentSettings.verbose==1
+ tmp2=1;
+else
+ tmp2=0;
+end
+
+set(handles.verbose,'Value',tmp2);
+if (get(handles.verbose,'Value'))==1
+ set(handles.verbose,'String','Verbose: On')
+else
+ set(handles.verbose,'String','Verbose: Off')
+end
+try
+ set(handles.edit16,'String',int2str(RaPIdObject.experimentSettings.maxIterations))
+end
+try
+ set(handles.edit14,'String',mat2str(RaPIdObject.experimentSettings.objective.vect));
+end
+try
+ set(handles.edit15,'String',num2str(RaPIdObject.experimentSettings.t_fitness_start));
+end
+
+
+
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = generalSettings_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit6_Callback(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit6 as text
+% str2double(get(hObject,'String')) returns contents of edit6 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit7_Callback(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit7 as text
+% str2double(get(hObject,'String')) returns contents of edit7 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit7_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit8_Callback(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit8 as text
+% str2double(get(hObject,'String')) returns contents of edit8 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit8_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit9_Callback(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit9 as text
+% str2double(get(hObject,'String')) returns contents of edit9 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit9_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit10_Callback(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit10 as text
+% str2double(get(hObject,'String')) returns contents of edit10 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit10_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit11_Callback(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit11 as text
+% str2double(get(hObject,'String')) returns contents of edit11 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit11_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in listbox1.
+function listbox1_Callback(hObject, eventdata, handles)
+% hObject handle to listbox1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from listbox1
+
+
+% --- Executes during object creation, after setting all properties.
+function listbox1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to listbox1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: listbox controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in listbox2.
+function listbox2_Callback(hObject, eventdata, handles)
+% hObject handle to listbox2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns listbox2 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from listbox2
+
+
+% --- Executes during object creation, after setting all properties.
+function listbox2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to listbox2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: listbox controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in listbox3.
+function listbox3_Callback(hObject, eventdata, handles)
+% hObject handle to listbox3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns listbox3 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from listbox3
+
+
+% --- Executes during object creation, after setting all properties.
+function listbox3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to listbox3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: listbox controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in listbox4.
+function listbox4_Callback(hObject, eventdata, handles)
+% hObject handle to listbox4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns listbox4 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from listbox4
+
+
+% --- Executes during object creation, after setting all properties.
+function listbox4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to listbox4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: listbox controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu2.
+function popupmenu2_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu2
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu3.
+function popupmenu3_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu3 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu3
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu4.
+function popupmenu4_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu4
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu5.
+function popupmenu5_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu5
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+settings2.ts = eval(get(handles.edit1,'String'));
+settings2.tf = eval(get(handles.edit2,'String'));
+settings2.verbose = get(handles.verbose,'Value');
+settings2.cost_type = str2num(get(handles.edit9,'String'));
+settings2.integrationMethod = get(handles.edit11,'String');
+settings2.maxIterations = str2double(get(handles.edit16,'String'));
+settings2.t_fitness_start = (get(handles.edit15,'String'));
+settings2.saveHist=get(handles.togglebutton1,'Value');
+tmp=get(handles.InputNames,'Data');
+RaPIdObject.fmuInputNames = tmp(1,~cellfun(@isempty,tmp(1,:)));
+RaPIdObject.fmuOutputNames = tmp(2,~cellfun(@isempty,tmp(2,:)));
+RaPIdObject.parameterNames = tmp(3,~cellfun(@isempty,tmp(3,:)));
+settings2.p_min = cell2mat(tmp(4,~cellfun(@isempty,tmp(4,:))));
+settings2.p_max = cell2mat(tmp(5,~cellfun(@isempty,tmp(5,:))));
+settings2.p_0 = cell2mat(tmp(6,~cellfun(@isempty,tmp(6,:))));
+settings2.objective.vect = cell2mat(tmp(7,~cellfun(@isempty,tmp(7,:))));
+RaPIdObject.experimentSettings = setstructfields(RaPIdObject.experimentSettings,settings2);
+close(handles.figure1)
+
+
+
+function edit13_Callback(hObject, eventdata, handles)
+% hObject handle to edit13 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit13 as text
+% str2double(get(hObject,'String')) returns contents of edit13 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit13_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit13 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit14_Callback(hObject, eventdata, handles)
+% hObject handle to edit14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit14 as text
+% str2double(get(hObject,'String')) returns contents of edit14 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit14_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit15_Callback(hObject, eventdata, handles)
+% hObject handle to edit15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit15 as text
+% str2double(get(hObject,'String')) returns contents of edit15 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit15_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit16_Callback(hObject, eventdata, handles)
+% hObject handle to edit16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit16 as text
+% str2double(get(hObject,'String')) returns contents of edit16 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit16_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in togglebutton1.
+function togglebutton1_Callback(hObject, eventdata, handles)
+% hObject handle to togglebutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of togglebutton1
+if get(hObject,'Value')==1
+ set(hObject,'String','Save History: On')
+else
+ set(hObject,'String','Save History: Off')
+end
+
+
+
+% --- Executes on button press in verbose.
+function verbose_Callback(hObject, eventdata, handles)
+% hObject handle to verbose (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of verbose
+if get(hObject,'Value')==1
+ set(hObject,'String','Save History: On')
+else
+ set(hObject,'String','Save History: Off')
+end
+
+
+% --- Executes when entered data in editable cell(s) in InputNames.
+function InputNames_CellEditCallback(hObject, eventdata, handles)
+% hObject handle to InputNames (see GCBO)
+% eventdata structure with the following fields (see UITABLE)
+% Indices: row and column indices of the cell(s) edited
+% PreviousData: previous data for the cell(s) edited
+% EditData: string(s) entered by the user
+% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
+% Error: error string when failed to convert EditData to appropriate value for Data
+% handles structure with handles and user data (see GUIDATA)
+indices=eventdata.Indices;
+theData=get(hObject,'Data');
+% for some reason the table wants to convert to num often?? Taking care of
+% it below
+
+%if non-empty string entered
+if ~isempty(eventdata.EditData)
+ % if the line is supposed to be text
+ if any([1,2,3]==indices(1))
+ theData(indices(1),indices(2))={eventdata.EditData};
+ %expand table
+ if size(theData,2)==indices(2)
+ set(hObject,'ColumnEditable',true(ones(1,indices(2)+1)));
+ set(hObject,'Data',[theData {'';'';'';[];[];[];[]}]);
+ set(handles.InputNames,'ColumnFormat',[get(handles.InputNames,'ColumnFormat') 'char']);
+ else
+ set(hObject,'Data',theData);
+ end
+ else
+ if size(theData,2)==indices(2)
+ set(hObject,'ColumnEditable',true(ones(1,indices(2)+1)));
+ set(hObject,'Data',[theData {'';'';'';[];[];[];[]}]);
+ set(handles.InputNames,'ColumnFormat',[get(handles.InputNames,'ColumnFormat') 'char']);
+ end
+ end
+else
+ if size(theData,2)==indices(2)
+ theData{indices(1),indices(2)}=[];
+ if all(cellfun(@isempty,theData(indices(1),:)))
+ theData(:,indices(2))=[];
+ end
+ set(hObject,'ColumnEditable',true(ones(1,length(theData))));
+ else
+ theData{indices(1),indices(2)}=[];
+ end
+ set(hObject,'Data',theData);
+end
diff --git a/Sources/gui/generateFmu.fig b/Sources/gui/generateFmu.fig
new file mode 100644
index 0000000..89c825f
Binary files /dev/null and b/Sources/gui/generateFmu.fig differ
diff --git a/Sources/gui/generateFmu.m b/Sources/gui/generateFmu.m
new file mode 100644
index 0000000..3a3f3a7
--- /dev/null
+++ b/Sources/gui/generateFmu.m
@@ -0,0 +1,246 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = generateFmu(varargin)
+% GENERATEFMU MATLAB code for generateFmu.fig
+% GENERATEFMU, by itself, creates a new GENERATEFMU or raises the existing
+% singleton*.
+%
+% H = GENERATEFMU returns the handle to a new GENERATEFMU or the handle to
+% the existing singleton*.
+%
+% GENERATEFMU('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in GENERATEFMU.M with the given input arguments.
+%
+% GENERATEFMU('Property','Value',...) creates a new GENERATEFMU or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before generateFmu_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to generateFmu_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help generateFmu
+
+% Last Modified by GUIDE v2.5 10-Aug-2015 17:58:20
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @generateFmu_OpeningFcn, ...
+ 'gui_OutputFcn', @generateFmu_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before generateFmu is made visible.
+function generateFmu_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to generateFmu (see VARARGIN)
+
+% Choose default command line output for generateFmu
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+load('dataFmu');
+set(handles.edit1,'String',datafmu.edit1);
+set(handles.edit2,'String',datafmu.edit2);
+set(handles.edit4,'String',datafmu.edit4);
+
+% UIWAIT makes generateFmu wait for user response (see UIRESUME)
+% uiwait(handles.generateFMU);
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = generateFmu_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+[filename, pathname] = uigetfile('*.mo','modelica file','MultiSelect','on');
+set(handles.edit1,'String',strcat(pathname,filename));
+
+% --- Executes on button press in pushbutton2.
+function pushbutton2_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+pathname = uigetdir;
+set(handles.edit2,'String',pathname);
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton3.
+function pushbutton3_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+datafmu.edit1 = get(handles.edit1,'String');
+datafmu.edit2 = get(handles.edit2,'String');
+% data.edit3 = get(handles.edit3,'String');
+datafmu.edit4 = get(handles.edit4,'String');
+
+
+save('gui\dataFmu.mat','datafmu');
+% addpath(genpath(get(handles.edit5,'String')));
+DymolaChannel = ddeinit('dymola', ' ');
+if DymolaChannel == 0
+winopen(get(handles.edit1,'String'));
+pause(5);
+DymolaChannel = ddeinit('dymola', ' ');
+end
+
+
+% dymola(strcat('openModel(','"',get(handles.edit1,'String'),'"',')'));
+% dymola(strcat('cd("',get(handles.edit2,'String'),'")'));
+% dymola(strcat('translateModelFMU("', get(handles.edit4,'String'), '", false, "", "1", "me", false);'));
+str = get(handles.edit4,'String');
+% dymola(strcat('translateModelFMU("',str{1},'", false, "", "1", "me", false);'));
+% ddeexec(DymolaChannel, strcat('openModel(','"',get(handles.edit1,'String'),'"',')'), '', 1000000);
+ddeexec(DymolaChannel, strcat('cd("',get(handles.edit2,'String'),'")'), '', 1000000);
+ddeexec(DymolaChannel, strcat('translateModelFMU("',str{1},'", false, "", "1", "me", false);'), '', 1000000);
+evalin('base','sprintf(''%s'',''compilation of the fmu succeeded'')');
+ddeterm(DymolaChannel);
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+
+
+
diff --git a/Sources/gui/logoz.jpg b/Sources/gui/logoz.jpg
new file mode 100644
index 0000000..70a53a4
Binary files /dev/null and b/Sources/gui/logoz.jpg differ
diff --git a/Sources/gui/logoz.png b/Sources/gui/logoz.png
new file mode 100644
index 0000000..f5046e0
Binary files /dev/null and b/Sources/gui/logoz.png differ
diff --git a/Sources/gui/logoz.tiff b/Sources/gui/logoz.tiff
new file mode 100644
index 0000000..c0c456e
Binary files /dev/null and b/Sources/gui/logoz.tiff differ
diff --git a/Sources/gui/naiveSettings.fig b/Sources/gui/naiveSettings.fig
new file mode 100644
index 0000000..b788b6c
Binary files /dev/null and b/Sources/gui/naiveSettings.fig differ
diff --git a/Sources/gui/naiveSettings.m b/Sources/gui/naiveSettings.m
new file mode 100644
index 0000000..175ead1
--- /dev/null
+++ b/Sources/gui/naiveSettings.m
@@ -0,0 +1,240 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = naiveSettings(varargin)
+% NAIVESETTINGS MATLAB code for naiveSettings.fig
+% NAIVESETTINGS, by itself, creates a new NAIVESETTINGS or raises the existing
+% singleton*.
+%
+% H = NAIVESETTINGS returns the handle to a new NAIVESETTINGS or the handle to
+% the existing singleton*.
+%
+% NAIVESETTINGS('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in NAIVESETTINGS.M with the given input arguments.
+%
+% NAIVESETTINGS('Property','Value',...) creates a new NAIVESETTINGS or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before naiveSettings_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to naiveSettings_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help naiveSettings
+
+% Last Modified by GUIDE v2.5 24-Apr-2013 13:22:43
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @naiveSettings_OpeningFcn, ...
+ 'gui_OutputFcn', @naiveSettings_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before naiveSettings is made visible.
+function naiveSettings_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to naiveSettings (see VARARGIN)
+
+% Choose default command line output for naiveSettings
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+
+% UIWAIT makes naiveSettings wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+naive_options=RaPIdObject.naiveSettings;
+try
+ set(handles.edit1,'String',naive_options.tolerance1);
+ set(handles.edit2,'String',naive_options.tolerance2);
+ set(handles.edit3,'String',naive_options.iterations);
+ set(handles.edit4,'String',naive_options.iterations2);
+ set(handles.edit5,'String',naive_options.iterations3);
+end
+
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = naiveSettings_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton6.
+function pushbutton6_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+naive_options.tolerance1 = eval(get(handles.edit1,'String'));
+naive_options.tolerance2 = eval(get(handles.edit2,'String'));
+naive_options.iterations = eval(get(handles.edit3,'String'));
+naive_options.iterations2 = eval(get(handles.edit4,'String'));
+naive_options.iterations3 = eval(get(handles.edit5,'String'));
+settings2.naive_options = naive_options;
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+RaPIdObject.naiveSettings = setstructfields(RaPIdObject.naiveSettings,settings2);
+close(gcf)
diff --git a/Sources/gui/otherSettings.fig b/Sources/gui/otherSettings.fig
new file mode 100644
index 0000000..93f1408
Binary files /dev/null and b/Sources/gui/otherSettings.fig differ
diff --git a/Sources/gui/otherSettings.m b/Sources/gui/otherSettings.m
new file mode 100644
index 0000000..1994c6e
--- /dev/null
+++ b/Sources/gui/otherSettings.m
@@ -0,0 +1,461 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = otherSettings(varargin)
+% OTHERSETTINGS MATLAB code for otherSettings.fig
+% OTHERSETTINGS, by itself, creates a new OTHERSETTINGS or raises the existing
+% singleton*.
+%
+% H = OTHERSETTINGS returns the handle to a new OTHERSETTINGS or the handle to
+% the existing singleton*.
+%
+% OTHERSETTINGS('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in OTHERSETTINGS.M with the given input arguments.
+%
+% OTHERSETTINGS('Property','Value',...) creates a new OTHERSETTINGS or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before otherSettings_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to otherSettings_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help otherSettings
+
+% Last Modified by GUIDE v2.5 24-May-2013 12:05:46
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @otherSettings_OpeningFcn, ...
+ 'gui_OutputFcn', @otherSettings_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before otherSettings is made visible.
+function otherSettings_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to otherSettings (see VARARGIN)
+
+% Choose default command line output for otherSettings
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+
+% UIWAIT makes otherSettings wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+
+try
+ set(handles.edit1,'String',RaPIdObject.gaExtSettings);
+ set(handles.edit2,'String',RaPIdObject.nmSettings);
+ set(handles.edit3,'String',RaPIdObject.cgSettings);
+ %set(handles.edit4,'String',RaPIdObject.psoExtPath);
+ set(handles.edit5,'String',RaPIdObject.psoExtSettings);
+
+end
+if isprop(RaPIdObject,'knitroSettings')
+ set(handles.edit8,'String',RaPIdObject.knitroSettings.path2Knitro);
+ set(handles.edit9,'String',RaPIdObject.knitroSettings.knOptions);
+ set(handles.edit10,'String',RaPIdObject.knitroSettings.knOptionsFile);
+end
+if isprop(RaPIdObject,'fminconSettings')
+ set(handles.edit11,'String',RaPIdObject.fminconSettings);
+end
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = otherSettings_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+% --- Executes on button press in pushbutton2.
+function pushbutton2_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+RaPIdObject.gaExtSettings = get(handles.edit1,'String');
+RaPIdObject.nmSettings = get(handles.edit2,'String');
+RaPIdObject.cgSettings = get(handles.edit3,'String');
+%settings2.psoExtPath = get(handles.edit4,'String');
+RaPIdObject.psoExtSettings = get(handles.edit5,'String');
+RaPIdObject.knitroSettings.path2Knitro = get(handles.edit8,'String');
+RaPIdObject.knitroSettings.knOptions = get(handles.edit9,'String');
+RaPIdObject.knitroSettings.knOptionsFile = get(handles.edit10,'String');
+firstMethod = get(handles.popupmenu1,'String');
+RaPIdObject.combiSettings.firstMethod = firstMethod{get(handles.popupmenu1,'value')};
+secondMethod = get(handles.popupmenu2,'String');
+RaPIdObject.combiSettings.secondMetod = secondMethod{get(handles.popupmenu2,'value')};
+close(gcf)
+
+
+
+function edit6_Callback(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit6 as text
+% str2double(get(hObject,'String')) returns contents of edit6 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit7_Callback(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit7 as text
+% str2double(get(hObject,'String')) returns contents of edit7 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit7_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+path = uigetdir();
+set(handles.edit4,'String',path)
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu1.
+function popupmenu1_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu1
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu2.
+function popupmenu2_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu2
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit8_Callback(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit8 as text
+% str2double(get(hObject,'String')) returns contents of edit8 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit8_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit9_Callback(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit9 as text
+% str2double(get(hObject,'String')) returns contents of edit9 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit9_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton3.
+function pushbutton3_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+path = uigetdir();
+set(handles.edit8,'String',path)
+
+
+% --- Executes on button press in pushbutton4.
+function pushbutton4_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+file = uigetfile();
+set(handles.edit10,'String',file)
+
+
+function edit10_Callback(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit10 as text
+% str2double(get(hObject,'String')) returns contents of edit10 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit10_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit11_Callback(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit11 as text
+% str2double(get(hObject,'String')) returns contents of edit11 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit11_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
diff --git a/Sources/gui/pathSettings.fig b/Sources/gui/pathSettings.fig
new file mode 100644
index 0000000..4b453ee
Binary files /dev/null and b/Sources/gui/pathSettings.fig differ
diff --git a/Sources/gui/pathSettings.m b/Sources/gui/pathSettings.m
new file mode 100644
index 0000000..57b3375
--- /dev/null
+++ b/Sources/gui/pathSettings.m
@@ -0,0 +1,300 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = pathSettings(varargin)
+% RAPID_GUI MATLAB code for rapid_gui.fig
+% RAPID_GUI, by itself, creates a new RAPID_GUI or raises the existing
+% singleton*.
+%
+% H = RAPID_GUI returns the handle to a new RAPID_GUI or the handle to
+% the existing singleton*.
+%
+% RAPID_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in RAPID_GUI.M with the given input arguments.
+%
+% RAPID_GUI('Property','Value',...) creates a new RAPID_GUI or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before rapid_gui_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to rapid_gui_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help rapid_gui
+
+% Last Modified by GUIDE v2.5 14-May-2013 18:08:58
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @rapid_gui_OpeningFcn, ...
+ 'gui_OutputFcn', @rapid_gui_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before rapid_gui is made visible.
+function rapid_gui_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to rapid_gui (see VARARGIN)
+% Choose default command line output for rapid_gui
+handles.output = hObject;
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+guidata(hObject, handles);% Update handles structure
+string = mfilename('fullpath');
+string = string(1:end-length(mfilename)-5);
+path = strcat(string,'\model');
+set(handles.edit6,'String',path);
+set(handles.edit1,'String','test.mdl');
+set(handles.edit2,'String','FMUme');
+set(handles.edit5,'String','path to your .fmu here');
+tmp=RaPIdObject.experimentSettings;
+if isfield(tmp,'pathToSimulinkModel')
+ set(handles.edit6,'String',tmp.pathToSimulinkModel);
+end
+if isfield(tmp,'modelName')
+ set(handles.edit1,'String',tmp.modelName);
+end
+if isfield(tmp,'blockName')
+ set(handles.edit2,'String',tmp.blockName);
+end
+if isfield(tmp,'scopeName')
+ set(handles.edit4,'String',tmp.scopeName);
+end
+if isfield(tmp,'pathToFmuModel')
+ set(handles.edit5,'String',tmp.pathToFmuModel);
+end
+
+
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = rapid_gui_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+% --- Executes on button press in pushbutton3.
+function pushbutton3_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+[FILENAME, PATHNAME] = uigetfile({'*.mdl;*.slx','Simulink-files'},'Select the Simulink file that contains the FMU block you want to simulate');
+
+
+try
+ load_system(strcat(PATHNAME,FILENAME));
+ listOfFMUblocks=find_system(gcs,'regexp','on','Type','block','FunctionName','sfun_fmu_.');
+ close_system(gcs);
+ if isempty(listOfFMUblocks)
+ disp('There seems to be no valid FMU-blocks in the Simulink model');
+ elseif length(listOfFMUblocks)==1
+ FMUblock=listOfFMUblocks{:};
+ set(handles.edit2,'String',FMUblock);
+ end
+catch err
+ disp(err.message);
+end
+set(handles.edit6,'String',strcat(PATHNAME,FILENAME));
+set(handles.edit1,'String',FILENAME);
+
+
+
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton5.
+function pushbutton5_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+[FILENAME, PATHNAME] = uigetfile({'*.fmu','FMU-files'},'Select the FMU file that you want to simulate (NB only FMI 1.0 for ODE-solving!)');
+set(handles.edit5,'String',fullfile(PATHNAME,FILENAME))
+
+% --- Executes on button press in pushbutton7.
+function pushbutton7_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+[~,tmp,~]=fileparts(get(handles.edit1,'String'));
+RaPIdObject.experimentSettings.modelName = tmp;
+RaPIdObject.experimentSettings.blockName = get(handles.edit2,'String');
+RaPIdObject.experimentSettings.scopeName = get(handles.edit4,'String');
+RaPIdObject.experimentSettings.pathToFmuModel = get(handles.edit5,'String');
+RaPIdObject.experimentSettings.pathToSimulinkModel = get(handles.edit6,'String');
+close(gcf)
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton8.
+function pushbutton8_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+% RaPIdObject.experimentSettings.modelName = get(handles.edit1,'String');
+% RaPIdObject.experimentSettings.blockName = get(handles.edit2,'String');
+% RaPIdObject.experimentSettings.scopeName = get(handles.edit4,'String');
+% RaPIdObject.experimentSettings.pathToFmuModel = get(handles.edit5,'String');
+% RaPIdObject.experimentSettings.pathToSimulinkModel = get(handles.edit6,'String');
+open_system(RaPIdObject.experimentSettings.pathToSimulinkModel)
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit6_Callback(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit6 as text
+% str2double(get(hObject,'String')) returns contents of edit6 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
diff --git a/Sources/gui/psoSettings.fig b/Sources/gui/psoSettings.fig
new file mode 100644
index 0000000..2bd85e5
Binary files /dev/null and b/Sources/gui/psoSettings.fig differ
diff --git a/Sources/gui/psoSettings.m b/Sources/gui/psoSettings.m
new file mode 100644
index 0000000..bfc0b08
--- /dev/null
+++ b/Sources/gui/psoSettings.m
@@ -0,0 +1,360 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = psoSettings(varargin)
+% PSOSETTINGS MATLAB code for psoSettings.fig
+% PSOSETTINGS, by itself, creates a new PSOSETTINGS or raises the existing
+% singleton*.
+%
+% H = PSOSETTINGS returns the handle to a new PSOSETTINGS or the handle to
+% the existing singleton*.
+%
+% PSOSETTINGS('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in PSOSETTINGS.M with the given input arguments.
+%
+% PSOSETTINGS('Property','Value',...) creates a new PSOSETTINGS or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before psoSettings_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to psoSettings_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help psoSettings
+
+% Last Modified by GUIDE v2.5 17-May-2013 09:43:08
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @psoSettings_OpeningFcn, ...
+ 'gui_OutputFcn', @psoSettings_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before psoSettings is made visible.
+function psoSettings_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to psoSettings (see VARARGIN)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+% Choose default command line output for psoSettings
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+
+% UIWAIT makes psoSettings wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+
+if isprop(RaPIdObject,'psoSettings')
+ tmp=RaPIdObject.psoSettings;
+ set(handles.edit1,'String',tmp.alpha1);
+ set(handles.edit2,'String',tmp.alpha2);
+ set(handles.edit3,'String',tmp.alpha3);
+ set(handles.edit4,'String',tmp.limit);
+ set(handles.edit5,'String',tmp.nb_particles);
+ set(handles.edit6,'String',tmp.fitnessStopRatio);
+ set(handles.edit7,'String',tmp.kick_multiplier);
+ set(handles.edit14,'String',tmp.nRandMin);
+end
+
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = psoSettings_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit6_Callback(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit6 as text
+% str2double(get(hObject,'String')) returns contents of edit6 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit7_Callback(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit7 as text
+% str2double(get(hObject,'String')) returns contents of edit7 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit7_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+pso_options.alpha1 = eval(get(handles.edit1,'String'));
+pso_options.alpha2 = eval(get(handles.edit2,'String'));
+pso_options.alpha3 = eval(get(handles.edit3,'String'));
+pso_options.limit = eval(get(handles.edit4,'String'));
+pso_options.nRandMin = eval(get(handles.edit14,'String'));
+pso_options.nb_particles = eval(get(handles.edit5,'String'));
+pso_options.fitnessStopRatio = eval(get(handles.edit6,'String'));
+pso_options.kick_multiplier = eval(get(handles.edit7,'String'));
+RaPIdObject.psoSettings = pso_options;
+close(gcf)
+
+
+
+function edit14_Callback(hObject, eventdata, handles)
+% hObject handle to edit14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit14 as text
+% str2double(get(hObject,'String')) returns contents of edit14 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit14_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit15_Callback(hObject, eventdata, handles)
+% hObject handle to edit15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit15 as text
+% str2double(get(hObject,'String')) returns contents of edit15 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit15_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit16_Callback(hObject, eventdata, handles)
+% hObject handle to edit16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit16 as text
+% str2double(get(hObject,'String')) returns contents of edit16 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit16_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
diff --git a/Sources/gui/rapid_main_window.fig b/Sources/gui/rapid_main_window.fig
new file mode 100644
index 0000000..6931d16
Binary files /dev/null and b/Sources/gui/rapid_main_window.fig differ
diff --git a/Sources/gui/rapid_main_window.m b/Sources/gui/rapid_main_window.m
new file mode 100644
index 0000000..dce5dca
--- /dev/null
+++ b/Sources/gui/rapid_main_window.m
@@ -0,0 +1,622 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = rapid_main_window(varargin)
+% RAPID_MAIN_WINDOW MATLAB code for rapid_main_window.fig
+% rapid_main_window, by itself, creates a new rapid_main_window or raises the existing
+% singleton*.
+%
+% H = rapid_main_window returns the handle to a new rapid_main_window or the handle to
+% the existing singleton*.
+%
+% rapid_main_window('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in MAIN.M with the given input arguments.
+%
+% rapid_main_window('Property','Value',...) creates a new MAIN or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before main_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to main_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help main
+
+% Last Modified by GUIDE v2.5 08-Sep-2015 19:46:45
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @rapid_main_window_OpeningFcn, ...
+ 'gui_OutputFcn', @rapid_main_window_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before main is made visible.
+function rapid_main_window_OpeningFcn(hObject, eventdata, handles, varargin)
+
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to main (see VARARGIN)
+
+% Choose default command line output for main
+handles.output = hObject;
+% Update handles structure
+guidata(hObject, handles);
+setappdata(0,'HandleMainGUI',hObject);
+try
+ path2rapid=getPathToRapid();
+ load(fullfile(path2rapid,'core\data.mat'),'RaPIdObject');%load standard settings...
+ setappdata(handles.MainRaPiDWindow,'RaPIdObject',RaPIdObject);
+catch err
+ disp err;
+ rethrow(err);
+end
+% if isfield(mySettings,'dataT')
+% set(handles.MeasuredOutputPath_EditableTextfield,'String',mySettings.path2data);
+% set(handles.OutputTimeVectorExpression_EditableTextfield,'String',mySettings.dataT);
+% set(handles.OutputArrayExpression_EditableTextfield,'String',mySettings.dataY);
+%
+% if isfield(mySettings,'inDat')
+% set(handles.InputArrayExpression_EditableTextfield,'String',mySettings.inDat.path);
+% set(handles.InputTimeVectorExpression_EditableTextfield,'String',mySettings.inDat.time);
+% set(handles.InputArrayExpression_EditableTextfield,'String',mySettings.inDat.signal);
+% end
+% end
+
+
+% UIWAIT makes main wait for user response (see UIRESUME)
+% uiwait(handles.MainRaPiDWindow);
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = rapid_main_window_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+% --- Executes on selection change in OptimMethodSelect_popupmenu.
+function OptimMethodSelect_popupmenu_Callback(hObject, eventdata, handles)
+% hObject handle to OptimMethodSelect_popupmenu (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = cellstr(get(hObject,'String')) returns OptimMethodSelect_popupmenu contents as cell array
+% contents{get(hObject,'Value')} returns selected item from OptimMethodSelect_popupmenu
+str = get(handles.OptimMethodSelect_popupmenu,'String');
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+RaPIdObject.experimentSettings.optimizationAlgorithm = str{get(handles.OptimMethodSelect_popupmenu,'Value')};
+
+
+% --- Executes during object creation, after setting all properties.
+function OptimMethodSelect_popupmenu_CreateFcn(hObject, eventdata, handles)
+% hObject handle to OptimMethodSelect_popupmenu (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in OpenSimulink_pushbutton.
+function OpenSimulink_pushbutton_Callback(hObject, eventdata, handles)
+
+% hObject handle to OpenSimulink_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+set(handles.text8,'String','Running and Visualizing Optimization.');
+%set(handles.text8,'BackgroundColor','r');
+RaPIdObject.experimentSettings.solverMode='Simulink';
+RaPIdObject.experimentSettings.displayMode='Show';
+% THIS STUFF MIGHT GO
+try
+ if exist(RaPIdObject.experimentSettings.pathToSimulinkModel,'file')
+ tmp=RaPIdObject.experimentSettings.pathToSimulinkModel;
+ elseif ~exist(RaPIdObject.experimentSettings.pathToSimulinkModel,'file') && exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToSimulinkModel),'file')
+ tmp=fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToSimulinkModel);
+ end
+ open_system(tmp);
+
+ % mySettings.realData = transpose(eval(mySettings.dataY));
+ % mySettings.realTime = eval(mySettings.dataT);
+catch err
+ disp err
+end
+
+
+% --- Executes on button press in RunOptimization_pushbutton.
+function RunOptimization_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to RunOptimization_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+% mySettings.mode='Simulink';
+% [mySettings.realTime, i_t]=unique(mySettings.realTime); % check that we only use unique time stamps
+% mySettings.realData=mySettings.realData(i_t,:);
+
+try
+ tic
+ [sol, hist] = rapid(RaPIdObject);
+ assignin('base','sol',sol);
+ assignin('base','hist',hist);
+ toc
+catch err
+ set(handles.text8,'BackgroundColor','y');
+ set(handles.text8,'String','error');
+ rethrow(err);
+end
+set(handles.text8,'String','Simulation completed.');
+set(handles.text8,'BackgroundColor','g');
+
+
+% --- Executes on button press in OpenPlot_pushbutton.
+function OpenPlot_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to OpenPlot_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+
+if exist('sol','var')
+ figure
+ part.p = sol(1,:);
+ [res] = rapid_simuSystem( part,RaPIdObject);
+ identifiedSysData = mySettings.lastSimu.res;
+ idTime = mySettings.lastSimu.time;
+ resInterpo = rapid_interpolate(mySettings.realTime,idTime,identifiedSysData);
+ for i = 1:length(mySettings.fmuOutData);
+ subplot(100*ceil(length(mySettings.fmuOutData)/2)+20+i)
+ plot(mySettings.realTime,mySettings.realData(i,:))
+ hold on
+ plot(idTime,identifiedSysData(i,:),'--r')
+
+ plot(mySettings.realTime,resInterpo(i,:),'--g')
+
+ title(mySettings.fmuOutData{i})
+ legend('real sys', 'identified sys', 'interpolated data')
+ end
+else
+ warning('No Data to plot...')
+end
+
+
+% --- Executes on button press in GAAlgoSettings_pushbutton.
+function GAAlgoSettings_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to GAAlgoSettings_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+gaSettings
+
+% --- Executes on button press in GeneralSettings_pushbutton.
+function GeneralSettings_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to GeneralSettings_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+generalSettings
+
+% --- Executes on button press in PSOAlgoSettings_pushbutton.
+function PSOAlgoSettings_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to PSOAlgoSettings_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+psoSettings
+
+% --- Executes on button press in NaiveAlgoSettings_pushbutton.
+function NaiveAlgoSettings_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to NaiveAlgoSettings_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+naiveSettings
+
+% --- Executes on button press in MiscOptions_pushbutton.
+function MiscOptions_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to MiscOptions_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+otherSettings
+
+% --- Executes on button press in pushbutton9.
+function pushbutton9_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton10.
+function pushbutton10_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton11.
+function pushbutton11_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton12.
+function pushbutton12_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton12 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in OpenSimulink_pushbutton.
+function pushbutton15_Callback(hObject, eventdata, handles)
+% hObject handle to OpenSimulink_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+if exist(RaPIdObject.experimentSettings.pathToSimulinkModel,'file')
+ open_system(RaPIdObject.experimentSettings.pathToSimulinkModel)
+elseif ~exist(RaPIdObject.experimentSettings.pathToSimulinkModel,'file') && exist(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToSimulinkModel),'file')
+ open_system(fullfile(evalin('base','pwd'),RaPIdObject.experimentSettings.pathToSimulinkModel))
+end
+
+
+
+function OutputTimeVectorExpression_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to OutputTimeVectorExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of OutputTimeVectorExpression_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of OutputTimeVectorExpression_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function OutputTimeVectorExpression_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to OutputTimeVectorExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+function OutputArrayExpression_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to OutputArrayExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of OutputArrayExpression_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of OutputArrayExpression_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function OutputArrayExpression_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to OutputArrayExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in MeasuredOutputSelection_pushbutton.
+function MeasuredOutputSelection_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to MeasuredOutputSelection_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+[filename, pathname] = uigetfile();
+set(handles.MeasuredOutputPath_EditableTextfield,'String',strcat(pathname,filename));
+
+
+% --- Executes on button press in SendSettings_pushbutton.
+function SendSettings_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to SendSettings_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+RaPIdObject.experimentData.expressionReferenceTime = get(handles.OutputTimeVectorExpression_EditableTextfield,'String');
+RaPIdObject.experimentData.expressionReferenceData = get(handles.OutputArrayExpression_EditableTextfield,'String');
+RaPIdObject.experimentData.pathToReferenceData = get(handles.MeasuredOutputPath_EditableTextfield,'String');
+RaPIdObject.experimentData.expressionInDataTime = get(handles.InputTimeVectorExpression_EditableTextfield,'String');
+RaPIdObject.experimentData.expressionInData = get(handles.InputArrayExpression_EditableTextfield,'String');
+RaPIdObject.experimentData.pathToInData = get(handles.PathToInputData_EditableTextfield,'String');
+
+% --- Executes on button press in SaveContainer_pushbutton.
+function SaveContainer_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to SaveContainer_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+[filename, pathname] = uiputfile('*.mat');
+if exist('sol','var')
+ save(strcat(pathname,filename),'RaPIdObject','sol','hist');
+else
+ save(strcat(pathname,filename),'RaPIdObject')
+end
+
+
+% --- Executes on button press in LoadContainer_pushbutton.
+function LoadContainer_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to LoadContainer_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+%RaPIdObject=getappdata(handles.MainRaPiDWindow,'RaPIdObject');
+[filename, pathname] = uigetfile;
+load(strcat(pathname,filename));
+oldFolder = cd(pathname);
+contentOfContainer=who('-file',strcat(pathname,filename));
+if any(strcmp(contentOfContainer,'mySettings'))
+ try
+ RaPIdObject=RaPIdClass(mySettings);
+ disp('Converted old container to new, please save this new container');
+ catch err
+ disp(err.message)
+ end
+end
+if exist('RaPIdObject','var') && isa(RaPIdObject,'RaPIdClass')
+ setappdata(handles.MainRaPiDWindow,'RaPIdObject',RaPIdObject);
+ tmp=find(strcmp(cellstr(get(handles.OptimMethodSelect_popupmenu,'String')),RaPIdObject.experimentSettings.optimizationAlgorithm));
+ set(handles.OptimMethodSelect_popupmenu,'Value',tmp);
+
+ if strcmp(RaPIdObject.experimentSettings.solverMode,'Simulink')
+ tmp1=1;
+ tmp2=0;
+ else
+ tmp1=0;
+ tmp2=1;
+ end
+ set(handles.simulinkselector,'Value',tmp1);
+ set(handles.odeselector,'Value',tmp2);
+ if isprop(RaPIdObject,'experimentData') && isfield(RaPIdObject.experimentData, 'pathToReferenceData')
+ set(handles.MeasuredOutputPath_EditableTextfield,'String',RaPIdObject.experimentData.pathToReferenceData);
+ set(handles.OutputTimeVectorExpression_EditableTextfield,'String',RaPIdObject.experimentData.expressionReferenceTime);
+ set(handles.OutputArrayExpression_EditableTextfield,'String',RaPIdObject.experimentData.expressionReferenceData);
+ if isfield(RaPIdObject.experimentData,'pathToInData')
+ set(handles.PathToInputData_EditableTextfield,'String',RaPIdObject.experimentData.pathToInData);
+ set(handles.InputTimeVectorExpression_EditableTextfield,'String',RaPIdObject.experimentData.expressionInDataTime);
+ set(handles.InputArrayExpression_EditableTextfield,'String',RaPIdObject.experimentData.expressionInData);
+ end
+ end
+else
+ warning('Something went wrong, check the format of the container!')
+end
+
+
+% --- Executes on button press in LastResult_pushbutton.
+function LastResult_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to LastResult_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+if exist('sol','var') %To be fixed
+ results;
+else
+ warning('No data to look at...')
+end
+
+
+% --- Executes on button press in PathSettings_pushbutton.
+function PathSettings_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to PathSettings_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+pathSettings
+
+function MeasuredOutputPath_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to MeasuredOutputPath_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of MeasuredOutputPath_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of MeasuredOutputPath_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function MeasuredOutputPath_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to MeasuredOutputPath_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in MeasuredInputSelection_pushbutton.
+function MeasuredInputSelection_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to MeasuredInputSelection_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+[filename, pathname] = uigetfile();
+set(handles.PathToInputData_EditableTextfield,'String',strcat(pathname,filename));
+
+
+function InputArrayExpression_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to InputArrayExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of InputArrayExpression_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of InputArrayExpression_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function InputArrayExpression_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to InputArrayExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function InputTimeVectorExpression_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to InputTimeVectorExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of InputTimeVectorExpression_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of InputTimeVectorExpression_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function InputTimeVectorExpression_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to InputTimeVectorExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+function InputDataArrayexpression_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to InputArrayExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of InputArrayExpression_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of InputArrayExpression_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function InputDataArrayexpression_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to InputArrayExpression_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes during object creation, after setting all properties.
+function MainRaPiDWindow_CreateFcn(hObject, eventdata, handles)
+% hObject handle to MainRaPiDWindow (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+
+% --- Executes on button press in FMUGenerationOptions_pushbutton.
+function FMUGenerationOptions_pushbutton_Callback(hObject, eventdata, handles)
+% hObject handle to FMUGenerationOptions_pushbutton (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+generateFmu;
+
+
+function PathToInputData_EditableTextfield_Callback(hObject, eventdata, handles)
+% hObject handle to PathToInputData_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of PathToInputData_EditableTextfield as text
+% str2double(get(hObject,'String')) returns contents of PathToInputData_EditableTextfield as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function PathToInputData_EditableTextfield_CreateFcn(hObject, eventdata, handles)
+% hObject handle to PathToInputData_EditableTextfield (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes during object creation, after setting all properties.
+function text8_CreateFcn(hObject, eventdata, handles)
+% hObject handle to text8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+
+% --- Executes during object creation, after setting all properties.
+function Logo_CreateFcn(hObject, eventdata, handles)
+% hObject handle to axis1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+axes(hObject)
+imshow(fullfile(getPathToRapid,'gui','logoz.png'))
+% Hint: place code in OpeningFcn to populate axis1
+
+
+% --- Executes during object creation, after setting all properties.
+function SolverSelector_CreateFcn(hObject, eventdata, handles)
+% hObject handle to SolverSelector (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+set(hObject,'SelectionChangeFcn',@selcbk);
+set(hObject,'SelectedObject',[]); % No selection
+set(hObject,'Visible','on');
+
+
+% --- Handle toggling between different solver method
+function selcbk(source,eventdata)
+handle2main=getappdata(0,'HandleMainGUI');
+RaPIdObject=getappdata(handle2main,'RaPIdObject');
+if strcmp(get(get(source,'SelectedObject'),'String'),'Simulink')
+ RaPIdObject.experimentSettings.solverMode='Simulink';
+else
+ RaPIdObject.experimentSettings.solverMode='ODE';
+end
diff --git a/Sources/gui/results.fig b/Sources/gui/results.fig
new file mode 100644
index 0000000..8ea3206
Binary files /dev/null and b/Sources/gui/results.fig differ
diff --git a/Sources/gui/results.m b/Sources/gui/results.m
new file mode 100644
index 0000000..37600f9
--- /dev/null
+++ b/Sources/gui/results.m
@@ -0,0 +1,126 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+
+function varargout = results(varargin)
+% RESULTS MATLAB code for results.fig
+% RESULTS, by itself, creates a new RESULTS or raises the existing
+% singleton*.
+%
+% H = RESULTS returns the handle to a new RESULTS or the handle to
+% the existing singleton*.
+%
+% RESULTS('CALLBACK',hObject,eventData,handles,...) calls the local
+% function named CALLBACK in RESULTS.M with the given input arguments.
+%
+% RESULTS('Property','Value',...) creates a new RESULTS or raises the
+% existing singleton*. Starting from the left, property value pairs are
+% applied to the GUI before results_OpeningFcn gets called. An
+% unrecognized property name or invalid value makes property application
+% stop. All inputs are passed to results_OpeningFcn via varargin.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help results
+
+% Last Modified by GUIDE v2.5 02-May-2013 15:47:20
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @results_OpeningFcn, ...
+ 'gui_OutputFcn', @results_OutputFcn, ...
+ 'gui_LayoutFcn', [] , ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before results is made visible.
+function results_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin command line arguments to results (see VARARGIN)
+
+% Choose default command line output for results
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+load('core\data.mat');
+str = [];
+for i = sol
+ str = strcat(str,', ',num2str(i));
+end
+set(handles.edit1,'String',str(2:end))
+set(handles.text6,'String',mySettings.methodName)
+% UIWAIT makes results wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = results_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
diff --git a/Sources/matlab.mat b/Sources/matlab.mat
new file mode 100644
index 0000000..ee16fcb
Binary files /dev/null and b/Sources/matlab.mat differ
diff --git a/Sources/run_rapid_cmd.m b/Sources/run_rapid_cmd.m
new file mode 100644
index 0000000..2edfca9
--- /dev/null
+++ b/Sources/run_rapid_cmd.m
@@ -0,0 +1,134 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+%% Main script for running RaPiD without a GUI
+% To prepare the parameter estimation of your own model, copy first the
+% simulink model contained in myTest (resp. myTestIO), load the appropriate
+% *.fmu file and adapt the model where required (number of output/number
+% of input)
+% To use the toolbox in command line, change the parameters given in this
+% script and run it.
+% Change first the parameters relative to your system itself in the first
+% then change the parameters of the different identification methods
+% The usage and functionality of every parameter is disscussed in the user
+% manual.
+
+%% Print out the copyright statement on launch
+type('copyright_statement.txt')
+%% Global Settings (independant of the method chosen)
+containerFile='C:\Users\janlav\Documents\rapid_release\source\RaPId\examples\myTestIO64bit\variableIO64PSOtestContainer.mat';
+contentOfContainer=who('-file',containerFile);
+load(containerFile);
+oldFolder = cd(fileparts(containerFile));
+if any(strcmp(contentOfContainer,'mySettings'))
+ try
+ RaPIdObject=RaPIdClass(mySettings);
+ disp('Converted old container to new, please save this new container');
+ catch err
+ disp(err.message)
+ end
+end
+
+% We can either use Simulink or Matlab's ODE solver directly.
+switch RaPIdObject.experimentSettings.solverMode
+ case 'ODE'
+
+ case 'Simulink'
+
+end
+RaPIdObject.experimentSettings.solverMode='ODE';
+%% This part contains example of settings that can changed at will if needed
+ChangeLoadedSettings=0;
+if ChangeLoadedSettings
+ switch RaPIdObject.experimentSettings.optimizationAlgorithm
+ case 'pso'
+ pso_options.alpha1 = 0.5/(0.5+1+0.8);
+ pso_options.alpha2 = 1/(0.5+1+0.8);
+ pso_options.alpha3 = 0.8/(0.5+1+0.8);
+ pso_options.fitnessStopRatio = 1e-5;
+ pso_options.kick_multiplier = 2e-3;
+ pso_options.nb_particles = 5;
+ pso_options.limit = psoSettings.nbMaxIterations/pso_options.nb_particles;
+ pso_options.nRandMin = 2;
+ pso_options.p0s = psoSettings.p0;
+ pso_options.storeData = 0;
+ RaPIdObject.psoSettings = pso_options;
+ case 'ga'
+ ga_options.nbCromosomes = 40;
+ ga_options.nRandMin = 3;
+ ga_options.p0s = [];
+ ga_options.nbCroossOver1 = 10;
+ ga_options.nbCroossOver2 = 10;
+ ga_options.nbMutations = 30;
+ ga_options.nbReproduction = ceil(ga_options.nbCromosomes/4);
+ ga_options.limit = 10;
+ ga_options.fitnessStopRatio = 1e-5;
+ ga_options.headSize1 = ceil(ga_options.nbCroossOver1/2);
+ ga_options.headSize2 = ceil(ga_options.nbCroossOver1/2);
+ ga_options.headSize3 = ceil(ga_options.nbMutations/3);
+ ga_options.nbReinjection = 5;
+ ga_options.storeData = 0;
+ RaPIdObject.gaSettings = ga_options;
+ case 'naive'
+ naive_options.tolerance1 = 1e-4;
+ naive_options.tolerance2 = 1e-7;
+ naive_options.iterations = 2;
+ naive_options.iterations2 = 2;
+ naive_options.iterations3 = 2;
+
+ RaPIdObject.naiveSettings = naive_options;
+ case 'fmincon'
+ RaPIdObject.fminconSettings = 'optimset(''FinDiffRelStep'',0.1)';
+ case 'cg'
+ RaPIdObject.cgSettings = 'optimset(optimset(''fminunc''),''FinDiffType'',''central'',''TolX'',1e-6,''LargeScale'',''off'')';
+ case 'nm'
+ RaPIdObject.nmSettings = 'optimset(''fminsearch'')';
+ case 'pf'
+ pf_options.nb_particles = 10;
+ pf_options.nb_iterations = 2;
+ pf_options.prune_threshold = 0.2;
+ pf_options.kernel_sigma = 0.5;
+ pf_options.storeData = 0;
+ RaPIdObject.pfSettings = pf_options;
+ case 'combi'
+ RaPIdObject.combiSettings.firstMethod = 'pf';
+ RaPIdObject.combiSettings.secondMethod = 'naive';
+ case 'psoExt'
+ addpath(genpath(strcat(getPathToRapid,'\psopt'))); % change this path if needed
+ RaPIdObject.psoExtSettings = 'optimset(psooptimset,''TolFun'',1e-2)';
+ case 'gaExt'
+ RaPIdObject.gaExtSettings = 'gaoptimset';
+ case 'knitro'
+ RaPIdObject.knitroSettings.path2Knitro = 'P:\Program Files\Ziena\knitro';
+ RaPIdObject.experimentSettings.p_0 = [0.35 0.4];
+ RaPIdObject.knitroSettings.knOptions = 'optimset(''Algorithm'',''interior-point'')';
+ RaPIdObject.knitroSettings.knOptionsFile = [];
+ end
+end
+% run the computation
+tic
+[sol, hist] = rapid(RaPIdObject);
+toc
+sprintf('vector of parameter found:')
+sol
+hist
\ No newline at end of file
diff --git a/Sources/run_rapid_gui.m b/Sources/run_rapid_gui.m
new file mode 100644
index 0000000..06a6028
--- /dev/null
+++ b/Sources/run_rapid_gui.m
@@ -0,0 +1,32 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+%% Print out the copyright statement on launch
+type('copyright_statement.txt')
+
+%% Main script for GUI assisted use of the toolbox
+% Run
+% the GUI needs to be completely initialised the first time
+% it is recommended to save containers when exiting the program or
+% switching from a model to another.
+rapid_main_window
\ No newline at end of file
diff --git a/Sources/setup_rapid.m b/Sources/setup_rapid.m
new file mode 100644
index 0000000..d8258c7
--- /dev/null
+++ b/Sources/setup_rapid.m
@@ -0,0 +1,35 @@
+%%
+%
+% Copyright 2015 Luigi Vanfretti, Achour Amazouz, Maxime Baudette,
+% Tetiana Bogodorova, Jan Lavenius, Tin Rabuzin, Giuseppe Laera,
+% Francisco Gomez-Lopez
+%
+% The authors can be contacted by email: luigiv at kth dot se
+%
+% This file is part of Rapid Parameter Identification ("RaPId") .
+%
+% RaPId is free software: you can redistribute it and/or modify
+% it under the terms of the GNU Lesser General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% RaPId is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with RaPId. If not, see .
+
+%% Script For Initializing the Toolbox for the first time on a Computer
+% Make sure this file is in the RaPId Toolbox folder
+%
+addpath(fullfile(fileparts(mfilename('fullpath'))));
+addpath(fullfile(fileparts(mfilename('fullpath')), 'gui'));
+addpath(genpath(fullfile(fileparts(mfilename('fullpath')), 'core')));
+savepath
+if isempty(ver('FMItoolbox'))
+ warning('FMI toolbox does not seem to be installed! Keep this in mind if you receive error-messages while using RaPId.')
+end
+
+run_rapid_gui
\ No newline at end of file