hyperwork后处理的自动化,有两条技术路线,第一条就是通过tcl语言二次开发,可以满足基本上所有的需求。第二条就是通过tpl文件和PPT导出功能做到自动化。适用于固定规范,固定输入变量的情况,只需要操作一次,将当前会话保存为tpl文件即可。
在下一次面临相同后处理的情况下,通过tpl文件,我们只用重新指定文件名,即可在当前会话得到相同的结果。
tpl可以帮我们绘制结果,但是我们有时候还需要查询结果或者提取结果
怎么处理呢,那么就可以通过templex语言实现,我们可以来查询曲线的最大,最小值,对多根曲线进行数值计算,或者将结果写入到文本中等。
后处理,处处都是templex的应用实例,hyperview客户端的图形界面右上角显示的note,在编辑框中就是templex语言。

曲线的参数计算

查看曲线的最大值

将最大值写入到文件中

templex可以包含纯文本,数学表达式、常数和变量。
temolex语句的、表达式和变量必须放在大括号 {} 之间才会执行运算。
在大括号外的文本被视为纯文本,不被处理,只会直接输出。
注释可以放在大括号内,通过引号标注即可。
输入
The square root of 2 is approximately equal to {sqrt(2)}.显示
The square root of 2 is approximately equal to 1.414213.输入
{for (x=0; x<=5; x++)}x={x}, Square root of x={sqrt(x)}{endloop}
显示
x=0, Square root of x = 0x=1, Square root of x = 1x=2, Square root of x = 1.41421x=3, Square root of x = 1.73205x=4, Square root of x = 2x=5, Square root of x = 2.23607
输入
{for (x=0; x<=5; x++)}x={x}, Square root of x={sqrt(x), %5.3f}{endloop}
显示
x=0, Square root of x = 0.000x=1, Square root of x = 1.000x=2, Square root of x = 1.414x=3, Square root of x = 1.732x=4, Square root of x = 2.000x=5, Square root of x = 2.236
输入
{'This template evaluates the square root of the}{'numbers 0 through 5 and prints the output when}{'the value of the square root is less than or}{'equal to 1.5}{for (x=0; x<=5; x++)}{if (sqrt(x)<=1.5)}x={x}, Square root of x={sqrt(x), %5.3f}{endif}{endloop}
显示
x=0, Square root of x = 0.000x=1, Square root of x = 1.000x=2, Square root of x = 1.414
输入
{ofile = {"st_sqr.out", "st_sqrt.out", "st_sine.out"}}{open ofile[0]}{for (x=0; x<=5; x++)}x={x}; Square of x= {x^2, %5.3f}{endloop}{close}{open ofile[1]}{for (x=0; x<=5; x++)}x={x}; Square root of x= {sqrt(x), %5.3f}{endloop}{close}{open ofile[2]}{for (x=0; x<=5; x++)}x={x}; Sine of x= {sin(x), %5.3f}{endloop}{close}
将在当前路径下,创建三个文件,并写入结果。
本篇就到这里,了解上述知识是够用的了,后续的文章将对逻辑判断,循环结构,数学计算,文件IO,