default electrical characteristics for parts

This commit is contained in:
Patrick Haßel 2025-02-03 13:06:47 +01:00
parent feb7ea9161
commit 21084b2de2
5 changed files with 14 additions and 14 deletions

View File

@ -4,14 +4,14 @@ import {Light} from '../parts/light/Light';
import {Wire} from '../wire/Wire'; import {Wire} from '../wire/Wire';
import {RESISTANCE_MIN} from './Calculation'; import {RESISTANCE_MIN} from './Calculation';
const battery = new Battery(1, 3, "Batterie", 3, 0.5); const battery = new Battery(1, 3, "Batterie");
const light = new Light(1, 1, "Licht", 3, 150); const light = new Light(1, 1, "Licht");
export const DEMO_001 = new Circuit( export const DEMO_001 = new Circuit(
"DEMO_001", "DEMO_001",
"1. Batterie und Licht", "1. Batterie und Licht",
[battery, light,], [battery, light],
[ [
new Wire(battery.minus, light.a, RESISTANCE_MIN, ""), new Wire(battery.minus, light.a, RESISTANCE_MIN, ""),
new Wire(battery.plus, light.b, RESISTANCE_MIN, ""), new Wire(battery.plus, light.b, RESISTANCE_MIN, ""),

View File

@ -6,12 +6,12 @@ import {RESISTANCE_MIN} from './Calculation';
const battery0 = new Battery(1, 3, "Batterie 1", 1.5, 0.5); const battery0 = new Battery(1, 3, "Batterie 1", 1.5, 0.5);
const battery1 = new Battery(3, 3, "Batterie 2", 1.5, 0.5); const battery1 = new Battery(3, 3, "Batterie 2", 1.5, 0.5);
const light0 = new Light(1, 1, "Licht 1", 3, 150); const light0 = new Light(1, 1, "Licht 1");
const light1 = new Light(3, 1, "Licht 2", 3, 150); const light1 = new Light(3, 1, "Licht 2");
const light2 = new Light(2, 5, "Licht 3", 3, 150); const light2 = new Light(2, 5, "Licht 3");
export const DEMO_002 = new Circuit( export const DEMO_002 = new Circuit(
"DEMO_001", "DEMO_002",
"2. Reihe und Parallel", "2. Reihe und Parallel",
[battery0, battery1, light0, light1, light2], [battery0, battery1, light0, light1, light2],
[ [

View File

@ -41,12 +41,12 @@ export class Parts {
this.dragCursor = Point.fromEvent($event); this.dragCursor = Point.fromEvent($event);
} }
newBattery(rasterX: number, rasterY: number, voltage: number): Battery { newBattery(rasterX: number, rasterY: number): Battery {
return this.add(new Battery(rasterX, rasterY, this.generateName("Batterie"), voltage, 0.5)); return this.add(new Battery(rasterX, rasterY, this.generateName("Batterie")));
} }
newLight(rasterX: number, rasterY: number): Light { newLight(rasterX: number, rasterY: number): Light {
return this.add(new Light(rasterX, rasterY, this.generateName("Licht"), 3, 150)); return this.add(new Light(rasterX, rasterY, this.generateName("Licht")));
} }
private generateName(baseName: string) { private generateName(baseName: string) {

View File

@ -14,8 +14,8 @@ export class Battery extends Part {
rasterX: number, rasterX: number,
rasterY: number, rasterY: number,
name: string, name: string,
public voltage: number, public voltage: number = 3,
public resistance: number, public resistance: number = 0.5,
) { ) {
super(PartType.Battery, name, rasterX, rasterY); super(PartType.Battery, name, rasterX, rasterY);
new Wire(this.minus, this.plus, resistance, "Innenwiderstand"); new Wire(this.minus, this.plus, resistance, "Innenwiderstand");

View File

@ -16,8 +16,8 @@ export class Light extends Part {
rasterX: number, rasterX: number,
rasterY: number, rasterY: number,
name: string, name: string,
public voltageMax: number, public voltageMax: number = 3,
public resistance: number, public resistance: number = 100,
) { ) {
super(PartType.Light, name, rasterX, rasterY); super(PartType.Light, name, rasterX, rasterY);
new Wire(this.a, this.b, resistance, "Glühdraht"); new Wire(this.a, this.b, resistance, "Glühdraht");