LTspice - limiting the number of decimals
 User Name Stay logged in? Password
 Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read Search

 Software Tools SPICE, PCB CAD, speaker design and measurement software, calculators

 Please consider donating to help us continue to serve you. Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
 Thread Tools Search this Thread
 25th December 2017, 01:20 PM #1 SSassen   diyAudio Member     Join Date: Mar 2005 Location: Beta Zeticuly LTspice - limiting the number of decimals Alright, can't seem to figure this one out, not helped by the fact my Google-Fu is not what it used to be due to excessive intake of sugary treats (it is Christmas afterall). I have a schematic drafted where I want to label a number of nodes with their DC voltages in a transient analysis. I do this by simply left clicking on the nodes in question, et voila, the DC voltage shows up. However, it shows up formatted with 5 decimal places, which is a little too much. I'd like to round that off to one or two decimal places. If I however right click the node and add the expression 'round(V(a1))' to round off the voltage at node 'a1' it rounds off to no decimal numbers, which in my case means that 1.38798V is rounded to 1V, that's not what I'm after, I'd like to see either 1.4V or 1.39V. Any of you fine gentlemen know how to accomplish this undoubtedly trivial feat? Thanks and Merry Christmas! __________________ Mediocre is not my middle name.
 25th December 2017, 01:35 PM #2 jazbo8 diyAudio Moderator     Join Date: Jan 2011 Location: In Transient Try round(V(a1)*1000k)/1000k.
SSassen
diyAudio Member

Join Date: Mar 2005
Location: Beta Zeticuly
Quote:
 Originally Posted by jazbo8 Try round(V(a1)*1000k)/1000k.
Thanks, but no, still shows as 1.38987V.
__________________
Mediocre is not my middle name.

 25th December 2017, 01:39 PM #4 SSassen   diyAudio Member     Join Date: Mar 2005 Location: Beta Zeticuly Ha! This seems to work, but looks like a bit of a cumbersome workaround? round(V(a2)*0.01k)/0.01k __________________ Mediocre is not my middle name.
jan.didden
diyAudio Member

Join Date: May 2002
Location: Westende Resort, BE coast
Quote:
 Originally Posted by SSassen Alright, can't seem to figure this one out, not helped by the fact my Google-Fu is not what it used to be due to excessive intake of sugary treats (it is Christmas afterall). I have a schematic drafted where I want to label a number of nodes with their DC voltages in a transient analysis. I do this by simply left clicking on the nodes in question, et voila, the DC voltage shows up. However, it shows up formatted with 5 decimal places, which is a little too much. I'd like to round that off to one or two decimal places. If I however right click the node and add the expression 'round(V(a1))' to round off the voltage at node 'a1' it rounds off to no decimal numbers, which in my case means that 1.38798V is rounded to 1V, that's not what I'm after, I'd like to see either 1.4V or 1.39V. Any of you fine gentlemen know how to accomplish this undoubtedly trivial feat? Thanks and Merry Christmas!
Sander I think it should be round(V(a1),2) . Does that work?

BTW, my latest install of LTspiceXVII crashes every 10 minutes or so. On two different machines, a laptop and a PC, both running W10 Pro. Anybody seen this too, know why?

Jan
__________________
Cable: a potential source of trouble interconnecting two other potential sources of trouble - Erik Margan
Linear Audio pubs and articles . The SilentSwitcher now at diyaudio store SilentSwitcher. Keeping in touch with SY.

 25th December 2017, 01:41 PM #6 jazbo8 diyAudio Moderator     Join Date: Jan 2011 Location: In Transient The x1000k seems to work with current reading but not voltage.
SSassen
diyAudio Member

Join Date: Mar 2005
Location: Beta Zeticuly
Quote:
 Originally Posted by jan.didden Sander I think it should be round(V(a1),2) . Does that work?
No, unfortunately not, syntax error.

Quote:
 Originally Posted by jan.didden BTW, my latest install of LTspiceXVII crashes every 10 minutes or so. On two different machines, a laptop and a PC, both running W10 Pro. Anybody seen this too, know why?
Using W10 Pro (64bit) here too, have not had it crash yet (fingers crossed).
__________________
Mediocre is not my middle name.

jan.didden
diyAudio Member

Join Date: May 2002
Location: Westende Resort, BE coast
Quote:
 Originally Posted by jazbo8 The x1000k seems to work with current reading but not voltage.
