Visual HMIアラームパラメータ(Lua):on_parse_warning p 0 ~ p 3動的テキストを連結

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

アラート·パラメータ·コールバックon_get_warning_param(warning_id)問題を解決する:リアルタイムのアラーム値が必要。たとえば、“temperatureが高すぎます:現在85.5 ° C”-警告テキストはテンプレートで、数値はランタイムです。コールバックは最大4つのパラメータ(data0~data3)を返し、アラーム設定の{#N num1.num2}プレースホルダを入力します。

1.プレースホルダ形式{#data num1.num2}

アラーム設定では、アラームの内容は次のように記述できます。

temperatureが高すぎる{#0 2.2} ℃
フィールドフィールド意味の意味
data引数ID、0から始まり、最大4 个(data0~data3)
num1整数ビットのスペース数整列用
num2小数点以下のゼロ補数

例{#0 2.2}は、data0が2桁の整数先頭スペース未満+ 2桁の小数ゼロ未満を表示することを意味します。

2.コールバック実装

function on_get_warning_param warning_id
  最大4つのパラメータを返します。
  local data0 = get_uint16 VT_LW、0x1001/ 100   -100倍に減少:85.5は8550です。
  local data1 = get_uint16 VT_LW、0x1002
  local data2 = get_uint16 VT_LW、0x1003
  local data3 = get_uint16 VT_LW、0x1004
  return data0、data1、data2、data3
End of Endシングル

temperature 85.5℃レジスタに8550(100 倍拡大)を格納し、コールバックに/100を復元し、{#0 2.2}を押して“85.50”にフォーマットして表示します。

3. on_parse_warningとの違い

on_get_warning_paramのみ数値パラメータを返すテキストテンプレートはアラーム設定に含まれます。on_parse_warning(id, text, screen_id, control_id, p0, p1, p2, p3)はい。フルテイクオーバー警告テキスト生成--文字列、エンコードを返します。エンコード1=GBK画面推奨/0=UTF-8。2つは相互排他的であり、完全な引き継ぎを使用しないでください。

3つの穴①コールバックは{#N...}にのみ設定されていますプレースホルダのアラートが有効になるプレースホルダーのないアラームはそれを調整しません。最大4つのパラメータ。(data0~data3)は表示されません。注意ユニットの拡大レジスタは増幅された値を保持し、コールバックで復元する必要があります。さもなければ85.50ではなく8550を表示します。

広州大彩科技Visual HMI開発ドキュメント(hmi-doc.gz-dc.com)LUAチュートリアル“アラームパラメータ”から整理され、著作権は大彩科技が所有しています。

Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.