EModel
The emodel
statement inside a pcb-component
associates the component with an electrical model.
Syntax
; define a pcb-component with a resistor EModel
pcb-component my-resisor:
emodel = Resistor(resistance-ohms, tolerance-%, max-power-watts)
Description
An emodel
is a simplified model of electrical properties. More complete simulation models can be defined with spice statements (coming soon).
Introspection Command
The emodel?
query command returns the electrical model of an instance or a component. The function returns false if there is no electrical model or the argument is not a single component instance.
Different types of EModel's:
; define a resistor EModel
emodel = Resistor(resistance-ohms, tolerance-%, max-power-watts)
; define a capacitor EModel
emodel = Capacitor(capacitance-farads,
tolerance-%,
max-voltage-volts,
polarized?, ; optional boolean
low-esr?, ; optional boolean
temperature-coefficient?, ; optional string, eg "X7R" or "X5R"
dielectric? ; optional) ; optional string, eg "Ceramic, "Tantalum", "Electrolytic"
; define an inductor EModel
emodel = Inductor(inductance-microhenries, tolerance-%, max-current-amps)
; define a diode EModel
emodel Diode(forward-current-amps,
forward-voltage-volts,
max-current-amps,
max-reverse-voltage-volts,
color?, ; optional, for LEDs
luminous-intensity-millicandelas) ; optional, for LEDs
Example Code:
pcb-component cap-component :
emodel = Capacitor(1.0e-007)
pcb-module my-design :
inst cap : cap-component
inst cap-array : cap-component[3]
println("emodel of cap is %_" % [emodel?(cap)])
println("emodel of cap-array[0] is %_" % [emodel?(cap-array[0])])
println("emodel of cap-component is %_" % [emodel?(cap-component)])
The emodel?
query returns Capacitor(1.0e-007)
for all three calls.
The output is
emodel of cap is Capacitor(1.0e-007)
emodel of cap-array[0] is Capacitor(1.0e-007)
emodel of cap-component is Capacitor(1.0e-007)