Skip to content

Commit

Permalink
Added ability to parameterize time points for tran and pwl
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyDelp committed Aug 10, 2023
1 parent 9dab0a4 commit 8818fce
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(JoSIM VERSION 2.6.6)
project(JoSIM VERSION 2.6.7)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Referencing:
---

## Changelog
### v2.6.7
- Added ability to parameterize time points specified for `.tran` and `pwl` commands.

### v2.6.6
- Fixed a bug in noise source generation when noise step is less than or equal to the simulation step.
- Reduced aggressiveness of timestep scale down when close to transmission line step delay size. Now only scales down if TX delay is less than 1 step (previously 4)
Expand Down
3 changes: 2 additions & 1 deletion include/JoSIM/Transient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <vector>

#include "JoSIM/TypeDefines.hpp"
#include "JoSIM/Parameters.hpp"

namespace JoSIM {
class Transient {
Expand Down Expand Up @@ -39,7 +40,7 @@ class Transient {
void startup(bool value) { startup_ = value; }

static void identify_simulation(std::vector<tokens_t>& controls,
Transient& tObj);
Transient& tObj, param_map& params);
};
} // namespace JoSIM

Expand Down
2 changes: 1 addition & 1 deletion src/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void Function::parse_pwl(const tokens_t& t, const Input& iObj,
values.push_back(0.0);
}
for (int64_t i = 0; i < t.size(); i = i + 2) {
timesteps.push_back(Misc::modifier(t.at(i)));
timesteps.push_back(parse_param(t.at(i), iObj.parameters, s));
}
for (int64_t i = 1; i < t.size(); i = i + 2) {
values.push_back(parse_param(t.at(i), iObj.parameters, s));
Expand Down
10 changes: 5 additions & 5 deletions src/Transient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using namespace JoSIM;

void Transient::identify_simulation(std::vector<tokens_t>& controls,
Transient& tObj) {
Transient& tObj, param_map& params) {
// Flag to store that a transient simulation was found
bool transFound = false;
// Loop through all the controls
Expand Down Expand Up @@ -39,16 +39,16 @@ void Transient::identify_simulation(std::vector<tokens_t>& controls,
// If there are more than 2 tokens
} else {
// Set the step size
tObj.tstep(Misc::modifier(i.at(1)));
tObj.tstep(parse_param(i.at(1), params));
if (i.size() > 2) {
// Set the simulation stop time
tObj.tstop(Misc::modifier(i.at(2)));
tObj.tstop(parse_param(i.at(2), params));
if (i.size() > 3) {
// Set the print start time
tObj.prstart(Misc::modifier(i.at(3)));
tObj.prstart(parse_param(i.at(3), params));
if (i.size() > 4) {
// Set the print step size
tObj.prstep(Misc::modifier(i.at(4)));
tObj.prstep(parse_param(i.at(4), params));
} else
// Set default
tObj.prstep(tObj.tstep());
Expand Down
3 changes: 2 additions & 1 deletion src/josim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ int main(int argc, const char** argv) {
// Simulate IV curves if need be
IV ivObj(iObj);
// Identify the simulation parameters
Transient::identify_simulation(iObj.controls, iObj.transSim);
Transient::identify_simulation(iObj.controls, iObj.transSim,
iObj.parameters);
// Create matrix object
Matrix mObj;
// Create the matrix in csr format
Expand Down
41 changes: 41 additions & 0 deletions test/ex_jtl_param_times.cir
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
* Example JTL Basic
.param tstep=0.25p
.param tstop=1n
.param pstart=0
.param pstep=0.25p

.param tpsep=300p
.param trise=2.5p
.param tfall=trise

.param tp1=0+tpsep
.param tp1_p=tp1+trise
.param tp1_f=tp1_p+tfall

.param tp2=tp1+tpsep
.param tp2_p=tp2+trise
.param tp2_f=tp2_p+tfall

B01 3 7 jmitll area=2.16
B02 6 8 jmitll area=2.16
IB01 0 1 pwl(0 0 5p 280u)
L01 4 3 2p
L02 3 2 2.425p
L03 2 6 2.425p
L04 6 5 2.031p
LP01 0 7 0.086p
LP02 0 8 0.096p
LPR01 2 1 0.278p
LRB01 7 9 0.086p
LRB02 8 10 0.086p
RB01 9 3 5.23
RB02 10 6 5.23
ROUT 5 0 2
VIN 4 0 pwl(0 0 tp1 0 tp1_p 827.13u tp1_f 0 tp2 0 tp2_p 827.13u tp2_f 0)
.model jmitll jj(rtype=1, vg=2.8mV, cap=0.07pF, r0=160, rN=16, icrit=0.1mA)
.tran tstep tstop pstart pstep
.print DEVV VIN
.print DEVI ROUT
.print PHASE B01
.print PHASE B02
.end

0 comments on commit 8818fce

Please sign in to comment.