lwcassid / Ammeter

Files

Pins

Symbol

PCB

Open in Flux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const inputTerminalElementId = "cc2dba81-3e89-b667-aa14-d2f17a8323ed";
const outputTerminalElementId = "36523bf2-fb3f-76c6-4a49-6aac5ebca3bd";
const inputTerminalElement = flux.getNodeById(inputTerminalElementId, "elementTerminal"); 
const outputTerminalElement = flux.getNodeById(outputTerminalElementId, "elementTerminal"); 
const currentThru = flux.createOutputNode("va");
flux.on("setup", () => {
    // set the internal resistance of the current meter to 100 ohms
    const resistance = 10;
    flux.simulationModel =  simModel(resistance);   
});
flux.on("beforeStep", () => {
    // set the internal resistance of the current meter to 100 ohms
    const resistance = 10;
    flux.simulationModel =  simModel(resistance);   
});
flux.on("afterStep", () => {
    currentThru.name = "Imeasured";
    currentThru.value = Number(inputTerminalElement?.voltage) / 10; // Ohms law I = V/R
    currentThru.unit = "A";
    flux.outputs = [currentThru];
});
function simModel(resistance: number): ResistorSimulationModelConfig {
    return {
        type: "resistor",
        resistance: resistance,
Design view of AmmeterDesign view of Ammeter
Enter to Rename, Shift+Enter to Preview

Reviews