メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

get

Stateflow チャート、MATLAB System ブロック、S-Function の操作点情報を取得

説明

op = get(modelOP,blockPath) は、指定されたパス blockPath にあるモデル要素の操作点情報 op を返します。関数 get は、以下の操作点情報へのアクセスに使用します。

  • Stateflow® チャート

  • MATLAB System ブロック

  • カスタムの操作点を実装した S-Function

組み込みブロックの状態にアクセスするには、Simulink.op.ModelOperatingPoint オブジェクトの loggedStates プロパティを使用します。

すべて折りたたむ

モデル sldemo_fuelsys を開きます。

mdl = "sldemo_fuelsys";
open_system(mdl)

Simulink.SimulationInput オブジェクトを作成してモデルのシミュレーションを構成します。

simIn = Simulink.SimulationInput(mdl);

関数 setModelParameter を使用して、シミュレーションの終了時間を 10 秒に設定し、シミュレーションの最終状態と操作点を保存するようにモデルを構成します。

simIn = setModelParameter(simIn,"StopTime","10");
simIn = setModelParameter(simIn,"SaveFinalState","on");
simIn = setModelParameter(simIn,"SaveOperatingPoint","on");

SimulationInput オブジェクトに保存されているシミュレーション構成を使用してモデルをシミュレートします。

out = sim(simIn);

モデルの操作点を含む Simulink.op.ModelOperatingPoint オブジェクトを取得します。

modelOP = out.xFinal
modelOP = 
    Simulink.op.ModelOperatingPoint

    Operating point of the model 'sldemo_fuelsys' at simulation time 10.

  Properties

    loggedStates
    description
    startTime (Read-only)
    snapshotTime (Read-only)

  Methods

    get
    set


fuel_rate_control という名前のサブシステム内にある control_logic という名前の Stateflow® チャートの操作点を取得します。

chartPath = mdl + "/fuel_rate_control" + "/control_logic";
chartOP = get(modelOP,chartPath)
chartOP = 
Block: "control_logic"    (handle)    (active)
  Path:     sldemo_fuelsys/fuel_rate_control/control_logic

  Contains:

    + Fail                 "State (AND)"               (active)            
    + Fueling_Mode         "State (AND)"               (active)            
    + O2                   "State (AND)"               (active)            
    + Pressure             "State (AND)"               (active)            
    + Speed                "State (AND)"               (active)            
    + Throttle             "State (AND)"               (active)            
      es_o                 "Block output data"         EngSensors [1, 1]   
      fuel_mode            "Block output data"         sld_FuelModes [1, 1]
      O2_normal            "State output data"         boolean [1, 1]      

入力引数

すべて折りたたむ

モデルの操作点。Simulink.op.ModelOperatingPoint オブジェクトとして指定します。

操作点情報にアクセスするモデル要素のパス。string または文字ベクトルとして指定します。

アクセラレータ モードを使用してシミュレートされる参照モデル内の Stateflow チャート、MATLAB System ブロック、S-Function については、操作点情報にアクセスしたり変更したりすることはできません。

出力引数

すべて折りたたむ

要素の操作点。Stateflow.op.BlockOperatingPoint (Stateflow) オブジェクト、S-Function の操作点、または MATLAB System ブロックの操作点として返されます。

ヒント

バージョン履歴

R2019a で導入

すべて展開する