From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract integer by using ABM

Solved!
Go to solution

Hi everyone,

How can I exctract integer from decimal by using ABM and different functions. For exmaple, if I have 15.5, how can I get 15? Pleace advice. Thunks.

 

 

Miguel_Schultz

Message Edited by Miguel_Schultz on 03-03-2009 05:40 PM
0 Kudos
Message 1 of 2
(3,354 Views)
Solution
Accepted by Miguel_Schultz

Miguel,

 

Unfortunately the data types and functions/operators that can be used in ABM expressions are not as elaborate as in a programming language. You can't cast values and there are currently no floor/ceiling functions. Take a look at the Mathematical Expression section in the SPICE reference guide in Multisim Help to learn about what can be used within expressions.

 

One solution is to make a quantizer using the table function. For example,

 

table(v(1),0,0,0.9999,0,1,1,1.9999,1,2,2)

 

quantizes the values on v(1) to 0,1,2

 

You can alternatively use the VOLTAGE_CONTROLLED_PIECEWISE_LINEAR_SOURCE component from Sources/Controlled_Voltage_Sources family. This component does the same job as the table function.

 

Thanks

Max
National Instruments
0 Kudos
Message 2 of 2
(3,321 Views)