first commit
This commit is contained in:
82
doc/AudioInput.html
Normal file
82
doc/AudioInput.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Audio Input Element - User Guide</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
color: #333;
|
||||
}
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.note {
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Audio Input Element - User Guide</h1>
|
||||
|
||||
<p>The Audio Input Element allows you to simulate how your circuit would respond to an audio signal. Here's how you can use it:</p>
|
||||
|
||||
<h2>Adding an Audio Input:</h2>
|
||||
<ul>
|
||||
<li>Find the Audio Input element in the components menu under "Inputs and Sources". (In the "Draw" menu, or the right-click menu.)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Loading an Audio File:</h2>
|
||||
<ul>
|
||||
<li>Right-click on the Audio Input element to access its settings, and click "Edit".</li>
|
||||
<li>Click on "Choose File" to select a file.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Supported Formats</h2>
|
||||
The formats supported are whatever your browser supports. This typically includes:
|
||||
|
||||
<ul>
|
||||
<li><span class="format">WAV</span> - Waveform Audio File Format, known for uncompressed audio data.</li>
|
||||
<li><span class="format">AIFF</span> - Audio Interchange File Format, similar to WAV, uncompressed.</li>
|
||||
<li><span class="format">Ogg</span> - Ogg Vorbis, an open, lossy audio compression format.</li>
|
||||
<li><span class="format">MP3</span> - MPEG Audio Layer III, widely used for its good quality-to-file size ratio.</li>
|
||||
<li>
|
||||
<span class="format">MP4</span> - MPEG-4 Part 14 container format which can contain audio:
|
||||
<ul class="subformat">
|
||||
<li><span class="description">AAC</span> - Advanced Audio Coding, often found within MP4 containers.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><span class="format">FLAC</span> - Free Lossless Audio Codec, provides lossless compression.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Adjusting Settings:</h2>
|
||||
|
||||
<h3>Max Voltage:</h3>
|
||||
<ul>
|
||||
<li>This setting determines the peak voltage of the audio signal that will be input into your circuit. Adjust this if your circuit operates at different voltage levels.
|
||||
The audio data will be scaled by this value. So if V is the peak voltage, the output will range from -V to +V. It will be less than this if the audio data in the input file has a smaller range.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Start Position:</h3>
|
||||
<ul>
|
||||
<li>Set where in the audio file you want the simulation to start playing from. This is useful if you only need a portion of the audio or want to skip the silent parts at the beginning.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Use Cases:</h2>
|
||||
<ul>
|
||||
<li>Testing how speakers or audio equipment would react to different sounds.</li>
|
||||
<li>Simulating audio signal processing circuits like filters, amplifiers, or mixers.</li>
|
||||
<li>Educational purposes to demonstrate signal behavior in electronic circuits.</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
53
doc/DataInput.html
Normal file
53
doc/DataInput.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>User's Guide to Using Data Input Element in CircuitJS1</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; margin: 20px;">
|
||||
|
||||
<p>The Data Input Element in CircuitJS1 allows you to simulate a voltage source where the voltage values change over time based on data from a file you provide. It's like connecting a circuit to real-world data or pre-calculated voltage sequences.</p>
|
||||
|
||||
<p><strong>Loading Your Data:</strong></p>
|
||||
<ul>
|
||||
<li><strong>Select a File:</strong>
|
||||
<ul>
|
||||
<li>Once placed, right-click the Data Input Element to access its settings, then select Edit, then Choose File to select a file.</li>
|
||||
<li><em>File Type:</em> Your data file should contain values in volts, one per line, in text format. Comments (lines starting with <tt>#</tt>) or empty lines will be ignored by the system.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>After Selection:</strong> The filename will appear as a label on the element in the circuit for easy identification.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Adjusting Settings:</strong></p>
|
||||
<ul>
|
||||
<li><strong>Scale Factor:</strong> This allows you to multiply all voltage values from your file by a constant. Useful if your data needs adjustment to fit your circuit's scale.</li>
|
||||
<li><strong>Sample Length (Time per Data Point):</strong> Define how much time each voltage value from your file represents. For example, if each value is meant to last for 1 millisecond, you'd set this to <tt>0.001</tt> seconds, or <tt>1m</tt>.</li>
|
||||
<li><strong>Repeat Option:</strong> If checked, the element will start over from the beginning of the file when it reaches the end, effectively looping the data.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Running the Simulation:</strong></p>
|
||||
<ul>
|
||||
<li>With your settings adjusted, start or continue your simulation.</li>
|
||||
<li>The Data Input Element will now output voltages according to the sequence in your file.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Troubleshooting:</strong></p>
|
||||
<ul>
|
||||
<li>If you see "No file" on the element, ensure you've selected a file correctly.</li>
|
||||
<li>If voltages are not as expected, check the Scale Factor and Sample Length.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Tips for Effective Use:</strong></p>
|
||||
<ul>
|
||||
<li><strong>Data Preparation:</strong> Ensure your data file is clean. Any non-numeric data should be commented out with a # at the beginning of the line.</li>
|
||||
<li><strong>Experimentation:</strong> Play with different settings to see how they affect your circuit's behavior.</li>
|
||||
<li><strong>File Saving:</strong> Remember, once you set up your Data Input with a file, if you save your circuit, the data isn't saved within the circuit file. You'll need to keep the original data file or reselect it when loading your circuit.</li>
|
||||
<li><strong>Current Input:</strong> Use this element in conjunction with a VCCS to simulate a current source where the current values change over time.</li>
|
||||
</ul>
|
||||
|
||||
<p>This element is particularly useful for simulating real-world scenarios, testing how circuits respond to custom voltage patterns, or for educational purposes where you want to demonstrate specific voltage behaviors over time.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
42
doc/DelayBuffer.html
Normal file
42
doc/DelayBuffer.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>User's Guide to Using the Delay Buffer Element in CircuitJS1</title>
|
||||
</head>
|
||||
<body style="font-family: Arial, sans-serif; margin: 20px;">
|
||||
|
||||
<h2>Purpose:</h2>
|
||||
<p>The <code>DelayBufferElm</code> in CircuitJS1 is designed to delay the signal from its input to its output by a specified amount of time. This can be useful for synchronization, timing purposes, or to mimic real-world signal propagation delays in digital circuits.</p>
|
||||
|
||||
<h2>Features:</h2>
|
||||
<ul>
|
||||
<li><strong>Delay:</strong> You can set how long the input signal should be delayed before it appears at the output.</li>
|
||||
<li><strong>Threshold:</strong> Determines the voltage level at which the element considers the input as "high" or "low".</li>
|
||||
<li><strong>High Logic Voltage:</strong> Sets the output voltage when the signal is considered "high".</li>
|
||||
</ul>
|
||||
|
||||
<h2>Configuration:</h2>
|
||||
<ul>
|
||||
<li><strong>Delay:</strong> Right-click on the element and select "Edit". Here, you can adjust:
|
||||
<ul>
|
||||
<li><strong>Delay (s):</strong> Set this to the desired delay time in seconds. For example, <tt>0.001</tt> (or <tt>1m</tt>) for a 1ms delay.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Threshold:</strong> Adjust this if your circuit uses non-standard logic levels. Default is set to 2.5V for 5V logic.</li>
|
||||
<li><strong>High Logic Voltage:</strong> Change this if your circuit operates at different voltage levels.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Simulation:</h2>
|
||||
<p>Connect your input signal to the input node. The output will reflect the input signal after the specified delay.</p>
|
||||
|
||||
<h2>Use Cases:</h2>
|
||||
<ul>
|
||||
<li><strong>Synchronization:</strong> In digital circuits where signals from different parts need to arrive at the same time.</li>
|
||||
<li><strong>Debouncing:</strong> To filter out noise or short glitches in signals.</li>
|
||||
<li><strong>Timing Circuits:</strong> For creating time-based logic or pulse stretching.</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
2369
doc/circuits.html
Normal file
2369
doc/circuits.html
Normal file
File diff suppressed because it is too large
Load Diff
64
doc/customfunction.html
Normal file
64
doc/customfunction.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>#header + #content > #left > #rlblock_left,
|
||||
#content > #right > .dose > .dosesingle,
|
||||
#content > #center > .dose > .dosesingle
|
||||
{display:none !important;}</style><style>img[src="http://s05.flagcounter.com/count/pTvk/bg=FFFFFF/txt=000000/border=CCCCCC/columns=6/maxflags=36/viewers=0/labels=0/"]
|
||||
{display:none !important;}</style></head><body><h1>Controlled Source Output Function</h1>
|
||||
The controlled source elements take an output function parameter. The output function takes the inputs, if any,
|
||||
as parameters (which will be <tt>a</tt>, <tt>b</tt>, etc. for a voltage-controlled source, or <tt>i</tt> for a current-controlled source). You
|
||||
can also specify <tt>t</tt> for
|
||||
the current simulation time, <tt>timestep</tt> for the timestep, <tt>pi</tt> for π, and <tt>e</tt> for <i>e</i> (unless there is an input <tt>e</tt>).
|
||||
<p>
|
||||
The function can use arithmetic like <tt>a+b</tt>, <tt>a*b</tt>, <tt>a^2/(b-1)</tt>, etc. It can also use functions like
|
||||
<tt>sin(x)</tt>,
|
||||
<tt>cos(x)</tt>,
|
||||
<tt>abs(x)</tt>,
|
||||
<tt>exp(x)</tt>,
|
||||
<tt>log(x)</tt>,
|
||||
<tt>sqrt(x)</tt>,
|
||||
<tt>tan(x)</tt>,
|
||||
<tt>floor(x)</tt>,
|
||||
<tt>ceil(x)</tt>,
|
||||
<tt>mod(x,y)</tt>,
|
||||
<tt>max(x,y,...)</tt>,
|
||||
and
|
||||
<tt>min(x,y,...)</tt>.
|
||||
</p><p>
|
||||
It can also use conditional expressions like <tt>(a > 5) ? a+1 : b-2</tt>.
|
||||
</p><p>
|
||||
The <tt>tri(x)</tt> function is like <tt>sin(x)</tt>, but generates a triangle waveform.
|
||||
</p><p>
|
||||
The <tt>saw(x)</tt> function is like <tt>sin(x)</tt>, but generates a sawtooth waveform.
|
||||
</p><p>
|
||||
The <tt>step(x)</tt> function is 0 if <tt>x</tt> < 0, and 1 otherwise. (Equivalent to <tt>x >= 0</tt>).
|
||||
The <tt>step(x,y)</tt> function is 1 if 0 < <tt>x</tt> < <tt>y</tt>, and 0 otherwise. (Equivalent to <tt>0 < x && x < y</tt>).
|
||||
</p><p>
|
||||
The <tt>clamp(x,lo,hi)</tt> function is equal to <tt>min(max(x, lo), hi)</tt>.
|
||||
</p><p>
|
||||
The <tt>select(x,a,b)</tt> function is equal to <tt>b</tt> if <tt>x</tt> is greater than zero, and <tt>a</tt> otherwise. So it's the same as <tt>(x > 0) ? b : a</tt>.
|
||||
</p><p>
|
||||
The <tt>pwl(x,x0,y0,x1,y1,x2,y2,...,xn,yn)</tt> function is short for piece-wise linear, and works as follows. If <tt>x < x0</tt>, then
|
||||
the result is <tt>y0</tt>. If <tt>x0 < x < x1</tt>, then the result is a linear interpolation between <tt>y0</tt> and <tt>y1</tt>.
|
||||
If <tt>x1 < x < x2</tt>, the result is a linear interpolation between <tt>y1</tt> and <tt>y2</tt>, etc. If <tt>x > xn</tt>, then the
|
||||
result is <tt>yn</tt>. For example, in the simplest case, <tt>pwl(t,0,0,.1,5)</tt> is a waveform that starts at 0 at time 0 and then
|
||||
ramps to 5 over 100ms, then stays at 5.
|
||||
</p><p>
|
||||
<tt>dadt</tt>, <tt>dbdt</tt>, etc. are equal to the time derivative of <tt>a</tt>, <tt>b</tt>, etc.
|
||||
<tt>lasta</tt>, <tt>lastb</tt>, etc. are equal to the value of <tt>a</tt>, <tt>b</tt>, etc. in the previous timestep.
|
||||
<tt>lastoutput</tt> is equal to value of the output function in the previous timestep.
|
||||
Examples:
|
||||
<ul>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+58+5+50%0A213+464+288+528+288+0+2+-(a-b)/1000%0Aw+464+288+464+240+0%0Aw+464+240+560+240+0%0Aw+560+240+560+288+0%0Aw+464+320+464+368+0%0Aw+464+368+560+368+0%0Aw+560+368+560+320+1%0Ag+464+368+464+400+0%0AR+464+240+464+176+0+0+40+5+0+0+0.5%0A">Resistor</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+58+5+50%0A213+464+288+528+288+0+3+-(a-c)/(1000*(1%5Cpb))%0Aw+464+288+464+240+0%0Aw+464+240+560+240+0%0Aw+560+240+560+288+0%0Aw+464+384+560+384+0%0Aw+560+384+560+320+1%0Ag+464+384+464+416+0%0AR+464+240+464+176+0+0+40+5+0+0+0.5%0Aw+464+352+464+384+0%0AR+464+320+400+320+0+2+40+2+3+0+0.5%0A">Varying Resistor</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+57+5+50%0Av+96+256+96+112+0+1+40+5+0+0+0.5%0Ag+96+256+96+304+0%0Aw+192+208+192+256+0%0Aw+336+176+336+256+0%0Ar+192+256+336+256+0+2000%0Ar+96+256+192+256+0+1000%0Aw+96+112+192+112+0%0Aw+192+112+192+176+0%0AO+336+176+400+176+0%0A212+192+176+288+176+0+2+(a-b)*1000%0Ag+288+208+288+224+0%0Aw+288+176+336+176+0%0Ao+0+64+0+4098+10+0.00009765625+0+2+0+3%0Ao+8+64+0+4098+20+0.00009765625+1+1%0A">Op-Amp</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+57+5+50%0Av+96+336+96+176+0+1+40+5+0+0+0.5%0Ag+96+336+96+384+0%0Aw+160+208+160+336+0%0Aw+352+176+352+336+0%0Ar+160+336+352+336+0+2000%0Ar+96+336+160+336+0+1000%0AO+352+176+464+176+0%0A212+224+176+320+176+0+4+clamp((a-b)*1000,d,c)%0Aw+320+176+352+176+0%0Aw+160+208+224+208+0%0Aw+96+176+224+176+0%0Ag+320+208+320+224+0%0AR+224+240+192+240+0+0+40+10+0+0+0.5%0AR+224+272+192+272+0+0+40+-10+0+0+0.5%0Ao+0+64+0+4098+10+0.00009765625+0+2+0+3%0Ao+6+64+0+4098+20+0.00009765625+1+1%0A">Op-Amp With Rails</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+50%0A212+496+272+544+272+0+2+a*b%0AR+496+272+448+272+0+1+40+5+0+0+0.5%0Aw+496+304+496+336+0%0AR+496+336+448+336+0+1+88+5+0+0+0.5%0Ag+592+304+592+320+0%0AO+592+272+672+272+0%0Ao+1+64+0+12291+24.99332860963738+0.0001+0+5+1+3+3+0+3+3+5+0%0A">Multiplier</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+16.817414165184545+50+5+50%0A212+496+272+544+272+0+1+abs(a)%0AR+496+272+448+272+0+1+40+5+0+0+0.5%0Ag+592+304+592+320+0%0AO+592+272+672+272+0%0Ao+1+64+0+12291+5.000000000000001+0.0001+0+3+1+3+3+0%0A">Full Rectifier</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+50%0A212+448+224+480+224+0+0+pwl(t,0,0,.1,5)%0Ag+544+256+544+288+0%0Ar+544+224+624+224+0+1000%0Ag+624+224+624+256+0%0Ao+2+64+0+4098+5+0.003125+0+2+2+3%0A">Voltage Ramp</a>
|
||||
<li><a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+50%0A214+304+192+336+192+0+2+i%0A214+304+288+352+288+0+2+i%0A213+464+240+480+240+0+2+a%5Cpb%0Aw+400+192+464+192+0%0Aw+464+192+464+240+0%0Aw+400+288+464+288+0%0Aw+464+288+464+272+0%0Ag+400+224+400+256+0%0Ag+400+320+400+352+0%0Aw+560+240+560+208+0%0Aw+560+208+624+208+1%0Ar+624+208+624+304+0+1000%0Aw+560+272+560+304+0%0Aw+560+304+624+304+0%0Ag+624+304+624+320+0%0Ai+224+192+304+192+0+0.015%0Aw+224+192+224+224+0%0Aw+224+224+304+224+0%0Aw+224+288+224+320+0%0Aw+224+320+304+320+0%0Ai+224+288+304+288+0+0.005%0A">Current Adder</a>
|
||||
<li><a href="../circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAXKQUgoFMBaMMAKAHMRjCQUUAWTt0wooUFgDdBPflLB8BtEX1pJa2aHLAJiRBNgR4yxbFGgIJs+VLy1FIGz1G2zLAA7gUee7TCfpCpxYAdyleAV8vMLEQrm8PLwdIYPi4sAxuRJYUX3B01J04nxAAGwBDAGcAFwB7AFdK13qAHVdKgEsAWzoqulcAKjA4PtL2HgwRZhFhcCtbFgB5MZEHbDRCsWqQE1XRZWIvQdN4SDJCBEIUVXAQNoA7RsqWTeItkVo9rz5oImJ5Y+OUC8YPAIKCWEA">Integrator</a>
|
||||
<li><a href="../circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAXKQUgoFMBaMMAKADdwwUQUFDPuxfrWwgALLSS0w0SpAxDsRBWLxDhslgHMBPPrtxioUFii7hCtIT3whr0kAGMANgEMAtgAcAFABNXvgAuAFSwYAA0ADoAzkwIUdFgCACULADuutZglnbC2nr8XHgFFrRlLADyJdaGucaQLAD2xkrGEsTFYGVhvMbcIk0UIK207cVoUNAQ0yxAA">Differentiator</a>
|
||||
<li><a href="../circuitjs.html?ctz=CQAgjCAMB0l3BWcAWaAmAzAgbBjB2BSfZBNBADhASVsmoFMBaMMAKADdx9sQ1803XhXr1BYeklFRoCNgCchIESDzDpYEWwDuS-oLV8BUNmjDJVGXuYtWqNqCAsATAIbOALgCoARl+RwOpbqwSgWkEHIGOI8TtFGghG6UYL6oWlJoWCxGJAW2byZufk5eeBgiUHF5YIpNSbJ8ay1TcjhbACWfBRUaJBUhn1UorDExACck1PTU3K6aD18-d29AQ0rfGuDaxEA9o7Y4U6Qk9QykPz4V9c3+BQ4+I6JqmwY9hAjcB+wggCSAHbOACuAGMPK5-iCGGwgA">Variable Inductor</a>
|
||||
<li><a href="../circuitjs.html?ctz=CQAgjCAMB0l3BWcAWaAmAzAgbBjB2BSfZBNBADhASVsmoFMBaMMAKADcQ01luduvEBXr003eklFRoCNgCdBfESDzZh0sCLYB3Jf3VqDUNmjAZVGdWGR8rVG33oWmACgAmAQ3cAXJu4BjXwBKACoAI1DYeHY9IxUjRxM9ZAxxFVTxJMhdS3U0SCojcnUclLTwfHVM4zK8jRAalTrigRqSkwBzeo7i-HFRNgAlerAq7goHcelkelQATmwpKBk5AHsVirnIefmQbFkEKxliecoweYo0bDAbpcwVgdU2DAcIUVlwegBhTwAHTwBACWPk8ADsAgw2EA">Variable Capacitor</a>
|
||||
</ul>
|
||||
</body></html>
|
145
doc/customlogic.html
Normal file
145
doc/customlogic.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>#header + #content > #left > #rlblock_left,
|
||||
#content > #right > .dose > .dosesingle,
|
||||
#content > #center > .dose > .dosesingle
|
||||
{display:none !important;}</style><style>img[src="http://s05.flagcounter.com/count/pTvk/bg=FFFFFF/txt=000000/border=CCCCCC/columns=6/maxflags=36/viewers=0/labels=0/"]
|
||||
{display:none !important;}</style></head><body><h1>Custom Logic</h1>
|
||||
You can implement your own simple logic devices with custom logic chips. (located under "Digital Chips")
|
||||
<p>
|
||||
Every custom logic device has a model name, which points to a model that describes how it works. You can have any number of
|
||||
devices with the same model. Editing the model changes the behavior of all devices that use that model.
|
||||
</p><p>
|
||||
When editing the model, you specify the inputs, the outputs, some info text (which is shown in the lower right
|
||||
corner when hovering the mouse over a device), and the definition.
|
||||
</p><p>
|
||||
The inputs (and outputs) is a comma separated list of <b>short</b> pin labels (one or two characters max). You can also
|
||||
specify inverted labels, like <tt>/Q</tt> for <span style="text-decoration: overline">Q</span>. Example: <tt>A,B,/C,/D</tt>
|
||||
</p><p>
|
||||
The definition is multiple lines of the form <i>input</i><tt>=</tt><i>output</i>. The first <i>input</i> pattern that matches the
|
||||
input pins is chosen, and the output pins are set to match the <i>output</i> pattern. The pattern can contain bit values
|
||||
(<tt>0</tt>, <tt>1</tt>), transitions (<tt>+</tt>, <tt>-</tt>), wildcards/don't cares (<tt>?</tt>), and pattern letters
|
||||
(<tt>A</tt>, <tt>B</tt>, etc.). The <i>input</i> has to be at least as long as the number of input pins. If it's longer,
|
||||
than the additional pattern characters will be matched against the output pins; this allows you to create devices with state.
|
||||
</p><p>
|
||||
The output pattern can also contain <tt>_</tt> to indicate a high-impedance state.
|
||||
</p><p>
|
||||
Examples:
|
||||
</p><p>
|
||||
</p><h3> 3 input NAND: </h3>
|
||||
<p>
|
||||
Inputs: <tt>A,B,C</tt><br>
|
||||
Outputs: <tt>X</tt><br>
|
||||
Definition:</p><pre>111=0
|
||||
???=1
|
||||
</pre>
|
||||
<p>
|
||||
If all three inputs are 1, the output is 0. Otherwise, it's 1.
|
||||
</p><p>
|
||||
</p><h3>Full adder:</h3>
|
||||
<p>
|
||||
Inputs: <tt>A,B,C</tt><br>
|
||||
Outputs: <tt>S,C</tt><br>
|
||||
Definition:</p><pre>111=11
|
||||
110=10
|
||||
011=10
|
||||
101=10
|
||||
100=01
|
||||
010=01
|
||||
001=01
|
||||
000=00
|
||||
</pre>
|
||||
<h3>SR Latch:</h3>
|
||||
<p>
|
||||
Inputs: <tt>S,R</tt><br>
|
||||
Outputs: <tt>Q,/Q</tt><br>
|
||||
Definition:</p><pre>?? 00=10
|
||||
10 ??=10
|
||||
01 ??=01
|
||||
?? AB=AB
|
||||
</pre>
|
||||
The input pattern (the left side of the equals sign) matches S, R, Q, and
|
||||
<span style="text-decoration: overline">Q</span>, in that order. The right side of
|
||||
the equals sign specifies the resulting Q and
|
||||
<span style="text-decoration: overline">Q</span>.
|
||||
<p>
|
||||
The first line sets the Q output if both outputs are low (this is needed
|
||||
when resetting the circuit).
|
||||
The next line sets the outputs to 1,0 if set is high. The second line
|
||||
sets the outputs to 0,1 if reset is high. The next
|
||||
line keeps the outputs the same otherwise. (The first two letters match
|
||||
the input pins and the second two letters match the output
|
||||
pins. Spaces are ignored, but are added here for clarity.)
|
||||
</p><h3>D Flip Flop:</h3>
|
||||
<p>
|
||||
Inputs: <tt>D,Clk</tt><br>
|
||||
Outputs: <tt>Q,/Q</tt><br>
|
||||
Definition:</p><pre>?? 00=10
|
||||
0+ ??=01
|
||||
1+ ??=10
|
||||
?? AB=AB
|
||||
</pre>
|
||||
The first line sets the Q output if both outputs are low (this is needed when resetting the circuit).
|
||||
The next two lines set the Q output to match the D input on a rising transition of the clock. The last
|
||||
line keeps the outputs the same otherwise.
|
||||
<h3>JK Flip Flop:</h3>
|
||||
<p>
|
||||
Inputs: <tt>J,K,Clk</tt><br>
|
||||
Outputs: <tt>Q,/Q</tt><br>
|
||||
Definition:</p><pre>??? 00=10
|
||||
00- AB=AB
|
||||
10- ??=10
|
||||
01- ??=01
|
||||
11- AB=BA
|
||||
??? AB=AB
|
||||
</pre>
|
||||
The first line sets the Q output if both outputs are low (this is needed when resetting the circuit).
|
||||
The next four
|
||||
lines implement the JK flip flop logic
|
||||
on a negative transition of the clock. The last line keeps the outputs the same otherwise.
|
||||
<h3>Digital Comparator:</h3>
|
||||
<p>
|
||||
Inputs: <tt>A2,A1,A0,B2,B1,B0</tt><br>
|
||||
Outputs: <tt>Eq,A>,A<</tt><br>
|
||||
Definition:</p><pre>ABC ABC=100
|
||||
1?? 0??=010
|
||||
A1? A0?=010
|
||||
AB1 AB0=010
|
||||
??? ???=001
|
||||
</pre>
|
||||
The first lines checks if the two inputs are equal. The next three lines test if A is larger. Otherwise, B must be larger.
|
||||
<p>
|
||||
<h3>3-Bit Counter:</h3>
|
||||
<p>
|
||||
Inputs: <tt>Clk</tt><br>
|
||||
Outputs: <tt>A,B,C</tt><br>
|
||||
Definition:</p><pre>+ AB0=AB1
|
||||
+ A01=A10
|
||||
+ 011=100
|
||||
+ 111=000
|
||||
? ABC=ABC
|
||||
</pre>
|
||||
This counter counts up on positive transition of the Clk input. The first line handles counting up from 000, 010, 100, or 110. The second line handles counting up from 001 or 101. The next two lines handle 011 and 111. The last line ensures that the output doesn't change unless the clock makes a positive transition.
|
||||
</p><h3> 3 input NAND with enable: </h3>
|
||||
<p>
|
||||
Inputs: <tt>A,B,C,En</tt><br>
|
||||
Outputs: <tt>X</tt><br>
|
||||
Definition:</p><pre>1111=0
|
||||
???1=1
|
||||
???0=_
|
||||
</pre>
|
||||
<p>
|
||||
Same as the 3 input NAND above, except that the output goes into a high-impedance state if the enable pin is low.
|
||||
</p><p>
|
||||
</p><h3> Tri-state buffer: </h3>
|
||||
<p>
|
||||
Inputs: <tt>A,En</tt><br>
|
||||
Outputs: <tt>X</tt><br>
|
||||
Definition:</p><pre>A1=A
|
||||
?0=_
|
||||
</pre>
|
||||
<p>
|
||||
Output is the same as A if the enable bit is high, otherwise it
|
||||
goes into a high-impedance state if the enable pin is low.
|
||||
</p><p>
|
||||
</body></html>
|
||||
</body></html>
|
29
doc/customtransformer.html
Normal file
29
doc/customtransformer.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>#header + #content > #left > #rlblock_left,
|
||||
#content > #right > .dose > .dosesingle,
|
||||
#content > #center > .dose > .dosesingle
|
||||
{display:none !important;}</style><style>img[src="http://s05.flagcounter.com/count/pTvk/bg=FFFFFF/txt=000000/border=CCCCCC/columns=6/maxflags=36/viewers=0/labels=0/"]
|
||||
{display:none !important;}</style></head><body><h1>Custom Transformer</h1>
|
||||
You can use the custom transformer element to create more complex transformers. Edit the transformer's description
|
||||
to specify what kind of transformer you want.
|
||||
<p>
|
||||
An example description is: <tt>1:1</tt>. That is a simple transformer with an equal number of turns in the primary
|
||||
and secondary. The inductance of each winding is equal to the "Base Inductance".
|
||||
<p>
|
||||
<tt>1:10</tt> gives you a step-up transformer. The secondary has 10 times as many turns as the primary (so
|
||||
it has 100 times the base inductance).
|
||||
<p>
|
||||
<tt>1,2:3</tt> gives you a transformer with two primary windings. The second primary winding has twice as many
|
||||
turns as the first. The secondary winding has 3 times as many. The only difference between primary and secondary
|
||||
windings is how they're displayed on the screen.
|
||||
<p>
|
||||
<tt>1:.5+.5</tt> gives you a tapped transformer.
|
||||
<p>
|
||||
<tt>1:1+2</tt> gives you a tapped transformer where the first part of the secondary has as many turns as the primary,
|
||||
and the second part has twice as many.
|
||||
<p>
|
||||
<tt>1,-1:1</tt> gives you a transformer with two primary windings, where the bottom winding has its polarity swapped.
|
||||
<p>
|
||||
So, the description is a list of windings separated by commas, with <tt>:</tt> to separate primary and secondary,
|
||||
and <tt>+</tt> to separate parts of a tapped coil.
|
||||
</body></html>
|
41
doc/index.html
Normal file
41
doc/index.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>CircuitJS1 Documentation</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
#toc {
|
||||
width: 25%;
|
||||
border-right: 1px solid #ccc;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#content {
|
||||
width: 75%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="toc">
|
||||
<iframe src="toc.html" frameborder="0"></iframe>
|
||||
</div>
|
||||
<div id="content">
|
||||
<iframe src="overview.html" frameborder="0"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
276
doc/js-interface.html
Normal file
276
doc/js-interface.html
Normal file
@@ -0,0 +1,276 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Circuit Simulator JavaScript Interface Documentation</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
color: #333;
|
||||
}
|
||||
code, pre {
|
||||
background: #f4f4f4;
|
||||
/*border: 1px solid #ddd;
|
||||
padding: 5px 10px;
|
||||
border-radius: 5px;*/
|
||||
}
|
||||
pre {
|
||||
overflow: auto;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Circuit Simulator JavaScript Interface Documentation</h1>
|
||||
|
||||
<p>This documentation outlines how to interact with the Circuit Simulator using JavaScript when it's embedded in an HTML page, particularly focusing on the use of an iframe to host the simulator.</p>
|
||||
|
||||
<h2>Overview</h2>
|
||||
<p>To use the JavaScript interface, the simulator and the controlling JavaScript page must be served from the same origin (domain).
|
||||
This is required by the same-origin policy enforced by browsers for security reasons.
|
||||
<p>
|
||||
To run the simulator on your website, get the <a href="https://www.falstad.com/circuit/offline/">offline windows version</a>,
|
||||
and put the contents of the <tt>circuitjs1/resources/app/war</tt> directory on your website.
|
||||
<p>
|
||||
You can run the CircuitJS1 simulation in an iframe. The CircuitJS1 object provides methods to interact with the simulator.
|
||||
<p>
|
||||
<a href="https://www.falstad.com/circuit/jsinterface.html">See a running example here</a>.
|
||||
</p>
|
||||
|
||||
<h2>Setup</h2>
|
||||
|
||||
<pre><code><iframe id="circuitFrame" src="circuitjs.html?startCircuit=jsinterface.txt" width="800" height="550"></iframe>
|
||||
|
||||
...
|
||||
|
||||
<script>
|
||||
|
||||
var iframe = document.getElementById("circuitFrame");
|
||||
|
||||
// Wait for the circuit simulator to load
|
||||
iframe.contentWindow.oncircuitjsloaded = function() {
|
||||
// Simulator is loaded, initialize your code here
|
||||
sim = iframe.contentWindow.CircuitJS1;
|
||||
|
||||
// Set up callbacks for updates, analysis, and time steps (all optional)
|
||||
sim.onupdate = didUpdate;
|
||||
sim.ontimestep = didStep;
|
||||
sim.onanalyze = didAnalyze;
|
||||
};</code></pre>
|
||||
|
||||
<h2>Available CircuitJS1 Methods</h2>
|
||||
|
||||
<h3><code>setSimRunning(boolean run)</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Starts or stops the simulation.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>run</code> (boolean): <code>true</code> to start the simulation, <code>false</code> to stop it.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Example:</strong> <code>CircuitJS1.setSimRunning(true);</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getTime()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Retrieves the current simulation time.</li>
|
||||
<li><strong>Returns:</strong> The simulation time in seconds as a number.</li>
|
||||
<li><strong>Example:</strong> <code>var time = CircuitJS1.getTime();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getTimeStep()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Gets the current time step of the simulation.</li>
|
||||
<li><strong>Returns:</strong> The time step value.</li>
|
||||
<li><strong>Example:</strong> <code>var timeStep = CircuitJS1.getTimeStep();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>setTimeStep(double ts)</code> (Deprecated)</h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Sets the time step for the simulation. <strong>Note:</strong> This method is deprecated; changes to time step should be made using <code>setMaxTimeStep</code>.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>ts</code> (double): The new time step to set.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Example:</strong> <code>CircuitJS1.setTimeStep(1e-6);</code> // This is deprecated</li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getMaxTimeStep()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Returns the maximum time step allowed for the simulation.</li>
|
||||
<li><strong>Returns:</strong> The maximum time step value.</li>
|
||||
<li><strong>Example:</strong> <code>var maxTimeStep = CircuitJS1.getMaxTimeStep();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>setMaxTimeStep(double ts)</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Sets a new maximum time step and also sets the current time step to this value.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>ts</code> (double): The new maximum time step to set.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Example:</strong> <code>CircuitJS1.setMaxTimeStep(1e-3);</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>isRunning()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Checks if the simulation is currently running.</li>
|
||||
<li><strong>Returns:</strong> <code>true</code> if the simulation is running, <code>false</code> otherwise.</li>
|
||||
<li><strong>Example:</strong> <code>if (CircuitJS1.isRunning()) { ... }</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getNodeVoltage(String n)</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Gets the voltage at a labeled node in the circuit.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>n</code> (String): The name of the labeled node.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Returns:</strong> The voltage at the node.</li>
|
||||
<li><strong>Example:</strong> <code>var nodeVoltage = CircuitJS1.getNodeVoltage("vsense");</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>setExtVoltage(String n, double v)</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Sets the voltage of an external voltage element (see Inputs and Sources,
|
||||
Add External Voltage). These are different than labeled nodes, though they look the same. Labeled nodes are
|
||||
passive. Their voltage is determined by the rest of the circuit. External voltage elements are voltage sources. Their
|
||||
voltage is determined by javascript code.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>n</code> (String): The name of the external voltage element to set the voltage for.</li>
|
||||
<li><code>v</code> (double): The voltage value to set.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Example:</strong> <code>CircuitJS1.setExtVoltage("extsin", 5);</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getElements()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Retrieves all elements currently in the circuit.</li>
|
||||
<li><strong>Returns:</strong> An array of circuit elements. See below for methods supported on these element objects.</li>
|
||||
<li><strong>Example:</strong> <code>var elements = CircuitJS1.getElements();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getCircuitAsSVG()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Exports the current circuit as an SVG string.</li>
|
||||
<li><strong>Returns:</strong> The SVG representation of the circuit.</li>
|
||||
<li><strong>Example:</strong> <code>var svgData = CircuitJS1.getCircuitAsSVG();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>exportCircuit()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Exports the current circuit to a string format for saving or transmission.</li>
|
||||
<li><strong>Returns:</strong> A string representation of the circuit.</li>
|
||||
<li><strong>Example:</strong> <code>var circuitExport = CircuitJS1.exportCircuit();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>importCircuit(String circuit, boolean subcircuitsOnly)</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Imports a circuit from a string, potentially only loading subcircuits.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>circuit</code> (String): The string representation of the circuit to import (as returned by <code>exportCircuit()</code>).</li>
|
||||
<li><code>subcircuitsOnly</code> (boolean): If <code>true</code>, only subcircuits are imported.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Example:</strong> <code>CircuitJS1.importCircuit(circuitString, false);</code></li>
|
||||
</ul>
|
||||
|
||||
<h2>Circuit Element Methods</h2>
|
||||
|
||||
<h3><code>getType()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Retrieves the type of the circuit element.</li>
|
||||
<li><strong>Returns:</strong> A string representing the class name of the element.</li>
|
||||
<li><strong>Example:</strong> <code>var elementType = element.getType();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getInfo()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Gets information about the circuit element, which might include voltage, current, or other relevant data points.</li>
|
||||
<li><strong>Returns:</strong> An array or object containing information about the element.</li>
|
||||
<li><strong>Example:</strong> <code>var elementInfo = element.getInfo();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getVoltageDiff()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Returns the voltage difference across the element. This is particularly useful for two-terminal elements like resistors.</li>
|
||||
<li><strong>Returns:</strong> The voltage difference as a number.</li>
|
||||
<li><strong>Example:</strong> <code>var voltageDiff = element.getVoltageDiff();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getVoltage(n)</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Gets the voltage at a specific node (or post) of the element.</li>
|
||||
<li><strong>Parameters:</strong>
|
||||
<ul>
|
||||
<li><code>n</code> (number): The index of the node to check.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Returns:</strong> The voltage at the specified node.</li>
|
||||
<li><strong>Example:</strong> <code>var nodeVoltage = element.getVoltage(0);</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getCurrent()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Retrieves the current flowing through the element.</li>
|
||||
<li><strong>Returns:</strong> The current as a number.</li>
|
||||
<li><strong>Example:</strong> <code>var current = element.getCurrent();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getLabelName()</code> (For LabeledNodeElm)</h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Returns the name of the label for elements that are labeled nodes.</li>
|
||||
<li><strong>Returns:</strong> The label name as a string.</li>
|
||||
<li><strong>Example:</strong> <code>var labelName = labelElm.getLabelName();</code></li>
|
||||
</ul>
|
||||
|
||||
<h3><code>getPostCount()</code></h3>
|
||||
<ul>
|
||||
<li><strong>Description:</strong> Returns the number of posts (connection points) for the element.</li>
|
||||
<li><strong>Returns:</strong> The post count as a number.</li>
|
||||
<li><strong>Example:</strong> <code>var postCount = element.getPostCount();</code></li>
|
||||
</ul>
|
||||
<h3>Callbacks</h3>
|
||||
<ul>
|
||||
<li><strong>onupdate</strong>: Called when the simulator updates its display (usually 60 times per second).
|
||||
<pre><code>sim.onupdate = didUpdate;
|
||||
...
|
||||
function didUpdate(sim) {
|
||||
// Update UI with simulation data
|
||||
}</code></pre>
|
||||
</li>
|
||||
<li><strong>ontimestep</strong>: Called every time step of the simulation.
|
||||
<pre><code>sim.ontimestep = didStep;
|
||||
...
|
||||
function didStep(sim) {
|
||||
// Perform actions per time step
|
||||
}</code></pre>
|
||||
</li>
|
||||
<li><strong>onanalyze</strong>: Called when the circuit is analyzed (loaded or edited).
|
||||
<pre><code>sim.onanalyze = didAnalyze;
|
||||
...
|
||||
function didAnalyze(sim) {
|
||||
// React to changes in circuit
|
||||
}</code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
19
doc/opampreal.html
Normal file
19
doc/opampreal.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>#header + #content > #left > #rlblock_left,
|
||||
#content > #right > .dose > .dosesingle,
|
||||
#content > #center > .dose > .dosesingle
|
||||
{display:none !important;}</style><style>img[src="http://s05.flagcounter.com/count/pTvk/bg=FFFFFF/txt=000000/border=CCCCCC/columns=6/maxflags=36/viewers=0/labels=0/"]
|
||||
{display:none !important;}</style></head><body><h1>Real Op-Amps</h1>
|
||||
The ideal op-amp element uses an ideal approximation to op-amp behavior. It has infinite <a href="https://en.wikipedia.org/wiki/Slew_rate">slew rate</a>
|
||||
and output current.
|
||||
<p>
|
||||
The real op-amp element uses a subcircuit to emulate a real op-amp implementation with finite slew rate and output current. Presently,
|
||||
the two implementation options are LM741 and LM324.
|
||||
<p>
|
||||
You can also modify the slew rate or output current, which will modify the circuit to change these values from the default.
|
||||
<p>
|
||||
These subcircuits are complicated, so you may run problems with convergence, especially if you increase the slew rate. Try decreasing
|
||||
the time step size if this happens.
|
||||
<p>
|
||||
The LM324 can act very glitchy as well if the slew rate is increased. Decreasing the time step size proportionately should fix this.
|
||||
</body></html>
|
1297
doc/overview.html
Normal file
1297
doc/overview.html
Normal file
File diff suppressed because it is too large
Load Diff
BIN
doc/subcircuit-pins1.png
Normal file
BIN
doc/subcircuit-pins1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
BIN
doc/subcircuit-pins2.png
Normal file
BIN
doc/subcircuit-pins2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
54
doc/subcircuits.html
Normal file
54
doc/subcircuits.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>#header + #content > #left > #rlblock_left,
|
||||
#content > #right > .dose > .dosesingle,
|
||||
#content > #center > .dose > .dosesingle
|
||||
{display:none !important;}</style><style>img[src="http://s05.flagcounter.com/count/pTvk/bg=FFFFFF/txt=000000/border=CCCCCC/columns=6/maxflags=36/viewers=0/labels=0/"]
|
||||
{display:none !important;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Subcircuits</h1>
|
||||
<p>
|
||||
You can use subcircuits to implement custom "black box" devices.
|
||||
</p><p>
|
||||
Create and test your device, and then use labeled nodes (under "Outputs and Labels") to mark and label all the inputs/outputs. <a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+53+5+50%0Aw+304+64+304+128+0%0Ad+304+128+368+192+2+default%0Ad+304+256+368+192+2+default%0Ad+240+192+304+128+2+default%0Ad+240+192+304+256+2+default%0Aw+304+256+304+352+0%0Aw+368+192+416+192+0%0A207+304+64+304+16+4++in%5Cp%0A207+304+352+304+400+4++in-%0A207+416+192+480+192+4++out%5Cp%0A207+240+192+160+192+4++out-%0A">Here is an example circuit (a bridge rectifier).</a>
|
||||
</p><p>
|
||||
Then, select File->Create Subcircuit, then rearrange the pins the way you want them, enter a model name, and click OK. This will load the subcircuit model.
|
||||
Be sure to save this circuit (the subcircuit implementation), because it can't be edited later otherwise.
|
||||
</p><p>
|
||||
Now you can create a circuit using the subcircuit model. Click with the right mouse and select the "Active Building Blocks" menu, and the "Add Subcircuit Instance" item. Then click
|
||||
and drag to create an instance. Edit the instance to select which model you want (by default it will use the one you just created).
|
||||
</p><p>
|
||||
<a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+59+5+50%0A.+fullrect+0+2+2+4+in%5Cp+1+0+2+in-+3+1+2+out%5Cp+2+0+3+out-+4+1+3+DiodeElm%5Cs1%5Cs2%5CrDiodeElm%5Cs3%5Cs2%5CrDiodeElm%5Cs4%5Cs1%5CrDiodeElm%5Cs4%5Cs3+2%5C%5Csdefault%5Cs2%5C%5Csdefault%5Cs2%5C%5Csdefault%5Cs2%5C%5Csdefault%0A410+688+288+784+368+1+fullrect+2%5Csdefault+2%5Csdefault+2%5Csdefault+2%5Csdefault%0Aw+688+288+688+240+0%0Aw+688+320+688+368+0%0Aw+688+368+640+368+0%0Aw+688+240+640+240+0%0Av+640+368+640+240+0+1+40+5+0+0+0.5%0Aw+784+288+784+240+0%0Aw+784+320+784+368+0%0Aw+784+368+832+368+0%0Ar+832+240+832+368+0+1000%0Aw+784+240+832+240+0%0Ao+9+64+0+4099+5+0.025+0+2+9+3%0A">Here is an example using the rectifier.</a> When you save/load this circuit, it will also save/load the subcircuit model so you can use it in other circuits.
|
||||
</p><p>
|
||||
You can also use subcircuits to rearrange pins on the built-in chips. <a href="../circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+50%0A165+800+368+848+368+6+0%0A207+864+336+864+288+0+Vin%0A207+800+400+752+400+0+dis%0A207+800+464+736+464+0+tr%0A207+800+496+736+496+0+th%0A207+864+528+864+592+0+ctl%0A207+896+528+896+592+0+gnd%0A207+928+432+992+432+0+out%0A207+928+400+992+400+0+rst%0A">Here is an example with the 555</a>. And <a href="../circuitjs.html?cct=$+1+0.000005+5.023272298708815+64+7+50%0Aw+112+192+112+224+0%0Aw+112+224+176+224+0%0Ac+112+224+112+288+0+3e-7+6.326871610496845%0Ag+112+288+112+304+0%0Ar+112+192+112+64+0+1000000%0Aw+112+64+240+64+0%0AR+112+64+80+64+0+0+40+10+0+0+0.5%0AO+352+160+416+160+0%0Aw+240+64+304+64+0%0Aw+304+64+304+128+0%0Aw+352+160+352+32+0%0Ar+352+32+160+32+0+10000%0Aw+160+32+160+96+0%0Aw+112+192+160+192+0%0A.+555+0+2+4+8+ctl+5+3+3+dis+1+1+3+gnd+8+0+2+out+6+2+2+rst+7+3+2+th+3+2+3+tr+2+1+2+Vin+4+0+3+TimerElm%5Cs1%5Cs2%5Cs3%5Cs4%5Cs5%5Cs6%5Cs7%5Cs8+6%5C%5Cs0%0A410+208+128+224+160+1+555+6%5Cs9.999632723888661%0Aw+304+128+336+128+0%0Aw+336+128+336+272+0%0Aw+336+272+208+272+0%0Aw+160+192+176+192+0%0Aw+176+192+176+160+0%0Aw+176+160+208+160+0%0Aw+208+192+192+192+0%0Aw+176+224+176+288+0%0Aw+176+288+320+288+0%0Aw+320+288+320+192+0%0Aw+320+192+304+192+0%0Aw+160+96+160+192+0%0Aw+160+96+320+96+0%0Ag+208+128+208+144+0%0Aw+208+224+208+272+0%0Aw+192+192+192+320+0%0Aw+192+320+352+320+0%0Aw+352+320+352+160+0%0Ao+2+32+0+4099+10+0.00078125+0+2+2+3%0Ao+7+16+0+4106+10+0.00009765625+1+1%0A">here is that subcircuit model being used in a circuit.</a>
|
||||
</p><p>
|
||||
If you select part of a circuit before using File->Create Subcircuit, then only the selected elements will be considered part of
|
||||
the subcircuit.
|
||||
</p><p>
|
||||
If you want to use labeled nodes in the subcircuit definition but don't want them to be one of the inputs/outputs, then check the "Internal Node"
|
||||
checkbox in those labeled nodes' edit menus.
|
||||
</p>
|
||||
|
||||
<h2>Pins</h2>
|
||||
<p>
|
||||
The arrangement and direction of the labeled nodes in your circuit will determine the initial arrangement of the pins when creating the symbol symbol.
|
||||
During symbol creation, you can change the initial pin layout by dragging the pins with the mouse.
|
||||
</p>
|
||||
<p>
|
||||
The name of the labeled nodes can affect the look of the pin in the following ways:
|
||||
</p>
|
||||
<p>
|
||||
<a href="../circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAUgpABZsKBTAWjDACg1yxiVwfwaNPryEBhADIBpDpC78UKIWEEgFQsVIBco9p2GqEhAUJSHaIAJIA5AGqaAolZnlTR7r1chiRoQHpHKM4GRmog2GiqiubWdgCKQZ6e4VSeQvEATvruwfpUYPBsmdmhiVF5BUXyZolm5XBsQA">
|
||||
<img src="subcircuit-pins1.png"> <img src="subcircuit-pins2.png">
|
||||
</a>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Naming a node "CLK" will add a "clock marker" to the symbol at that pin and hide the text.</li>
|
||||
<li>Prefixing the name with "CLK:" (as in "CLK:C1") will draw a "clock marker" on that pin in the symbol.</li>
|
||||
<li>Prefixing the name with "INV:" (as in "INV:EN") will draw an "inverter circle" on that pin in the symbol, denoting logical inversion.</li>
|
||||
<li>Prefixing the name with "/" (as in "/EN") will draw a horizontal line above the text in the symbol, also denoting logical negation.</li>
|
||||
<li>For all prefixes, the prefix itself will not be shown in the symbol, only the text after the prefix.</li>
|
||||
<li>All prefixes are purely cosmetic and do not affect the actual signal.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
40
doc/toc.html
Normal file
40
doc/toc.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Table of Contents</title>
|
||||
<style>
|
||||
body { padding: 20px; }
|
||||
a { display: block; margin: 10px 0; /* text-decoration: none; color: #000; */ }
|
||||
a:hover { text-decoration: underline; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Table of Contents</h2>
|
||||
<a href="overview.html">Overview</a>
|
||||
<a href="circuits.html">Sample Circuits</a>
|
||||
<a href="AudioInput.html">Audio Input</a>
|
||||
<a href="DataInput.html">Data Input</a>
|
||||
<a href="DelayBuffer.html">Delayed Buffer</a>
|
||||
<a href="customfunction.html">Custom Function for Controlled Sources</a>
|
||||
<a href="customlogic.html">Custom Logic</a>
|
||||
<a href="customtransformer.html">Custom Transformer</a>
|
||||
<a href="js-interface.html">JavaScript Interface</a>
|
||||
<a href="opampreal.html">Real Op Amp</a>
|
||||
<a href="subcircuits.html">Subcircuits</a>
|
||||
<p> </p>
|
||||
<a target="_top" href="../index.html">Back to the applet</a>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
document.querySelectorAll('a').forEach(link => {
|
||||
if (!link.target)
|
||||
link.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
parent.document.querySelector('#content iframe').src = this.href;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
2701
doc/welcome.html
Normal file
2701
doc/welcome.html
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user