1 | #*------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
3 | * |
---|
4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
6 | * http://www.enq.ufrgs.br/alsoc. |
---|
7 | * |
---|
8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | *-------------------------------------------------------------------- |
---|
16 | * Sample file for some useful functions. |
---|
17 | *-------------------------------------------------------------------- |
---|
18 | * Author: Gerson Balbueno Bicca |
---|
19 | * $Id: manipulation.mso 83 2006-12-14 20:29:34Z bicca $ |
---|
20 | *--------------------------------------------------------------------*# |
---|
21 | using "types"; |
---|
22 | |
---|
23 | #++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
24 | # |
---|
25 | # EMSO sample file of some useful functions |
---|
26 | # |
---|
27 | # -------------------------------------------- |
---|
28 | # Function | EMSO Built-In |
---|
29 | # -------------------------------------------- |
---|
30 | # absolute value | abs(x) |
---|
31 | # maximum value | max(x) |
---|
32 | # minimum value | min(x) |
---|
33 | # sign of a real number | sign(x) : -1 if x < 0 |
---|
34 | # 1 if x > 0 |
---|
35 | # smallest integer | round(x) |
---|
36 | # |
---|
37 | #++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
38 | |
---|
39 | FlowSheet Functions |
---|
40 | |
---|
41 | PARAMETERS |
---|
42 | |
---|
43 | Number(2) as Real; |
---|
44 | |
---|
45 | VARIABLES |
---|
46 | |
---|
47 | absolute(2) as Real (Brief ="abs function"); |
---|
48 | maximum(2) as Real (Brief ="max function"); |
---|
49 | minimum(2) as Real (Brief ="min function"); |
---|
50 | signal(2) as Real (Brief ="sign function"); |
---|
51 | rounds(2) as Real (Brief ="round function"); |
---|
52 | |
---|
53 | SET |
---|
54 | |
---|
55 | Number = [-10.3,5.001]; |
---|
56 | |
---|
57 | EQUATIONS |
---|
58 | |
---|
59 | absolute = abs(Number); |
---|
60 | maximum = max(Number); |
---|
61 | minimum = min(Number); |
---|
62 | signal = sign(Number); |
---|
63 | rounds = round(Number); |
---|
64 | |
---|
65 | OPTIONS |
---|
66 | Dynamic = false; |
---|
67 | |
---|
68 | end |
---|