Circuit.new*Part*: moved name in signatures to the end + 1.5V default light voltage
This commit is contained in:
parent
e9490c797d
commit
2605183d4a
@ -48,22 +48,22 @@ export class Circuit {
|
||||
this.wires.forEach(wire => wire.resetCalculations());
|
||||
}
|
||||
|
||||
newBattery(rasterX: number, rasterY: number, name: string | undefined = undefined, voltage: number = 1.5, resistance: number = 0.5): Battery {
|
||||
newBattery(rasterX: number, rasterY: number, voltage: number = 1.5, resistance: number = 0.5, name: string | undefined = undefined): Battery {
|
||||
name = this.generateName(name, "Batterie");
|
||||
return this.add(new Battery(this, rasterX, rasterY, name, voltage, resistance));
|
||||
}
|
||||
|
||||
newLight(rasterX: number, rasterY: number, name: string | undefined = undefined, voltageMax: number = 3, resistance: number = 100): Light {
|
||||
newLight(rasterX: number, rasterY: number, voltageMax: number = 1.5, resistance: number = 100, name: string | undefined = undefined): Light {
|
||||
name = this.generateName(name, "Licht");
|
||||
return this.add(new Light(this, rasterX, rasterY, name, voltageMax, resistance));
|
||||
}
|
||||
|
||||
newRelay(rasterX: number, rasterY: number, name: string | undefined = undefined, voltageMin: number = 1.0, voltageMax: number = 3, resistance: number = 150): Relay {
|
||||
newRelay(rasterX: number, rasterY: number, voltageMin: number = 1.0, voltageMax: number = 3, resistance: number = 150, name: string | undefined = undefined): Relay {
|
||||
name = this.generateName(name, "Relais");
|
||||
return this.add(new Relay(this, rasterX, rasterY, name, voltageMin, voltageMax, resistance));
|
||||
}
|
||||
|
||||
newSwitch(rasterX: number, rasterY: number, name: string | undefined = undefined, momentary: boolean = false): Switch {
|
||||
newSwitch(rasterX: number, rasterY: number, momentary: boolean = false, name: string | undefined = undefined): Switch {
|
||||
name = this.generateName(name, "Relais");
|
||||
return this.add(new Switch(this, rasterX, rasterY, name, momentary));
|
||||
}
|
||||
|
||||
@ -6,14 +6,14 @@ function create() {
|
||||
const circuit = new Circuit("DEMO_002", "2. Reihe und Parallel");
|
||||
const battery0 = circuit.newBattery(1, 1);
|
||||
const battery1 = circuit.newBattery(2, 1);
|
||||
const light0 = circuit.newLight(1, 0);
|
||||
const light1 = circuit.newLight(2, 0);
|
||||
const light2 = circuit.newLight(1, 2);
|
||||
circuit.connect(light0.a, battery0.minus);
|
||||
circuit.connect(light0.b, light1.a);
|
||||
circuit.connect(light1.b, battery1.plus);
|
||||
const lightSeries0 = circuit.newLight(1, 0, 3);
|
||||
const lightSeries1 = circuit.newLight(2, 0, 3);
|
||||
const lightParallel = circuit.newLight(1, 2, 3);
|
||||
circuit.connect(lightSeries0.a, battery0.minus);
|
||||
circuit.connect(lightSeries0.b, lightSeries1.a);
|
||||
circuit.connect(lightSeries1.b, battery1.plus);
|
||||
circuit.connect(battery0.plus, battery1.minus);
|
||||
circuit.connect(light2.a, battery0.minus);
|
||||
circuit.connect(light2.b, battery1.plus);
|
||||
circuit.connect(lightParallel.a, battery0.minus);
|
||||
circuit.connect(lightParallel.b, battery1.plus);
|
||||
return circuit;
|
||||
}
|
||||
|
||||
@ -5,13 +5,13 @@ export const DEMO_003 = create();
|
||||
function create() {
|
||||
const circuit = new Circuit("DEMO_003", "3. Relais");
|
||||
|
||||
const lightBattery = circuit.newBattery(2, 0, "Licht Batterie");
|
||||
const lightInactive = circuit.newLight(2, 1, "Licht Inaktiv");
|
||||
const lightActive = circuit.newLight(2, 2, "Licht Aktiv");
|
||||
const lightBattery = circuit.newBattery(2, 0);
|
||||
const lightInactive = circuit.newLight(2, 1);
|
||||
const lightActive = circuit.newLight(2, 2);
|
||||
|
||||
const relay = circuit.newRelay(1, 2, "Relais");
|
||||
const relaySwitch = circuit.newSwitch(0.3, 3.3, "Taster", true);
|
||||
const relayBattery = circuit.newBattery(1.6, 3.3, "Relais Batterie");
|
||||
const relay = circuit.newRelay(1, 2);
|
||||
const relaySwitch = circuit.newSwitch(0.3, 3.3, true);
|
||||
const relayBattery = circuit.newBattery(1.6, 3.3);
|
||||
|
||||
circuit.connect(lightBattery.plus, lightInactive.b);
|
||||
circuit.connect(lightInactive.b, lightActive.b);
|
||||
|
||||
@ -6,8 +6,8 @@ function create() {
|
||||
const circuit = new Circuit("DEMO_004", "4. Relais");
|
||||
|
||||
const battery = circuit.newBattery(2, 0);
|
||||
const set = circuit.newSwitch(1, 0, undefined, true);
|
||||
const reset = circuit.newSwitch(2, 2.3, undefined, true);
|
||||
const set = circuit.newSwitch(1, 0, true);
|
||||
const reset = circuit.newSwitch(2, 2.3, true);
|
||||
const relay = circuit.newRelay(0, 2);
|
||||
const light = circuit.newLight(0, 3);
|
||||
circuit.connect(battery.minus, set.active);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user