Documentation for Axxon PSIM 1.0.0-1.0.1.

Previous page Operators and expressions  Examples of scripts in the embedded language Next page


General description and examples of use of math functions, conversion functions, as well as format functions and string functions are represented in the table.

Functions

(The number of executable parameters is specified in square brackets)

General description, example of use 

MATH

sin[1]

Trigonometric function for calculating the sine of an angle.

Format: y=sin(x); where yfunction value, xargument of function (in radians)

Example:

y=sin(1.6)

Event received:

Event : CORE  VAR_CHANGED nt_obj_id<1>,value<0.997495>,name<y>,time<15:26:41>,date<21-09-04>

cos[1]

Trigonometric function for calculating the cosine of an angle.

Format: y=cos(x); where yfunction value, xargument of function (in radians)

Example:

y=cos(2.2)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<-0.588501>,name<y>,time<16:00:45>,date<21-09-04>

tan[1]

Trigonometric function, returns the tangent of an angle.

Format: y=tan(x); where yfunction value, xargument of function (in radians)

Example:

y=tan(1)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1.557408>,name<y>,time<16:43:45>,date<21-09-04>

asin[1]

Returns the arc sine of the specified numeric expression.

Format: y=asin(x); where yfunction value (in radians), xargument

Example:

y=asin(0.5)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<0.523599>,name<y>,time<16:46:39>,date<21-09-04>

acos[1]

Returns the arc cosine of the specified numeric expression.

Format: y=acos(x); where yfunction value (in radians), xargument

Example:

y=acos(0.55)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<0.988432>,name<y>,time<16:46:39>,date<21-09-04>

atan[1]

Returns the arc tangent of the specified numeric expression.

Format: y=atan(x); where yfunction value (in radians), xargument

Example:

y=atan(1.2)

Event received:

Event : Event : CORE  VAR_CHANGED int_obj_id<1>,value<0.876058>,name<y>,time<17:07:09>,date<21-09-04>

sinh[1]

The sinh function returns hyperbolic sine of the argument value.

Format: y=sinh(x); where yfunction value, xargument of function

Example:

y=sinh(0.8)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<0.888106>,name<y>,time<17:12:26>,date<21-09-04>

cosh[1]

The cosh function returns hyperbolic cosine of the argument value.

Format: y=cosh(x); where yfunction value, xargument of function

Example:

y=cosh(0.35)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<0.336376>,name<y>,time<17:25:25>,date<21-09-04>

tanh[1]

Trigonometric function for an angle calculation.

Format: y=tanh(x); where yfunction value, xargument of function

Example:

y=tanh(0.35)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1.419068>,name<y>,time<17:25:25>,date<21-09-04>

exp[1]

Returns the value of the e^x function, where xspecified numeric expression.

Format: y=exp(x); where yfunction value, xargument

Example:

y=exp(1.65)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<5.20698>,name<y>,time<17:39:22>,date<21-09-04>

log[1]

Returns the natural logarithm (base-e) of the specified numeric expression.

Format: y=log(x); where yfunction value, xargument

Example:

y=log(0.65)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<-0.430783>,name<y>,time<17:43:22>,date<21-09-04>

log10[1]

Returns the common logarithm (base-10) of the specified numeric expression.

Format: y=log10(x); where yfunction value, xargument

Example:

y=log10(0.05)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<-1.30103>,name<y>,time<17:46:28>,date<21-09-04>

sqrt[1]

Returns the square root of the specified numeric expression. 

Format: y=sqrt(x); where yfunction value, xargument

Example:

y=sqrt(9)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<3>,name<y>,time<17:25:25>,date<21-09-04>

abs[1]

The abs function returns the absolute value of the argument.

Format: y=abs(x); where yfunction value, xargument

Example:

y= abs(-1)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1>,name<y>,time<13:39:37>,date<22-09-04>

deg[1]

Trigonometric function for an angle calculation. Returns the grade measure.

Format: y=deg(x); where yfunction value in grades, xargument value in radians

Example:

y=deg(3.14)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<179.908748>,name<y>,time<13:13:51>,date<22-09-04>

rad[1]

Trigonometric function for an angle calculation.

Format: y=rad(x); where yfunction value in radians, xargument value in grades

Example:

y=rad(180)

Event received:

Event : CORE VAR_CHANGED value<3.141593>,name<y>,time<15:04:17>,date<17-03-08>

