The commands used to control JoSIM are placed within the netlist and usually start with a single period followed by a command. These commands include the type of simulation to be done, any models required by components and all the plotting commands.
The most basic of these commands, and a requirement for the simulator to do anything until other simulation methods are implemented is a transient analysis. A transient analysis in JoSIM is defined using the command
.tran T.Step T.Stop [T.Start]
which will perform a transient analysis that runs from time start (T.Start) to time stop (T.Stop) with the time step value of time step (T.Step). The number of simulation time steps would then be
n = T.Stop− T.Start
T.Step (5.42)
where T.Start has a value of 0 unless specified. In the case that n is not an integer number, the amount of simulations to be run will be rounded down due to the nature of casting a double to an integer in C++.
The model specifier for JoSIM is discussed in Section 5.3.4.1, as the only model parameter JoSIM accepts at present is the Josephson junction model. Additional models will become available as the software matures.
The plotting commands used by JoSIM can take any of the following forms .print Pr.Type Device or Node
.plot Pl.Type(Node or device)0 ... Pl.Type(Node or device)n
These commands both essentially do the same thing, however, the way the commands are formatted differs slightly. In the print command each seperate print needs to be stated on a new line whereas the plot command can have multiple commands to plot in one line.
The Pr.Type can be either NODEV, DEVV, DEVI or PHASE. NODEV requests the node voltage for the specified node. DEVV and DEVI request the device voltage and current for the specified device. The voltage is defined as the difference between the two nodes the device is connected to and the current would be this difference divided by the device impedance. PHASE would simply print out the phase value (φ) for the specified junction.
When performing phase-based analysis the PHASE Pr.Type can be used for any component and an additional Pr.Type NODEP is introduced that allows plotting the nodal phase.
The Pl.Type can be any of the V, I or P. Where when V is the voltage acrross the device, but nodes could also be specified seperated by a comma to find the voltage between two nodes. The I and P produce the device current and phase respectively.
Any of the control commands listed prior can be positioned within a control block of which there can only be one per circuit netlist. These commands would be enclosed in a section that starts with a .control command and ends with a .endc command. The lines enclosed in such a block would not require the a period at the start to indicate that it is a control command.
To specify whether the enclosed lines are part of a subcircuit the .subckt and .ends commands are used.
5.4.1
Parameters
A unique feature which is implemented in JoSIM is the expression parser which allows the user to set variables and do calculations within the circuit netlist. The definition of an expression
.param Var.Name = Expression
The expression parser implements a variant of the Dijkstra’s shunting yard algorithm[62] whereby the expression to be parsed is read in and converted to a reverse polish notation (RPN) stack which is then evaluated to return a value.
An example of this would be
R01 = 5E–3∗ 1000 ∗ sin(P I/2) + 5
Table 5.1: Shunting yard conversion to a RPN stack
Token RPN Stack Operator Stack Note
5E-3 5E-3 3E-3 is a value
* 5E-3 * * is a high precedence operator
1000 5E-3 1000 * 1000 is a value
* 5E-3 1000 * * * has equal precedence to *
sin 5E-3 1000 * sin * sin has higher precedence than *
( 5E-3 1000 * PI ( sin * ( is of the highest precedence
PI 5E-3 1000 PI ( sin * PI is a value
/ 5E-3 1000 * PI / ( sin * / is within the bracket
2 5E-3 1000 * PI 2 / ( sin * 2 is a value
) 5E-3 1000 * PI 2 / sin * ) found, pop stack
+ 5E-3 1000 * PI 2 / sin * + + has low precedence
5 5E-3 1000 * PI 2 / sin * 5 + 5 is a value
5E-3 1000 * PI 2 / sin * 5 + no more tokens, pop stack
The table in 5.1 depicts the algorithm steps in a very simplified manner. It does however show that certain operators have precedence over others and if operators of the same importance are found the operator is pushed to the RPN stack. Once all the tokens have been exhausted the RPN stack can then be evaluated using an algorithm that applies the operator to the preceding stack value(s) until there is only one item left in the stack
Table 5.2: RPN stack evaluation
RPN Stack Expression Evaluation Note
5E-3 1000 * PI 2 / sin * 5 + 5E-3 1000 *
5 PI 2 / sin * 5 + 5 PI No operator found
5 PI 2 / sin * 5 + PI 2 /
5 PI/2 sin * 5 + 5 PI/2 Sin Sin takes one operator
5 PI/2 sin * 5 + PI/2 Sin
5 1 * 5 + 5 1 *
5 5 + 5 5 +
10
This value is then stored using the R01 label as key. This value can then be used within the netlist in various ways such as component values, model definitions or even in other parameter values. This is particularly useful when some form of scaling needs to be applied to values, since changing a single value then changes all values. Parameters can be unique to a subcircuit or defined in main netlist making them global and accessible within subcircuits. If a parameter
makes use of another parameter within the expression that needs parsing, the required param- eter needs to be defined prior to the evaluation due to the sequential read in of files within JoSIM. The sequential read in and caviates related to that are discussed in Section 5.5.
The types of expressions that can be evaluated at present are only limited to very basic algebra and trigonometric functions, however this can be expanded to encompass any possible function.
The param control can also be enclosed within the control block whereby the period can be omitted.