Simulated Real-Time

Virtual Breadboard is a Simulated Real-Time system. This is significantly different to a Real-Time Simulation.

Simulated Real-Time - Simulated Events are REPORTED to occur at the time as they do in the destination hardware. The ACTUAL time of the  REPORT is dependent on the system performance.

REPORTED EVENT TIME <> ACTUAL TIME

Real-Time Simulation - Simulated Events are REPORTED to occur at the same ACTUAL time as they do in the destination hardware.

REPORT EVENT TIME = ACTUAL TIME

Now if we define a Performance Index where

PERFORMANCE INDEX = REPORTED EVENT TIME / ACTUAL TIME

Then Real-Time Simulation has a PERFORMANCE INDEX = 1 and Simulated Real-Time has PERFORMANCE INDEX < 1

TimeStep

The Virtual Breadboard Simulated Real-Time uses a discrete Time Step evaluation model. This Time Step is the pulse of Virtual Breadboard. The size of the Time Step is set using the Step Frequency ListBox

 CH2_1.gif (11131 bytes)

and is the period of the selected frequency. For example, for a 1 Mhz step frequency the Time Step is 1 microsecond.

TIP: The PIC Microcontroller uses a divide by 4 clock hence a 1 Mhz step frequency is equivalent to running a PIC with a 4Mhz clock.

It is important to understand that the Step frequency is NOT a performance setting for Virtual Breadboard itself but rather the time resolution for Virtual Breadboard evaluation. In fact in the same way that a picture printed a 300DPI takes longer to print than the same picture printed at 72DPI increasing the Step frequency often results in SLOWER actual  performance because it increases the resolution of the TimeStep.

 

Evaluation Cycle

When a Virtual Breadboard circuit evaluates it steps through time in TimeStep intervals. Each step all components are informed that TimeStep seconds have elapsed and they change their outputs accordingly. Virtual Breadboard then checks to see if any components Outputs have changed and if they have sweeps the changes through the circuit. During the sweep each components checks their inputs and then determines their outputs. These changes are rippled through the circuit until there are no more changes at which time the process is repeated.

CH2_2.gif (17482 bytes)

The number of steps, the elapsed time which equals the number of steps multiplied by the TimeStep interval and the number of steps per second are displayed by Virtual Breadboard. This is the REPORTED TIME of an event and is the time accurate frame of reference for Virtual Breadboard.

TIP: A pause routine or Watch-Dog timeout of millisecond ACTUAL duration can take several seconds for Virtual Breadboard to evaluate. This can trick you into thinking Virtual Breadboard is not functioning correctly - Always remember to think in Simulated Real-Time and keep an eye on the elapsed time as your frame of reference.

Virtual Breadboard Performance

Simulated Real-Time is very valuable for debugging applications and for being able to spot bugs that would have normally occurred to fast to see. However, raw performance is still very important aspect of productive development. Performance in Virtual Breadboard is measured by the number of steps per second.

Factors that affect performance

Number of Components

The more components in a Breadboard that need evaluation the slower the evaluation cycle.

Type of Components

The Type of component is a critical aspect of performance. There are two fundamental components. Active and Passive. Active components can spontaneously change their output value such as a clock or a microcontroller. Active components are the source of circuit changes. Passive components on the other hand require their inputs to change in order for their outputs to change such as logic gates and LEDS. Passive components have a significantly less performance impact than active components.

Number of Links

The number of links in a circuit increases the complexity of the circuit evaluation sweep decreasing performance

Circuit Frequency

The Circuit frequency which is how often the circuit changes state has the greatest impact on overall performance. For example a circuit with a 555 timer running with a period of 10 steps is going to run significantly slower in terms of steps per second than the exact same circuit with the 555 timer running with a period of 100 steps.

Getting the most out of your Virtual Breadboard circuit often requires an understanding of these factor.

Improving the PERFORMANCE INDEX

Case Study 1: What TimeStep should I use for a circuit with BASICSTAMP

The BASICSTAMP only runs at several thousand instructions per second. Hence it is not always necessary to have a 1 Mhz step frequency. Using a 50khz step frequency will improve the PERFORMANCE INDEX of a BASICSTAMP circuit as long as no other component in the circuit requires the higher resolution. However, special consideration must be made for the type of instructions the BASICSTAMP is using. For example don't expect a 10us resolution from a PULSIN command when running at 50Khz as the resolution of the stepsize is 20us. Hence understanding your circuit and the StepSize is vital for optimising the PERFORMANCE INDEX of a circuit evaluation.