// Howdy 👋.
// If you are new to writing code in Flux make sure to check out our get started docs: https://docs.flux.ai/reference/introduction
// We also have a Flux Slack Community in case you need help: https://join.slack.com/t/fluxcommunity/shared_invite/zt-p48n941f-wzQ06kGmuFJ2HXnGYT1JkA
// To infinity and beyond 🚀
const p1TerminalId = "b7c4a3a2-6176-4f23-a339-c7469cbd74a4"; //P1
const p2TerminalId = "5b206b7a-f36c-46d5-85e6-a215110a469c"; //P2
const p1Terminal = flux.getNodeById(p1TerminalId, "elementTerminal");
const p2Terminal = flux.getNodeById(p2TerminalId, "elementTerminal");
const voltageInputNode = flux.createOutputNode("v1");
const voltageOutputNode = flux.createOutputNode("v2");
const voltageDrop = flux.createOutputNode("vdrop");
const amperageOutputNode = flux.createOutputNode("current");
//setup event
flux.on("setup", () => {
const lux = Number(flux.controls.find(control => control.name === "Lumens per square meter (Lux)")?.value || 400);
// In the inspector, Controls for adjusting lux is set default to 400. Usual sunset has 400 lux
const cds = Number(flux.properties.find((prop) => prop.name === "CdS")?.value || 0.8); // options are 0.7, 0.8, 0.9