Simulink+Exercise_part_II

  • Upload
    tygnia

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

  • 8/16/2019 Simulink+Exercise_part_II

    1/3

    Simulink Exercise Part II:

    You are given a set of time-series data: 1.time, 2. F_exp and 3. ys_exp(download from !"!#. Folder is named expdata.mat$% . &exp$ denotesexperimental data

    ! unit step ' ange (F_spe'% was made in a pro'ess at t)2* and t epro'ess was run till t)2**. +imestep was *.1s.!s a pro'ess engineer, your o is to re'over all t e transfer fun'tionparameters and to 'ome up wit t e “optimal” transfer functions.

    You may assume 1 st order form for valve and pro'ess and a time delayfor sensor.

    + erefore, we need to nd / varia les (tau_v, 0, tau_p and t eta%alve : tau_v = unknown: + erefore, v ) 1 (tau_v.s 4 1%.

    5ro'ess: K=unknown, au_p=unknown : + erefore, p ) 0(tau_p.s41%

    ensor: t!eta = unknown : + erefore, s ) exp6(-t eta.s%.

    teps to follow:

    1. 7ontinue from previous 'lass examples. 8pen up simulin0pro'ess diagram

    2. ave as anot er name now (e.g. pro'ess_opt% in t e same folder.3. o to all t e lo'0 diagrams. 9epla'e t e parameters wit t e

    un0nowns de ned a ove. ( ote: at t is point you will e una leto run t e simulin0 model sin'e t e varia les are unde ned%.;veryt ing else 'an remain t e same

    /. 7reate a main_opt.m. ?e ne glo al varia les : varia les t at are glo al s ould e time,

    F_exp, ys_exp (note: exp is added to denote experimental data. %and any varia le t at is o tained in t e fun'tion le ut needs to

    e used in t e main le. see elp glo al.@. Aoad t e experimental dataset (see elp load%B. ow if you run t e main_opt le and type w os you s ould see

    t ree varia les (time, F_exp ys_exp%.C. set initial 'onditions for t e set of varia les. Aet x* ) D> B < @E.

    ote: we do not 0now t e optimal values at t is point so we needsome set of starting values. x is t e ve'tor of Dtau_v, 0, tau_p andt etaE and * indi'ates initial point.

    1*. we are now ready to use t e 'ommand &fminsear' $. + is isa gradient-free optimi ation algorit m (nelder-mead% t at ta0es astarting point, ' e'0s t e sum of sGuared error (sse% and furt eradvan'es to a etter point and 0eeps advan'ing till t e sse'annot e improved any furt er.

    11. type elp fminsear' to 0ey in t e syntax

  • 8/16/2019 Simulink+Exercise_part_II

    2/3

    12. #n t e syntax, t e last argument s ould e options13. in t e line a ove t e fminsear' 'ommand type t e line,

    options)optimset(H%. +ype elp optimset to learn w at t e Hs ould e. 8n'e of t e t ings to ll in is t e display iterationoption.

    1/. you will now also need to 'reate a fun'tion le (name itopt.m%1. ote: you don$t ave to 'onsider t)* to 2* sin'e t e stepwas made at t)21.

    2@. type &return$ at t e end of t e fun'tion le2B. 5lot and overlay t e varia les in t e main le. !lso plot t e

    residuals (w at are residualsM % . ' e'0 ow t ey 'ompare.2C. ow you s ould e ready to run t e les. 9emem er to run

    t e main_opt le and it will automati'ally 'all t e opt le and t epro'ess_2 les.

    3*. You s ould e a le to see t e display of iterations in t e'ommand prompt

  • 8/16/2019 Simulink+Exercise_part_II

    3/3

    31. at t e rst iteration t e sse is N