Why does my measure statement fail?
153 11
spiffer00 6 months ago
Could someone, please, help me understand why the measure statement in my schematic fails? The link to the project is: [https://easyeda\.com/editor\#id=\|83a3d312c3bf41a6adb1b88930832a30](https://easyeda.com/editor#id=|83a3d312c3bf41a6adb1b88930832a30)
Comments
cjohnson 6 months ago
@andyfierman should be able to help with that. Did you read his tutorial on setting up simulations?
Reply
andyfierman 6 months ago
@spiffer00, The meas statement refers to the voltage on net **v_max** but you have overwritten that netname by placing a voltage probe on it with a different name. You either have to change the probe name to **v_max** (this is the preferred method) or the meas statement to refer to **volprobe**. You will find the simulation tutorial here: [https://docs.easyeda.com/en/Simulation/Chapter1-Introduction/index.html](https://docs.easyeda.com/en/Simulation/Chapter1-Introduction/index.html) but I recommend you also read section (2) in: [https://easyeda\.com/andyfierman/Welcome\_to\_EasyEDA\-31e1288f882e49e582699b8eb7fe9b1f](https://easyeda.com/andyfierman/Welcome_to_EasyEDA-31e1288f882e49e582699b8eb7fe9b1f) :)
Reply
spiffer00 6 months ago
@cjohnson: I've obviously  read the simulaion tutorial. If I hadn't, how would I know about the measure command? @andyfierman: Thanks for your response. When I remove the probe (volProbe) the simulation will not run as it complains that there is no probe in the schematic. I've tried this as well "meas TRAN max_volt MAX V(volProbe) from=4m to=200m" and "meas TRAN max_volt MAX volProbe from=4m to=200m" and yet in the simulation results I still get the statement "Error: measure limited to tran, dc, sp, or ac analysis meas tran max_volt max v(volprobe) from=4m to=200m failed!".
Reply
spiffer00 6 months ago
Ok, the simulation wasn't running without the probe icon because I hadn't included a probe statement. Now I have included it but  the meas command still fails.
Reply
spiffer00 6 months ago
The new version for the schematic is at the url: [https://easyeda\.com/editor\#id=\|83a3d312c3bf41a6adb1b88930832a30](https://easyeda.com/editor#id=|83a3d312c3bf41a6adb1b88930832a30)
Reply
andyfierman 6 months ago
@spiffer00, OK, I have seen that you have tried again following my advice and that the meas statement still does not work. I have been looking into this for a while just before you modified your sim and now understand what the problem is. * It's a netlist parsing problem. It seems that the time order in which you enter the **meas** statement into the schematic must be _after_ you have entered the **tran** statement in the schematic! The `.control` block at the end of your original netlist looked like this: `.control` `meas TRAN max_volt MAX V(v_max) from=4m to=200m` `tran 10m 1000m 1m``probe V(V_MAX) quit` `.endc``.END`This does not work because the `.control` block sees the **meas** statement first but does not yet know that an analysis appropriate to it is being run because it has not yet seen the **tran** statement. If you first type in the **tran** statement _and then_ type in the **meas** statement the `.control` block sees the the trans statement listed before the meas statement and so knows what analysis is being run and the meas statement then works: `.control` `tran 10m 1000m 1m` `meas TRAN max_volt MAX V(v_max) from=4m to=200m``probe V(V_MAX) quit` `.endc``.END` * Note that it is the time order in which you enter the statements and not the order in which set their text types from **comment** to **spice**. Having the order of netlisting affected by the time order in which statements are entered like this is not very helpful and I'm raising a Bug Report about it.
Reply
spiffer00 6 months ago
Andy, thanks a lot for your insight. Now the meas statement works.
Reply
andyfierman 6 months ago
Sorry but the forum has broken my formatting of the two **.control** block examples. I'll try again... The **.control** block at the end of your original netlist looked like this: > `.control` > `meas TRAN max_volt MAX V(v_max) from=4m to=200m` > `tran 10m 1000m 1m``probe V(V_MAX)``quit``.endc``.END` This does not work because the **.control** block sees the **meas** statement first but does not yet know that an analysis appropriate to it is being run because it has not yet seen the **tran** statement. If you first type in the **tran** statement _and then_ type in the meas statement the **.control** block sees the **tran** statement listed before the meas statement and so knows what analysis is being run and the **meas** statement then works: > `.control` > `tran 10m 1000m 1m` > `meas TRAN max_volt MAX V(v_max) from=4m to=200m``probe V(V_MAX)``quit``.endc``.END`
Reply
andyfierman 6 months ago
I give up. :(
Reply
spiffer00 6 months ago
Andy, I just made sure I entered the original statements without the .control keywords but in the right order from your instructions and the meas command works now. I'm a little wiser about the sequence in which I enter the statements.
Reply
andyfierman 6 months ago
"I just made sure I entered the original statements without the .control keywords" You don't need to enter the .control keyword: the EasyEDA spice netlisting does that for you. "I'm a little wiser about the sequence in which I enter the statements." True but the real issue is that you as a user should not have to worry about the order in which you enter statements into the schematic. If you were writing the .comtrol ... .endc section directly in a text editor maybe but when entering statements into a schematic: the netlister should sort that out for you. For example, does that OK in LTspice. In fact it was only because you found this problem that I realised this was happening at all. I have created various examples of measure statements in EasyEDA but not come across this issue but that is almost certainly because I usually enter the measure statements after I have created the rest of the simulation. Ngspice is also more awkward than LTspice because you do not seem able to use simulation parameters in measure statements the way you can in LTspice. In Ngspice there is a separate .csparam directive that allows you to define parameters for use in measure statements but I really haven't got my head round them and how you pass a simulation parameter into the post simulation measure statement processing yet, so although my examples work, some of them are probably done in a very clumsy way as at the time I created most of them I was not aware of the .csparam directive. :)
Reply
Login or Register to add a comment
goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.