During an iteration, what triggers the code in a C-block to run? Is it immediately after all its inputs are updated?
Ken
During an iteration, what triggers the code in a C-block to run? Is it immediately after all its inputs are updated?
Ken
The DLL block processes at each time step. For example, this block only consists of an output port “time” and can return results.
It may be important to note that when using the Ø-Device, the output is returned with one time step delay. (i.e. simulation time step, which can be adaptive)
I’m talking about when it runs within the step. I’m not sure if I need to know but I’m trying to understand the process. During a .tran, for instance, for every step, there must be a huge list of calculations that need to be run. This list could include one or more c-blocks. I imagine that a code block is treated like a node and each node is calculated sequentially starting at the sources.
So, for each step, does the block run only after all its inputs are updated or arbitrarily and the inputs could be values from the previous step?
Regards,
Ken
Hi, kgaler.
If I understand your question correctly, it works like this (after a bit of start-up initialization at sim time == 0):
Hopefully, it’s clear why there’s a delay between input and output as @KSKelvin described.
So, what happens if we have two DLL components and an output of one component (DLL1) is an input to the second (DLL2)?
Assume that DLL1 changes the output at time=t1. DLL2 sees this change at its input at time=t2. Any change in DLL2’s output doesn’t appear in the circuit values until time=t3.
Did that answer your question?
Note: You might want to see the CBlockBasics documents on my GitHub repo.
–robert
Thanks, that helps. Looking at your repo now. Excellent!
Ken
Here is a supplementary to @RDunn for multiple DLL-blocks timing. This is for demonstration purpose, therefore, there are several trick to force the simulation to run at 0.1s time step.
But again, this is NOT system delay. By changing simulation timestep, they can eventually “looks” overlap. Therefore, this delay is step size dependent, here is reducing maxstep to 10ms and 1ms.
As always, nice documentation, Kelvin. Thanks.
That’s right…
The Cblock read the input from previous timestep. Thus the delay.