[74] | 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. |
---|
[1] | 14 | *----------------------------------------------------------------------- |
---|
| 15 | * Author: Tiago Osório |
---|
| 16 | * $Id: HiLoSelect.mso 683 2008-11-19 21:21:38Z bicca $ |
---|
| 17 | *---------------------------------------------------------------------*# |
---|
| 18 | |
---|
| 19 | using "types"; |
---|
| 20 | |
---|
| 21 | Model HiLoSelect |
---|
| 22 | |
---|
[293] | 23 | ATTRIBUTES |
---|
[683] | 24 | Pallete = false; |
---|
[306] | 25 | Icon = "icon/HiLoSelect"; |
---|
[293] | 26 | Brief = "Model HiLo Select."; |
---|
| 27 | Info = |
---|
[354] | 28 | "== Inputs == |
---|
| 29 | * Two different input signals. |
---|
[293] | 30 | |
---|
[354] | 31 | == Outputs == |
---|
| 32 | * One output signal. |
---|
| 33 | "; |
---|
[293] | 34 | |
---|
[1] | 35 | PARAMETERS |
---|
[293] | 36 | Select as Switcher (Brief="HiLoSelect option", Valid=["higher","lower"], Default="higher"); |
---|
[1] | 37 | |
---|
| 38 | VARIABLES |
---|
| 39 | input1 as Real (Brief="input signal 1"); |
---|
| 40 | input2 as Real (Brief="input signal 2"); |
---|
| 41 | output as Real (Brief="output signal"); |
---|
| 42 | |
---|
| 43 | EQUATIONS |
---|
| 44 | |
---|
[293] | 45 | switch Select |
---|
| 46 | |
---|
| 47 | case "higher": |
---|
| 48 | |
---|
| 49 | "Calculate output maximum" |
---|
| 50 | output = max([input1,input2]); |
---|
| 51 | |
---|
| 52 | case "lower": |
---|
| 53 | "Calculate output minimum" |
---|
| 54 | output = min([input1,input2]); |
---|
[1] | 55 | end |
---|
| 56 | |
---|
| 57 | end |
---|