Simulate a solar cell in pyspice #338
Unanswered
andreacalleja
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am simulating a solar cell in pyspice using subcircuits and an intensity source and I don't know how to obtain the Current-Voltage graph.
This is my circuit
And this is my code at the moment
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import tkinter as tk
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
from PySpice.Doc.ExampleTools import find_libraries
from PySpice.Spice.Netlist import Circuit
from PySpice.Spice.Library import SpiceLibrary
from PySpice.Unit import *
from PySpice.Physics.SemiConductor import ShockleyDiode
from PySpice.Spice.Netlist import Circuit, SubCircuit
libraries_path = find_libraries()
spice_library = SpiceLibrary("C:\users\andre\Desktop")
#SUBCIRCUIT
class celulaSolar(SubCircuit):
#name= 'celula_solar'
nodes = ('n1', 'n2')
def init(self, name, R1=1@u_Ω, R2=1@u_Ω):
SubCircuit.init(self, name, *self.nodes)
circuit = Circuit('Test')
circuit.include(spice_library['1N4148'])
circuit.I('L', 'n1', circuit.gnd, 10@u_A)
circuit.subcircuit(celulaSolar('celula_solar'))
circuit.X(1, 'celula_solar', 'n1', 'n2')
print(circuit)
temperatures = [0, 25, 100]@u_Degree
analyses = {}
for temperature in temperatures:
simulator = circuit.simulator(temperature=temperature, nominal_temperature=temperature)
analysis = simulator.dc(IL=slice(0, 5, 0.1))
analyses[float(temperature)] = analysis
Beta Was this translation helpful? Give feedback.
All reactions