CONVERSION

floor[1]

Integer conversion function (rounding downward).

Format: x= floor(y); where xfunction value, yfraction or integer

Example:

x= floor(5.55)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<5>,name<x>,time<20:51:48>,date<21-09-04>

ceil[1]

Integer conversion function (rounding upward).

Format: x= ceil (y); where xfunction value, yfraction or integer

Example:

x= ceil(5.55)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<6>,name<x>,time<20:51:48>,date<21-09-04>

str[1]

Integer-to-string conversion function.

Format: x=str(y); where xfunction value, yargument

Example:

z=(9);

a=str(z);

b=sqrt(a);

Events received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<9>,name<z>,time<14:27:31>,date<22-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<9>,name<a>,time<14:27:31>,date<22-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<3>,name<b>,time<14:27:31>,date<22-09-04>

atof[1]

String-to-integer conversion function.

Format: x=atof(y); where xfunction value, yargument

Example:

x="0";

x=str(atof(x)+10);

Event received:

Event : CORE VAR_CHANGED value<0>,name<x>,time<15:34:44>,date<17-03-08>

Event : CORE VAR_CHANGED value<10>,name<x>,time<15:34:44>,date<17-03-08>

val[1]

Integer-to-string conversion function.

Format: x=val(y); where xfunction value, yargument

Example:

x="10";

x=str(val(x)+2);

Event received:

Event : CORE VAR_CHANGED value<10>,name<x>,time<15:34:44>,date<17-03-08>

Event : CORE VAR_CHANGED value<12>,name<x>,time<15:34:44>,date<17-03-08>

int[1]

Conversion of fraction into integer (without fractional part).

Format: x=int(y); where xfunction value, yargument (fraction for conversion)

Example:

y=(2.33);

