Is There Any CSV Current Source Block? SOLVED

Except for CSV Voltage Source, Is There Any CSV Current Source Block? I need it to model a piezoelectric sensor as an current input (arbitrary waveform) for other readout circuit design.

Thanks in advance if someone can help.


by JamesWang
July 03, 2020

What a really great question - I found out a lot about CIRCUITLAB! (I was unable to find an element like CSV current source).

Try this procedure (it works on my system):

1] Run simulation "CSV Voltage source Example" BUT with only one output V(PWS_CSV_OUT).

2] Export the results as a CSV file (at the top right of the Transient Analysis graph "Export Plot CSV").

3] Open the CSV file in a text editor. Copy the data points WITHOUT the final comma.

4] Paste the data inside the brackets of PWS() in the current source. (Magically, the LF characters disappear).

5] Check this example I_source_control

Note: I don't know the size limit for expressions such as PWL() and PWS(). In the example there are 250 data points in a file of 5k5bytes.

Happy experiments!

by EF82
July 03, 2020

2 Answers

Answer by mrobbins

Another approach is to use the CSV Voltage Source to generate a voltage, and then use a current source controlled by that voltage. This effectively creates a CSV-backed current source!

Here's a simulation with a working example:

Importantly, this uses the Behavioral Voltage and Current Sources support inside the simulation engine to define the current of I1 algebraically.

ACCEPTED +1 vote
by mrobbins
July 06, 2020

That's cool!

I never think about assigning a t-dependent variable by an output and then further use this variable as an t-dependent input for Current Source block.

Thx, dude.

by JamesWang
July 06, 2020

Just wanted to add that we've now added a CSV Current Source component to the toolbox, so this trick is no longer needed.

by mrobbins
1 day, 19 hours ago

Answer by JamesWang

HI, EF82

Thx for your instruction.

Following your idea, I've made a similar example like this ( )

+1 vote
by JamesWang
July 05, 2020

Your Answer

You must log in or create an account (free!) to answer a question.

Log in Create an account

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

Search Questions & Answers

Ask a Question

Anyone can ask a question.

Did you already search (see above) to see if a similar question has already been answered? If you can't find the answer, you may ask a question.

About This Site

CircuitLab's Q&A site is a FREE questions and answers forum for electronics and electrical engineering students, hobbyists, and professionals.

We encourage you to use our built-in schematic & simulation software to add more detail to your questions and answers.

Acceptable Questions:

  • Concept or theory questions
  • Practical engineering questions
  • “Homework” questions
  • Software/hardware intersection
  • Best practices
  • Design choices & component selection
  • Troubleshooting

Unacceptable Questions:

  • Non-English language content
  • Non-question discussion
  • Non-electronics questions
  • Vendor-specific topics
  • Pure software questions
  • CircuitLab software support

Please respect that there are both seasoned experts and total newbies here: please be nice, be constructive, and be specific!

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.