The Web-based Transfer Function Simulator is a simplistic (yet quite powerful) imitation of commercial products such as Simulink(r) by MathWorks(c) or PLECS(r) by PLEXIM(c). The purpose behind providing the simulator is simple: not everyone has access to Simulink. Alternatively, there might not a free license at the time or simply one would like to explore the design of control systems online on a machine without installed MatLab.
At the moment, these options are available:
Maximum zoom-in factor : 13 (number of pixels per unit distance, e.g., the scope block is 4x4).
Maximum zoom-out factor : 8 (number of pixels per unit distance, e.g., the scope block is 4x4).
End time. Fixed at the moment.
Simulation steptime. Fixed at the moment.
Commences a time domain simulation. Progress in shown in a progress bar located in the upper right corner.
Shows relevant schematic/simulation info, such as number of blocks, code version, simulation settings, etc.
Shows debug info, such as connection source, port net connection, etc.
Downloads the simulation to your computer as a JSON textfile, including the simulation settings.
Upload a saved simulation from your computer.
At the moment, these blocks are available:
The summing junction block can have up to three input connections with "+", "-", and "|" notations. Connection ports start from top and continue to the left and the bottom.
Proportional gain. The output signal is equal to the inputs signal times the gain block parameter.
A continuous-time integrator. The output signal is calculated as the integral of the input signal over time. Backward Euler approximation is used.
Each integrator might have an initial condition which is loaded during the first simulation step.
A continuous-time transfer function. Backward Euler approximation is used.
Order of the denominator must be higher or equal to the numerator order. Second-order is the maximum order of the transfer function block.
The output of the block is equal to the block parameter at all times.
The scope block monitors any waveform in the schematics.
The maximum number of scopes is 4.
The step function block outputs the "Initial value" until the simulation time hits the "Time" parameter, after which the block outputs the "Final value".
The output of the block is a ramp with these parameters:
The Saturation Block clamps the incoming signal between the "Lower Limit" and "Upper Limit" values.
The output of the block is a sine wave with these parameters:
Frequency (+/-100 Hz max)
Phase offset [rad]
Perturbation is used to determine the transfer function of an element or a group of elements, either open-loop or closed-loop.
Careful! Saturation blocks tend to invalidate results.
The main purpose of this window is to let user delete highlighted connections.
Two simulation settings are available: end-time and simulation time step. The time step is currently fixed at 10 us (this limits the maximum reasonable pole frequency to ~ 5 kHz). The end time could be as short as 100 ms and as long as 10 s.
The Simulation Info pop-up displays the number of blocks in the simulation as well as the number of connections and all simulation settings. It truly is an FYI feature.
Behind the Scene
Schematic Block Connections
Each connection is a "tree" - that is, each connection is an object. The master connection starts at an absolute position and an "xy" vector with differential values determines shape of the connection.
Connection starts with the sink port. That is, each connection can have only one driver.
Each fork in a connection is the place where the parent connection has at least (but three at most) children connections. Children connections do not have the absolute position available.
The picture below shows the actual connection object for the longer connection in the accompanying schematic.
The following describes the behavior when extending a connection.
When extending a connection:
End connection extension
a. If the previous connection is vertical, start vertical
b. If the previous connection is horizontal, start horizontal
Start of existing connection
a. The same as 1a)
b. The same as 1b)
Middle of an existing connection
a. Always perpendicular
a. Have a unity length stub in the direction of the port (could be any of the four)
When dropping a connection:
In open space - follow the rules above
On a block port - have a unity length stub
On a net (must be a master connection sink) - both rotations are ok
Cannot drop the connection on:
a. Existing connection except starts of other nets
b. Occupied sink ports (covered by condition a)
c. Source ports
a. Ends of the same net
b. Sink ports
c. Master nets start
Allow the user to save and load schematics. This will likely be done using JSON, but of course the existing data structures used for connections and blocks are not supported.
Existing connections could be dragged around. This is difficult, however, since many times parent canopy would be affected as well.
Detect algebraic loops
Currently the simulator does not detect algebraic loops and therefore does not produce correct results if there are some.
The simulator steps through all existing nets and calculates the next step individually - using backward Euler approximation. This leads to errors over time. But this is not a Simulink replacement...
If a pole is at a very high frequency (say more than 1/100th of the step frequency), the step should be adjusted.
Add additional blocks
Started work on Web-based Simulator.
Enabled Save/Load functionality
Added the info/error bar
Fixed bug when a connection was drawn across terminals of a block and the block spliced the connection
Save/Load now captures all connections, blocks, and simulation settings data
Restored the "Delete Selection" button
mouseCarry.existing is now initialized correctly (-1)
Simulation Settings object now supports the "fixed" property such that deletion or location modification is not allowed
Fixed the issue with transfer function output - the internal memory vector did not restart properly, which caused the very first output to track the last simulation result.
Library can now be disabled; this will be useful for built-in fixed examples
Disabled the Delete key press action (to prevent diagram block deletion when modifying block parameters)
Info bar now shows error and info symbols
Error is correctly shown when placing more scope than allowed (4 max).
The library browser now supports multiple pages.
Added ramp source block functionality.
When transfer function numerator order is higher than the denominator order, the simulation throws an error and does not run.
Added saturation block functionality.
All menus are now a pop-up. The scope feature was moved to the right of the block diagram.
Simplified pop-up menus.
Simulation info is now a pop-up menu.
Simulation end-time is now applied correctly.
Added sine wave block functionality.
The simulator now checks for "demo" flag in the url. If a certain flag is met, an appropriate demo is loaded.