x=int(y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<2.33>,name<y>,time<16:05:28>,date<22-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<2>,name<x>,time<16:05:28>,date<22-09-04>

long2time[1]

It is used to convert specified number of seconds into time.

Format: x=long2time(y); where xfunction value(time), ynumber in seconds

Format of the initial recording (argument): <MM>

Format of final recording: <HH:MM:SS>

Example:

x=long2time(12345);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<03:25:45>,name<x>,time<13:53:02>,date<20-09-04>

time2long[1]

Convert time into a number of seconds.

Format: x=time2 long(y); where xvalue in seconds, ytime in the <hours>.<minutes> format

Example:

y=(0.15);

x=time2long(y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<0.15>,name<y>,time<19:39:49>,date<22-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<900>,name<x>,time<19:39:49>,date<22-09-04>

scalar2date[1]

Convert a number of days into a date (number of days is calculated AD).

Format: x= scalar2date (y); where xvalue(date), ynumber of days

Example:

y=(731500);

x=scalar2date(y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<731500>,name<y>,time<19:57:46>,date<22-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<12-10-03>,name<x>,time<19:57:46>,date<22-09-04>

scalar[1]

Convert date to number of days (number of days is calculated AD).

Format: x=scalar(y); where xnumerical value (in days), ydate

Recording format: <DD.MM.YYYY>

Example:

x=scalar(“19.10.2004”)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<10>,value<731873>,owner<WS1>,name<x>,time<15:24:11>, guid_pk<{42E93AF5-4862-485E-AEF6-D14C7BF79C5B}>,date<08-12-09>

convert_num[1]

Convert a number into the string.

Format: x=convert_num(y); where xstring value of the number, yconvertible number

Example:

y=(24009921);

x=convert_num(y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<24009921>,name<y>,time<12:37:20>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<Twenty four million nine thousand nine hundred twenty-one >,name<x>,time<12:37:20>,date<23-09-04>

convert_cur[1]

Convert a number (sum of money) into the string and add dollars and cents.

Format: x=convert_cur(y); where xstring value of the sum of money, ynumber (sum of money)

Recording format: <DD.CC>

Example:

y=(17999.98);

x=convert_cur(y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<17999.98>,name<y>,time<12:49:30>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<Seventeen thousand nine hundred ninty-nine dollars ninty-eight cents>,name<x>,time<12:49:30>,date<23-09-04>

FORMATTING

number_frm[2]

Formatting a number.

Format: x=number_frm(y,z); where xfunction value, yinitial number, znumber of figures after the decimal

Example:

y=(17999.09998);

x=number_frm(y,3);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<17999.09998>,name<y>,time<14:21:24>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<17999.100>,name<x>,time<14:21:24>,date<23-09-04>

int_frm[2]

Formatting number.

Format: x=int_frm(y,z); where xvalue, y- operand, znumber of output digits

Example:

y=(17999.99);

x=int_frm(y,10);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<17999.99>,name<y>,time<14:31:46>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<0000017999>,name<x>,time<14:31:46>,date<23-09-04>

currency_std[1]

Formatting currency value (from '.' to '-').

Format: x=currency_std(y); where xfunction value with modified format, ynumber (sum of money)

Example:

x=currency_std(3.62);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<3-62>,name<x>,time<13:40:01>,date<23-09-04>

IsVarExist[1]

The function that checks a specified parameter in the event.

Format: y=IsVarExist(“x”); where yvalue, xparameter

If the parameter exists, then “1” returns, otherwise “0”.

Example:

p=IsVarExist(“param0”)

Event received:

Event : CORE  VAR_CHANGED int_obj_id<10>,value<0>,owner<WS1>,name<p>,time<12:02:11>, guid_pk<{6A8B5BC9-919C-4098-844A-FBF78FA20820}>,date<14-12-09>


GetObjectIdByParam [3]


The function that returns the first object ID found by a specified parameter.

Id=GetObjectIdByParam ("x","y","z"); where idreturned value, xobject type, yparameter, zparameter value

Example:

Id=GetObjectIdByParam("CAM","color","0");

Event received:

Event : CORE  VAR_CHANGED date<28-02-11>,value<2>,int_obj_id<1>,fraction<218>,name<Id>, guid_pk<{F903A28C-3243-E011-901F-6CF049E58698}>,time<15:02:04>,owner<D-IVANOV>

* Id=2 (see value<2>), if the function returns empty value (value< >), then check if the function and its parameters are written correctly

STRING

strequal[2]

Comparing strings.

Format: x= strequal(z,y); where xvalue, z and ycompared strings

Example:

z=str(1019);

y=str(1019);

x=strequal(z,y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1019>,name<z>,time<16:51:45>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1019>,name<y>,time<16:51:45>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1>,name<x>,time<16:51:45>,date<23-09-04>

*  «value<1>» (see example above)in the received event we get «value<>»compared strings differ, or «value<1>»compared strings are the same

strsub[2]

Determining if there is a substring in the string.

Format: x=strsub(y,z); where xvalue, ystring in which the search is performed, zsubstring

Example 1:

z=str(888123);

y=str(123);

x=strsub(z,y);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<888123>,name<z>,time<16:07:07>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<123>,name<y>,time<16:07:07>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<4>,name<x>,time<16:04:34>,date<23-09-04>

Example 2:

z="67hb8vc56";

y="vc";

x=strsub(z,y);

Event received:

Event : CORE VAR_CHANGED value<67hb8vc56>,name<z>,time<12:15:09>,date<18-03-08>

Event : CORE VAR_CHANGED value<vc>,name<y>,time<12:15:09>,date<18-03-08>

Event : CORE VAR_CHANGED value<6>,name<x>,time<12:15:09>,date<18-03-08>

*  "value<4>" (see example 1)index in the initial string. Starting from this index, the first occurrence of the substring in the string is detected. If the search result is negative, the function returns value<>

strempty[1]

Determining if the string is empty.

Format: x=strempty(y); where xvalue (1 if string is empty), ystring

Example:

y=("");

x=strempty(y);

Event received:

Event : CORE VAR_CHANGED value< >, name<y>,time<12:27:32>,date<18-03-08>

Event : CORE VAR_CHANGED value<1>,name<x>,time<12:27:32>,date<18-03-08>

* function value value <> means that string is not empty

straleft[2]

Left alignment.

Format: x=straleft(y,z); where xaligned string, ystring, zalignment value

Example:

y=str(123456789);

x=straleft(y,5);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<123456789>,name<y>,time<18:04:05>,date<23-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<12345>,name<x>,time<18:04:05>,date<23-09-04>

Note. If z is larger than the number of characters in the string, then the function adds spaces to the initial string on the right until its length becomes z

strmid[3]

Get substring.

Format: x=strmid(y,z,w); where xstring value, ystring, zstring position, wsubstring length

Example:

z=(7);//position

w=(9);//length

x=strmid("get substring (1 - string, 2 - position, 3 - length)",z,w);

y=strmid("get substring (1 - string, 2 - position, 3 - length)",17,10);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<6>,name<z>,time<14:18:08>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<9>,name<w>,time<14:18:08>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<substring>,name<x>,time<14:18:08>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1 – string>,name<y>,time<14:18:08>,date<24-09-04>

strletf[2]

Get left side of string.

Format: y=strleft(s,w); where ystring value, sstring, wlength (from string beginning)

Example:

w=(5);//length

s=("Get left side of string");//string

y=strleft(s,w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<5>,name<w>,time<14:54:31>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value< Get left side of string>,name<s>,time<14:54:31>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<Get>,name<y>,time<14:54:31>,date<24-09-04>

strright[2]

Get right side of string (1string, 2length).

Format: y=strleft(s,w); where ystring value, sstring, wlength  (from string end)

Example:

w=(6);// length

s=("Get right side of string");//string

y=strright(s,w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<6>,name<w>,time<15:10:36>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value< Get right side of string>,name<s>,time<15:10:36>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<strings>,name<y>,time<15:10:36>,date<24-09-04>

strnleft[2]

Get without left side of string.

Format: y=strnleft(s,w); where ystring value, sstring, wlength of left side that will be cut

Example:

w=(6);//length

s=("get without left side of string");//string

y=strnleft(s,w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<6>,name<w>,time<15:32:38>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<get without left side of string>,name<s>,time<15:32:38>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<without left side of string>,name<y>,time<15:32:38>,date<24-09-04>

srtnright[2]

Get without right side of string.

Format: y=strnright(s,w); where ystring value, sstring, wlength of right side that will be cut

Example:

w=(6);//length

s=("get without right side of string");//string

y=strnright(s,w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<6>,name<w>,time<15:44:31>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<get without right side of string>,name<s>,time<15:44:31>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value< get without right side of string>,name<y>,time<15:44:31>,date<24-09-04>

get_substr[3]

Get substring (1string, 2substring to start with, 3substring to end with, "\r"end of string).

Format: y=get_substr(s,w,x); where yvalue(substring), sstring, wsubstring to start with, xsubstring to end with("\r"end of string)

Recording format: <NN.NN>

Example:

s=("get substring 1234567890");//string

w=("to");// substring to start with

x=("\r");//substring to end with, "\r"end of string

y=get_substr(s,w,x);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<get substring 1234567890>,name<s>,time<16:34:13>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<sub>,name<w>,time<16:34:13>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<\r>,name<x>,time<16:34:13>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<substring 1234567890>,name<y>,time<16:34:13>,date<24-09-04>

Example:

s=("get substring 1234567890");//string

w=("to");// substring to start with

x=(1);//substring to end with, "\r"end of string

y=get_substr(s,w,x);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<get substring 1234567890>,name<s>,time<16:36:26>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<sub>,name<w>,time<16:36:26>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<1>,name<x>,time<16:36:26>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<substring >,name<y>,time<16:36:26>,date<24-09-04>

strltrim[1]

Remove spaces on the left.

Format: y=strltrim(w); where yresult string value, wstring

Example:

w=("    remove spaces on the left");//string

y=strltrim(w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<    remove spaces on the left>,name<w>,time<17:07:49>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<remove spaces on the left>,name<y>,time<17:07:49>,date<24-09-04>

strrtrim[1]

Remove spaces on the right.

Format: y=strrtrim(w); where yresult string value, wstring

Example:

w=("Remove spaces on the right         ");//string

y=strrtrim(w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<Remove spaces on the right         >,name<w>,time<17:18:35>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<Remove spaces on the right>,name<y>,time<17:18:35>,date<24-09-04>

stratrim[1]

Remove spaces on both sides.

Format: y=stratrim(w); where yresult string value, wstring

Example:

w=("   remove spaces on both sides   ");//string

y=stratrim(w);

Event received:

Event : CORE  VAR_CHANGED int_obj_id<1>,value<   remove spaces on both sides   >,name<w>,time<17:27:44>,date<24-09-04>

Event : CORE  VAR_CHANGED int_obj_id<1>,value<remove spaces on both sides>,name<y>,time<17:27:44>,date<24-09-04>

Note

The date<DD-MM-YY> and time<HH:MM:SS> functions return the current date and time. The pi<3,1415926535897932384626433832795> function returns the value of π.
  • No labels