Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi,
How to speed up calculation/plotting/update time for vL1(t)?
Try changing for example value of R1 from 1 to 2, and compare the time needed for the two graphs to update each other.
vL1(t) plot will take longer to update than iC1(t) and vC1(t) plot. There are some ways to reduce calculation/plotting time for vL1(t)? Or what is the reason of why vL1(t) take much longer time to calculate/plot/update than iC1(t) and vC1(t) calculate/plot/update plot time?
Solved! Go to Solution.
A rather coarse timing of parts of the sheet can be achieved using the time() function as you sure have seen already often in this forum. It is not overly accurate, though, and I would only use it with multithreading switched off.
But in the case of the function you initially asked for you should not need a program as you can surely see the difference "with free eye".
In the attached sheet I compare the calculation speed of your original definition of v.L1, my approach using the second derivative and then my last attempt with the solve block. The results are quite clear.
A simple way to speed up the calculation of v.L1 is to define that function as being the second derivative of v.C1
Here is an even speedier approach.
I don't like the idea of making the solve block more complicated as necessary but on the other hand this allows us to completely avoid the more time-consuming numerical differentiation.
Do You know a program that calculates how long it takes to odesolve block to make/finish the itself block calculation and then how long it takes to the plot to plot/show the graphs?
A rather coarse timing of parts of the sheet can be achieved using the time() function as you sure have seen already often in this forum. It is not overly accurate, though, and I would only use it with multithreading switched off.
But in the case of the function you initially asked for you should not need a program as you can surely see the difference "with free eye".
In the attached sheet I compare the calculation speed of your original definition of v.L1, my approach using the second derivative and then my last attempt with the solve block. The results are quite clear.
Hm, look at this Werner in the case of integral:
I found also something strange or at least interesting:
With first variant:
With second variant:
Two different answers...
I see that this second variant is more better than the first one, but I do not have any explanation as they seems to be almost the same calculation...maybe the initial condition of ic1(0) and vL1(0) to have an influence here?
On the other hand: look at vL1(t) plot
With first variant:
With second variant:
Though I think I will stay with first variant, and only I will put in the end as below to have more rapidly calculation/plotting:
But anyway, its pretty good also like that. Thank you @Werner_E
I don't see what you think that is not OK with the second variant
But of course you should use whatever fits your needs
Use t not tend.
@Cornel wrote:
I found also something strange or at least interesting:
Thats very strange, indeed. I would call it a bug. If you set t.end to 1.2 ms or higher instead of 1 ms you get what seems to me the correct result and not just a constant function.
You may consider reporting this to PTC support.
Not sure what you want to show with that picture.
If its just that the second one takes too long and the third one fails, then ts one more reason to use the first approach 😉
The reason why the last one fails is similar to the one explained here: Re: How to show all values of this variable?
I also wonder why you are trying to plot a constant function (horizontal line). The definite integral would be evaluated for every single t-value used in the plot ant thats very time consuming for the last two methods.
Or did you mean