Try .option numdgt = 3

Default, numdgt = 6.
Historically "numdgt" was used to set the number of significant figures used for output data. In LTspice, if "numdgt" is set to be > 6, double precision is used for dependent variable data.

Found it in here: Linear Audio | your tech audio resource ;-)

Jan
__________________
Cable: a potential source of trouble interconnecting two other potential sources of trouble - Erik Margan
Linear Audio pubs and articles . The SilentSwitcher now at diyaudio store SilentSwitcher. Keeping in touch with SY.

 26th December 2017, 07:57 AM #9 jazbo8 diyAudio Moderator     Join Date: Jan 2011 Location: In Transient The above command controls the precision of the calculation, not the number of decimal places that LTSpice displays AFAIK. In any case, after further searches, here is the way to limit the decimal places per ltwiki: Undocumented LTspice - LTwiki-Wiki for LTspice Code: ```round(\$*1k)/1k ; display no more than 3 digits (typically automatically expressed in engineering format). round(I(R1)*1k)/1k ; same display format as above, but expression is of the current through R1. round(V(1,2)*1k)/1k ; same format, but expression is of the voltage difference between nodes 1 & 2.```
SSassen
diyAudio Member

Join Date: Mar 2005
Location: Beta Zeticuly
Quote:
 Originally Posted by jazbo8 The above command controls the precision of the calculation, not the number of decimal places that LTSpice displays AFAIK.
Exactly, that was the 1st thing I tried.

Quote:
 Originally Posted by jazbo8 In any case, after further searches, here is the way to limit the decimal places per ltwiki: Undocumented LTspice - LTwiki-Wiki for LTspice Code: ```round(\$*1k)/1k ; display no more than 3 digits (typically automatically expressed in engineering format). round(I(R1)*1k)/1k ; same display format as above, but expression is of the current through R1. round(V(1,2)*1k)/1k ; same format, but expression is of the voltage difference between nodes 1 & 2.```
Yeah, that's basically what we discussed in previous replies, it is a bit cumbersome though, as you'll have to manually relabel every node, rather than apply a global rule that applies to all number rounding.
__________________
Mediocre is not my middle name.

 Thread Tools Search this Thread Search this Thread: Advanced Search

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Site     Site Announcements     Forum Problems Amplifiers     Solid State     Pass Labs     Tubes / Valves     Chip Amps     Class D     Power Supplies     Headphone Systems Source & Line     Analogue Source     Analog Line Level     Digital Source     Digital Line Level     PC Based Loudspeakers     Multi-Way     Full Range     Subwoofers     Planars & Exotics Live Sound     PA Systems     Instruments and Amps Design & Build     Parts     Equipment & Tools     Construction Tips     Software Tools General Interest     Room Acoustics & Mods     Music     diyAudio.com Articles     Car Audio     Everything Else Member Areas     Introductions     The Lounge     Clubs & Events     In Memoriam The Moving Image Commercial Sector     Swap Meet     Group Buys     The diyAudio Store     Vendor Forums         Vendor's Bazaar         Sonic Craft         Apex Jr         Audio Sector         Acoustic Fun         Chipamp         DIY HiFi Supply         Elekit         Elektor         Mains Cables R Us         Parts Connexion         Planet 10 hifi         Quanghao Audio Design         Siliconray Online Electronics Store         Tubelab     Manufacturers         AKSA         Audio Poutine         Musicaltech         Holton Precision Audio         CSS         exaDevices         Feastrex         GedLee         Head 'n' HiFi - Walter         Heatsink USA         miniDSP         SITO Audio         Twin Audio         Twisted Pear         Wild Burro Audio

 Similar Threads Thread Thread Starter Forum Replies Last Post Elvee Software Tools 1 25th August 2010 09:06 PM Deltat Power Supplies 11 31st March 2006 03:38 PM richie00boy Solid State 17 29th August 2004 03:25 AM sam9 Solid State 3 2nd October 2003 12:45 PM

 New To Site? Need Help?

All times are GMT. The time now is 10:57 PM.

 Home - Contact Us - Advertise - Rules - diyAudio Store - Sponsors - Privacy Statement - Terms of Service - Top - Opt-out policy

Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 15.79%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Copyright ©1999-2018 diyAudio
Wiki