ElectricalCoreClassesImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Written by: Pradeep Sindhu April 1, 1986 1:12:34 am PST
Last Edited by:
Last Edited by: Richley June 23, 1987 12:44:02 pm PDT
Barth, July 8, 1988 11:59:13 am PDT
Christian Le Cocq April 8, 1988 10:03:24 am PDT
Christian LeCocq February 11, 1987 1:03:26 pm PST
Bertrand Serlet April 15, 1987 4:11:42 pm PDT
Pradeep Sindhu December 4, 1986 1:18:52 am PST
DIRECTORY
Convert,
Core,
CoreOps,
ElectricalCoreClasses,
Rope;
ElectricalCoreClassesImpl: CEDAR PROGRAM
IMPORTS Convert, CoreOps, Rope
EXPORTS ElectricalCoreClasses =
BEGIN OPEN Core, ElectricalCoreClasses;
Translation Procs for Basic Types
RopeFromV: PUBLIC PROC [v: V] RETURNS [rope: ROPE] = BEGIN
RETURN [Rope.Cat[Convert.RopeFromReal[v], "V"]];
END;
RopeFromKOhms: PUBLIC PROC [r: KOhms] RETURNS [rope: ROPE] = BEGIN
RETURN [Rope.Cat[Convert.RopeFromReal[r], "K"]];
END;
RopeFrompF: PUBLIC PROC [c: pF] RETURNS [rope: ROPE] = BEGIN
RETURN [Rope.Cat[Convert.RopeFromReal[c], "pF"]];
END;
RopeFromns: PUBLIC PROC [t: ns] RETURNS [rope: ROPE] = BEGIN
RETURN [Rope.Cat[Convert.RopeFromReal[t], "ns"]];
END;
RopeFrommA: PUBLIC PROC [i: mA] RETURNS [rope: ROPE] = BEGIN
RETURN [Rope.Cat[Convert.RopeFromReal[i], "mA"]];
END;
RopeFromuH: PUBLIC PROC [l: uH] RETURNS [rope: ROPE] = BEGIN
RETURN [Rope.Cat[Convert.RopeFromReal[l], "uH"]];
END;
Resistor
resistorCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Resistor", recast: NIL]];
CreateResistor: PUBLIC PROC [args: ResistorRec, name: ROPE ← "Resistor", props: Properties ← NIL] RETURNS [cellType: CellType] = {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]];
cellType ← CoreOps.CreateCellType[
class: resistorCellClass,
public: public,
data: NEW [ResistorRec ← args],
name: name, props: props];
};
Inductor
inductorCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Inductor", recast: NIL]];
CreateInductor: PUBLIC PROC [args: InductorRec, name: ROPE ← "Inductor", props: Properties ← NIL] RETURNS [cellType: CellType] = {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]];
cellType ← CoreOps.CreateCellType[
class: inductorCellClass,
public: public,
data: NEW [InductorRec ← args],
name: name, props: props];
};
Capacitor
capacitorCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Capacitor", recast: NIL]];
CreateCapacitor: PUBLIC PROC [args: CapacitorRec, name: ROPE ← "Capacitor", props: Properties ← NIL] RETURNS [cellType: CellType] = {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]];
cellType ← CoreOps.CreateCellType[
class: capacitorCellClass,
public: public,
data: NEW [CapacitorRec ← args],
name: name,
props: props];
};
Bipolar Junction Transistor
bjtCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "BJT", recast: NIL]];
CreateBJT: PUBLIC PROC [args: BJTRec, name: ROPENIL, props: Properties ← NIL] RETURNS [cellType: CellType] ~ {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "c"],
CoreOps.CreateWire[name: "b"],
CoreOps.CreateWire[name: "e"]
]];
cellType ← CoreOps.CreateCellType[
class: bjtCellClass,
public: public,
data: NEW [BJTRec ← args],
name: name,
props: props];
};
Diode
diodeCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Diode", recast: NIL]];
CreateDiode: PUBLIC PROC [args: DiodeRec, name: ROPENIL, props: Properties ← NIL] RETURNS [cellType: CellType] ~ {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]];
cellType ← CoreOps.CreateCellType[
class: diodeCellClass,
public: public,
data: NEW [DiodeRec ← args],
name: name,
props: props];
};
Coupled Inductors
coupledIndCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Coupled Inductors", recast: NIL]];
CreateCoupledInd: PUBLIC PROC [args: CoupledIndRec, name: ROPENIL, props: Properties ← NIL] RETURNS [cellType: CellType] ~ {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]],
CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n2"],
CoreOps.CreateWire[name: "n3"]
]]]];
cellType ← CoreOps.CreateCellType[
class: coupledIndCellClass,
public: public,
data: NEW [CoupledIndRec ← args],
name: name,
props: props];
};
Lossless Line
losslessLineCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Lossless Line", recast: NIL]];
CreateLosslessLine: PUBLIC PROC [args: LosslessLineRec, name: ROPENIL, props: Properties ← NIL] RETURNS [cellType: CellType] ~ {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]],
CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n2"],
CoreOps.CreateWire[name: "n3"]
]]]];
cellType ← CoreOps.CreateCellType[
class: losslessLineCellClass,
public: public,
data: NEW [LosslessLineRec ← args],
name: name,
props: props];
};
Linear Sources
linearSourceCellClass: PUBLIC CellClass← NEW [CellClassRec ← [name: "Linear Source", recast: NIL]];
CreateLinearSource: PUBLIC PROC [args: LinearSourceRec, name: ROPENIL, props: Properties ← NIL] RETURNS [cellType: CellType] ~ {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n0"],
CoreOps.CreateWire[name: "n1"]
]],
CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n2"],
CoreOps.CreateWire[name: "n3"]
]]]];
cellType ← CoreOps.CreateCellType[
class: linearSourceCellClass,
public: public,
data: NEW [LinearSourceRec ← args],
name: name,
props: props];
};
SignalGenerator
signalGeneratorCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "SignalGenerator", recast: NIL]];
CreateSignalGenerator: PUBLIC PROC [args: SignalGeneratorRec, name: ROPE ← "SignalGenerator", props: Properties ← NIL] RETURNS [cellType: CellType] = {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n"]
]];
cellType ← CoreOps.CreateCellType[
class: signalGeneratorCellClass,
public: public,
data: NEW [SignalGeneratorRec ← args],
name: name, props: props];
};
Sine Generator
sineGeneratorCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "SineGenerator", recast: NIL]];
CreateSineGenerator: PUBLIC PROC [args: SineGeneratorRec, name: ROPENIL, props: Properties ← NIL] RETURNS [sineGenerator: CellType] ~ {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n"]
]];
sineGenerator ← CoreOps.CreateCellType[
class: sineGeneratorCellClass,
public: public,
data: NEW [SineGeneratorRec ← args],
name: name, props: props];
};
AC Source
acSourceCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "ACSource", recast: NIL]];
CreateACSource: PUBLIC PROC [args: ACSourceRec, name: ROPENIL, props: Properties ← NIL] RETURNS [acSource: CellType] = {
public: Wire ← CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "n"]
]];
acSource ← CoreOps.CreateCellType[
class: acSourceCellClass,
public: public,
data: NEW [ACSourceRec ← args],
name: name, props: props];
};
Probe
probeCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Probe", recast: NIL]];
CreateProbe: PUBLIC PROC [args: ProbeRec, name: ROPE ← "Probe", props: Properties ← NIL] RETURNS [cellType: CellType] = {
public: Wire ← SELECT args.type FROM
Voltage => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n"]]],
Current => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"]]]
ENDCASE => ERROR;
cellType ← CoreOps.CreateCellType[
class: probeCellClass,
public: public,
data: NEW [ProbeRec ← args],
name: name, props: props];
};
Init
initCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Init", recast: NIL]];
CreateInit: PUBLIC PROC [args: InitRec, name: ROPE ← "Init", props: Properties ← NIL] RETURNS [cellType: CellType] = {
public: Wire ← SELECT args.type FROM
Voltage => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n"]]],
Current => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"]]]
ENDCASE => ERROR;
cellType ← CoreOps.CreateCellType[
class: initCellClass,
public: public,
data: NEW [InitRec ← args],
name: name,
props: props];
};
Panel
panelCellClass: PUBLIC CellClass ← NEW [CellClassRec ← [name: "Panel", recast: NIL]];
CreatePanel: PUBLIC PROC [args: PanelRec, name: ROPE ← "Control Panel", props: Properties ← NIL] RETURNS [cellType: CellType] = BEGIN
public: Wire ← CoreOps.CreateWire[];
cellType ← CoreOps.CreateCellType[
class: panelCellClass,
public: public,
data: NEW [PanelRec ← args],
name: name,
props: props];
END;
END.