バックナンバーはこちら。
https://www.simulationroom999.com/blog/model-based-of-minimum-2-backnumber/
はじめに
前回はMDF conversion仕様 tabular with rangeについて説明した。
tabular仕様とにているが、入力側をレンジ指定できるものだった。
default caseの値設定が必須で、tabular仕様と異なりレンジ外はここの値が反映される。
今回は最後のMDF conversion仕様であるvalue range to textについて。
登場人物
博識フクロウのフクさん

イラストACにて公開の「kino_k」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=iKciwKA9&area=1
エンジニア歴8年の太郎くん

イラストACにて公開の「しのみ」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=uCKphAW2&area=1
MDF conversion仕様 value range to text

じゃー、MDF conversion仕様 value range to textについて説明する。
これが最後のconversion仕様になるかな。

(やっと最後か・・・予想通りではあったが長かった・・・。)

名前的には以前の「value to text」に対して、範囲指定が付いた感じかな?

正解だ。

そして、「value to text」の時に問題としてあがった、
指定した以外の数値以外だdefault caseに入ってしまうを回避できる。

あ、
default caseが空白文字。
1の時に’1st’と指定した時に
1.1を入力すると空白文字になっちゃうやつか。

まぁvalue to textの仕様自体は整数型の入力を想定しているから
1.1という入力が想定外ってのはあるが、
今回のvalue range to textでは1.1も1として扱うなどの指定が可能ってことだね。

なるほどー。
AsamMdfでのvalue range to textの設定方法

じゃ、早速AsamMdfでのvalue range to textの設定方法を示そう。
# value range to text
conversion=dict()
conversion['lower_0']=0
conversion['upper_0']=0.5
conversion['text_0']='Neutral'
conversion['lower_1']=0.5
conversion['upper_1']=1.5
conversion['text_1']='1st'
conversion['lower_2']=1.5
conversion['upper_2']=2.5
conversion['text_2']='2nd'
conversion['lower_3']=2.5
conversion['upper_3']=3.5
conversion['text_3']='3rd'
conversion['lower_4']=3.5
conversion['upper_4']=4.5
conversion['text_4']='Top'
conversion['lower_5']=4.5
conversion['upper_5']=5.5
conversion['text_5']='OverTop'

value to textで使ったシフトの対応法を範囲指定型に変更したような仕様にしてある。

書き方としては
value to textとtabular with rangeを合わせたような感じだね。

そうだね。
tabular with rangeの出力側指定のphys_がtext_になったと言って良いだろう。
まとめ

まとめだよ。
- MDF conversion仕様 value range to textを説明。
- value to textの入力側が範囲指定できる。
- value to textとtabular with rangeを合わせたような仕様。
- tabular with rangeの出力側のphys_がtext_になった感じ。
バックナンバーはこちら。
コメント