public void computeInventory() { ItemStack primaryCable = inventory.getStackInSlot(TransformerContainer.primaryCableSlotId); ItemStack secondaryCable = inventory.getStackInSlot(TransformerContainer.secondaryCableSlotId); ItemStack core = inventory.getStackInSlot(TransformerContainer.ferromagneticSlotId); ElectricalCableDescriptor primaryCableDescriptor = null, secondaryCableDescriptor = null; // tranformerProcess.setEnable(primaryCable != null && core != null && secondaryCable != null); if (primaryCable != null) { primaryCableDescriptor = (ElectricalCableDescriptor) Eln.sixNodeItem.getDescriptor(primaryCable); } if (secondaryCable != null) { secondaryCableDescriptor = (ElectricalCableDescriptor) Eln.sixNodeItem.getDescriptor(secondaryCable); } if (primaryCableDescriptor != null) voltagePrimaryWatchdog.setUNominal(primaryCableDescriptor.electricalNominalVoltage); else voltagePrimaryWatchdog.setUNominal(1000000); if (secondaryCableDescriptor != null) voltageSecondaryWatchdog.setUNominal(secondaryCableDescriptor.electricalNominalVoltage); else voltageSecondaryWatchdog.setUNominal(1000000); double coreFactor = 1; if (core != null) { FerromagneticCoreDescriptor coreDescriptor = (FerromagneticCoreDescriptor) FerromagneticCoreDescriptor.getDescriptor(core); coreFactor = coreDescriptor.cableMultiplicator; } if (primaryCable == null || core == null) { primaryLoad.highImpedance(); primaryMaxCurrent = 0; } else { primaryCableDescriptor.applyTo(primaryLoad, coreFactor); primaryMaxCurrent = (float) primaryCableDescriptor.electricalMaximalCurrent; } if (secondaryCable == null || core == null) { secondaryLoad.highImpedance(); secondaryMaxCurrent = 0; } else { secondaryCableDescriptor.applyTo(secondaryLoad, coreFactor); secondaryMaxCurrent = (float) secondaryCableDescriptor.electricalMaximalCurrent; } if (primaryCable != null && secondaryCable != null) { interSystemProcess.setRatio(1.0 * secondaryCable.stackSize / primaryCable.stackSize); /* * tranformerProcess.setIMax( 2 * primaryCableDescriptor.electricalNominalPower / primaryCableDescriptor.electricalNominalVoltage, 2 * secondaryCableDescriptor.electricalNominalPower / secondaryCableDescriptor.electricalNominalVoltage); */ } else { interSystemProcess.setRatio(1); // tranformerProcess.setIMax( } }
public void setupPhysical() { double rs = descriptor.getRsValue(inventory); inductor.setL(descriptor.getlValue(inventory)); positiveLoad.setRs(rs); negativeLoad.setRs(rs); if (fromNbt) { fromNbt = false; } else { inductor.resetStates(); } }
public PowerInductorElement( TransparentNode transparentNode, TransparentNodeDescriptor descriptor) { super(transparentNode, descriptor); this.descriptor = (PowerInductorDescriptor) descriptor; electricalLoadList.add(positiveLoad); electricalLoadList.add(negativeLoad); electricalComponentList.add(inductor); positiveLoad.setAsMustBeFarFromInterSystem(); }
@Override public String multiMeterString(Direction side) { if (side == front.left()) return Utils.plotVolt("UP+:", primaryLoad.getU()) + Utils.plotAmpere("IP+:", primaryLoad.getCurrent()); if (side == front.right()) return Utils.plotVolt("US+:", secondaryLoad.getU()) + Utils.plotAmpere("IS+:", secondaryLoad.getCurrent()); return Utils.plotVolt("UP+:", primaryLoad.getU()) + Utils.plotAmpere("IP+:", primaryLoad.getCurrent()) + Utils.plotVolt(" US+:", secondaryLoad.getU()) + Utils.plotAmpere("IS+:", secondaryLoad.getCurrent()); }