Documentation

Drawing models with the subcircuit generator

Back to Model import or creation

If a circuit should become a model in form of a subcircuit Models in (P)SPICE and TARGET 3001!:


Example: Potentiometer with total resistance and wiper position in percent as parameters (SIM_SUBCKT1.T3001).

Circuit:
USER: Compose circuit in a schematic (Compose the circuit)
INFO: The circuit can be composed of real and virtual components.
INFO: Naturally only components may be used, which possess a model.
INFO: The signal names (Edit the circuit) and component names should get meaningful names, so that the generated subcircuit gets a readable form.


RESTRICTION: The subcircuit must be drawn on page 1 only!

A subcircuit does not need to be simulated for its generation, but a subcircuit should be tested. The test circuit shall be designed only on the remaining pages (2-100). The connections between subcircuit and test circuit can be realized by reference symbols. Thus TARGET 3001! works like an integrated development environment (i.e. editor and test) for subcircuits.

Parameters:
See section "Edit component values" in chapter 8.1.3.2{8.1.3.2 Edit the circuit}. Math. expressions with and without variables can be also used as "numerical values". An math. expression must be set within curved parentheses. A variable must be introduced to the subcircuit as parameters (see below).

USER: Enter {RG * P / 100} as component value for R2.
USER: Enter {RG * ( 100 - P ) / 100} as component value for R1.
INFO: The resistances of the potentiometer are defined as a function of wiper position P in percent and total resistance RG.

Subcircuit generator:
USER: Press the function key F9 in the schematic view (Also with the menu actions or the icon bar).
TARGET: The main dialog for the simulation will be opened.
USER: Call the subcircuit generator with the tools menu.
TARGET: Subcircuit dialog will appear and the pure spice circuit will be generated from the schematic.
USER: Enter name for the new subcircuit: POTI
USER: Click in the nodes window with the right mouse button and select add in the popup menu.
TARGET: All signals from the first page of the schematic, which are connected to a reference symbol, will be listed in a box.
USER: Select node: IN
INFO: Selected nodes will be removed from the box.
USER: Repeat selection for all further nodes: OUT, GND
USER: Click in the parameters window with the right mouse button and select add in the popup menu.
USER: Enter parameter name: P
USER: Enter its default value: 50
USER: Repeat input for all further parameters: RG with default value=1K
USER: Enter info: Potentiometer with total resistance and wiper position in percent
INFO: Some information (date, project name, project level) will be inserted automatically by the subcircuit generator.
USER: Enter level: ANALOG

The complete subcircuit can be viewed as text, by clicking on "Edit/Show as text":

.SUBCKT POTI IN OUT GND PARAMS: P= 50 RG= 1K
TARGET3001-SUBCKT-GENERATOR
DATE: 11.06.03 10:57:14
PROJECT: C:\TARGET\TarV10\SimExamples\SIM_SUBCKT1.T3001
PROJECTLEVEL: Standard ANALOG=+100
Potentiometer with total resistance and wiper position in percent
LEVEL: ANALOG
RR1 out in {RG*(100-P)/100}
RR2 GND out {RG*P/100}
.ENDS

Different versions of a subcircuit with its own level settings (Simulation on different levels) can be generated. These settings will be documented in the comment line PROJECTLEVEL of the subcircuit.
USER: Quit subcircuit dialog with the OK button.
TARGET: The generated subcircuit will be stored in its own target project (*.T3001)!
TARGET: The inputs that have been made in the subcircuit dialog will be stored graphically in the first page of the schematic.
INFO: The line "PROJECTTYPE: SUBCKT" marks the project as a subcircuit project (important for simulation/test).

Simulation (Test):
USER: Simulate the circuit

Using the created subcircuit:
USER: Import extern models
But in contrast: Select "TARGET project" in the menu "Reload from...". The model browser will show the generated subcircuits at the top of the list with the info SUBCKTGENERATOR!