Joe Riel

9660 Reputation

23 Badges

20 years, 6 days

MaplePrimes Activity


These are replies submitted by Joe Riel

The image was not attached. 

@onder there are still two different basisFunction models in the model. Where are those coming from? You really need to eliminate one of the them.

@onder there are still two different basisFunction models in the model. Where are those coming from? You really need to eliminate one of the them.

@Alger The problem occurs when the current in the inductor changes direction.  Consider the current at the left side of the inductor. Before the event, the current is coming through the lower diode (you can verify that by attaching a probe to it).  After the event, the current flow is out of the left side, and must be through the upper diode.  For that to happen, the voltage must instantly switch 100V.  That discontinuous jump causes issues for the integrator. One way to deal with this is to slightly decrease the impedance at the node (from infinity to 1MegOhm).  That provides a path for the current as the voltage switches.

In a real circuit it is not uncommon to put a snubber here, with similar effect, though for different reasons.

@Alger The problem occurs when the current in the inductor changes direction.  Consider the current at the left side of the inductor. Before the event, the current is coming through the lower diode (you can verify that by attaching a probe to it).  After the event, the current flow is out of the left side, and must be through the upper diode.  For that to happen, the voltage must instantly switch 100V.  That discontinuous jump causes issues for the integrator. One way to deal with this is to slightly decrease the impedance at the node (from infinity to 1MegOhm).  That provides a path for the current as the voltage switches.

In a real circuit it is not uncommon to put a snubber here, with similar effect, though for different reasons.

If you post the model here (upload with the green arrow on the toolbar at this site), I can probably tell you what is happening. Usually there are two causes: (1) the simulation is ending early because of some problem (singularity, etc); and (2) the simulation runs to the end, but the computed plot output contains complex values, which do not plot (and are indicative of a modeling issue).

@onder Sorry the slow response.  I haven't as yet been able to successfully run that model. First, I got an error stating that there are duplicate definitions of the BasisFunction model, which, indeed there were. I deleted one of them, then reran.  This time I get internal error: re-causalization limit reached, system may be inconsistent. 


@onder Sorry the slow response.  I haven't as yet been able to successfully run that model. First, I got an error stating that there are duplicate definitions of the BasisFunction model, which, indeed there were. I deleted one of them, then reran.  This time I get internal error: re-causalization limit reached, system may be inconsistent. 


@DanielR Offhand I cannot say what is causing the problem. Possibly you are using an overloaded export of LinearAlgebra in the procedure?

@DanielR Offhand I cannot say what is causing the problem. Possibly you are using an overloaded export of LinearAlgebra in the procedure?

@Markiyan Hirnyk There is supposed to be a vector after the comma; alas, the html ate my angle brackets. I edited the post to fix that.

@Markiyan Hirnyk There is supposed to be a vector after the comma; alas, the html ate my angle brackets. I edited the post to fix that.

@Markiyan Hirnyk The ListTools method doesn't scale well

listhist1 := proc(L)
local  T, i;
    T := table('sparse'):
    for i in L do
        T[i] := T[i]+1;
    end do;
    [seq([i,T[i]], i=sort([indices(T,'nolist')]))];
end proc:

listhist2 := proc(L)
local c;
uses ListTools;
    [seq([c, Occurrences(c, L)], c = sort(MakeUnique(L)))];
end proc:

L := RandomTools:-Generate(list(integer(range=0..100),1000)):

CodeTools:-Usage(listhist1(L), iterations=100):
memory used=71.29KiB, alloc change=0 bytes, cpu time=760.00us, real time=730.00us
CodeTools:-Usage(listhist2(L), iterations=100):
memory used=3.94MiB, alloc change=269.04MiB, cpu time=33.48ms, real time=33.58ms

@Markiyan Hirnyk The ListTools method doesn't scale well

listhist1 := proc(L)
local  T, i;
    T := table('sparse'):
    for i in L do
        T[i] := T[i]+1;
    end do;
    [seq([i,T[i]], i=sort([indices(T,'nolist')]))];
end proc:

listhist2 := proc(L)
local c;
uses ListTools;
    [seq([c, Occurrences(c, L)], c = sort(MakeUnique(L)))];
end proc:

L := RandomTools:-Generate(list(integer(range=0..100),1000)):

CodeTools:-Usage(listhist1(L), iterations=100):
memory used=71.29KiB, alloc change=0 bytes, cpu time=760.00us, real time=730.00us
CodeTools:-Usage(listhist2(L), iterations=100):
memory used=3.94MiB, alloc change=269.04MiB, cpu time=33.48ms, real time=33.58ms

Alas, that won't be terribly efficient.

First 59 60 61 62 63 64 65 Last Page 61 of 195