소스 검색

Latexify + Hybrid

- Bugfixes + Features for Latexify
- Added directional crossings for hybrid
rparedis 4 년 전
부모
커밋
5b114c2a5d

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 7 - 7
examples/notebook/.ipynb_checkpoints/HybridTrain-checkpoint.ipynb


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 5 - 5
examples/notebook/HybridTrain.ipynb


+ 51 - 51
examples/notebook/accODE.dot

@@ -5,56 +5,56 @@ digraph model {
  label=<<B>accODE (CBD)</B>>;
  labelloc="t";
  fontsize=20;
- node_140486102033360 [label="v", shape=none];
- inter_140486102304944_OUT1 -> node_140486102033360 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486102032640 [label="x", shape=none];
- inter_140486102304944_OUT2 -> node_140486102032640 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486102304944 [label="CBD\n(RK)", shape=Msquare];
- inter_140486160373504_OUT1 -> node_140486102304944 [headlabel="v0", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486103569696_OUT1 -> node_140486102304944 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102863488_time -> node_140486102304944 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102863488_rel_time -> node_140486102304944 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102863488_delta -> node_140486102304944 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486160373504_OUT1 -> node_140486102304944 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486160374128_OUT1 -> node_140486102304944 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102304944_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486102304944 -> inter_140486102304944_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486102304944_OUT2 [shape=point, width=0.01, height=0.01];
- node_140486102304944 -> inter_140486102304944_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486102304944_h_new [shape=point, width=0.01, height=0.01];
- node_140486102304944 -> inter_140486102304944_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486102863488 [label="Clock\n(clock)", shape=Msquare];
- inter_140486129042048_OUT1 -> node_140486102863488 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102863488_time [shape=point, width=0.01, height=0.01];
- node_140486102863488 -> inter_140486102863488_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486102863488_rel_time [shape=point, width=0.01, height=0.01];
- node_140486102863488 -> inter_140486102863488_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486102863488_delta [shape=point, width=0.01, height=0.01];
- node_140486102863488 -> inter_140486102863488_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486031326224 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
- inter_140486031326224_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486031326224 -> inter_140486031326224_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486031326368 [label="DelayBlock\n(HDelay)", shape=box];
- inter_140486102304944_h_new -> node_140486031326368 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486031326224_OUT1 -> node_140486031326368 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486031326368_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486031326368 -> inter_140486031326368_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486160374128 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
- inter_140486160374128_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486160374128 -> inter_140486160374128_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486160373504 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
- inter_140486160373504_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486160373504 -> inter_140486160373504_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486103569696 [label=" ConstantBlock\n(k)\n0.15", shape=ellipse];
- inter_140486103569696_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486103569696 -> inter_140486103569696_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486099690784 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
- inter_140486099690784_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486099690784 -> inter_140486099690784_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486129042048 [label="MinBlock\n(Min)", shape=box];
- inter_140486099690784_OUT1 -> node_140486129042048 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486031326368_OUT1 -> node_140486129042048 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486129042048_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486129042048 -> inter_140486129042048_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777093798016 [label="v", shape=none];
+ inter_139777093799648_OUT1 -> node_139777093798016 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777093799552 [label="x", shape=none];
+ inter_139777093799648_OUT2 -> node_139777093799552 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777093799648 [label="CBD\n(RK)", shape=Msquare];
+ inter_139777092435200_OUT1 -> node_139777093799648 [headlabel="v0", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777089054272_OUT1 -> node_139777093799648 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095783040_time -> node_139777093799648 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095783040_rel_time -> node_139777093799648 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095783040_delta -> node_139777093799648 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777092435200_OUT1 -> node_139777093799648 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777089063856_OUT1 -> node_139777093799648 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093799648_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777093799648 -> inter_139777093799648_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777093799648_OUT2 [shape=point, width=0.01, height=0.01];
+ node_139777093799648 -> inter_139777093799648_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777093799648_h_new [shape=point, width=0.01, height=0.01];
+ node_139777093799648 -> inter_139777093799648_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777095783040 [label="Clock\n(clock)", shape=Msquare];
+ inter_139777093799456_OUT1 -> node_139777095783040 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095783040_time [shape=point, width=0.01, height=0.01];
+ node_139777095783040 -> inter_139777095783040_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777095783040_rel_time [shape=point, width=0.01, height=0.01];
+ node_139777095783040 -> inter_139777095783040_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777095783040_delta [shape=point, width=0.01, height=0.01];
+ node_139777095783040 -> inter_139777095783040_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094127424 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
+ inter_139777094127424_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094127424 -> inter_139777094127424_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096285872 [label="DelayBlock\n(HDelay)", shape=box];
+ inter_139777093799648_h_new -> node_139777096285872 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777094127424_OUT1 -> node_139777096285872 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777096285872_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096285872 -> inter_139777096285872_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777089063856 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
+ inter_139777089063856_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777089063856 -> inter_139777089063856_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777092435200 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
+ inter_139777092435200_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777092435200 -> inter_139777092435200_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777089054272 [label=" ConstantBlock\n(k)\n0.15", shape=ellipse];
+ inter_139777089054272_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777089054272 -> inter_139777089054272_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777093799120 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
+ inter_139777093799120_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777093799120 -> inter_139777093799120_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777093799456 [label="MinBlock\n(Min)", shape=box];
+ inter_139777093799120_OUT1 -> node_139777093799456 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777096285872_OUT1 -> node_139777093799456 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093799456_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777093799456 -> inter_139777093799456_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
 
 }

+ 50 - 50
examples/notebook/brake.dot

@@ -5,55 +5,55 @@ digraph model {
  label=<<B>brakeODE (CBD)</B>>;
  labelloc="t";
  fontsize=20;
- node_140486099470176 [label="v", shape=none];
- inter_140486099470224_OUT1 -> node_140486099470176 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486099468544 [label="x", shape=none];
- inter_140486099470224_OUT2 -> node_140486099468544 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486099470224 [label="CBD\n(RK)", shape=Msquare];
- inter_140486126363312_OUT1 -> node_140486099470224 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_time -> node_140486099470224 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_rel_time -> node_140486099470224 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_delta -> node_140486099470224 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486126364416_OUT1 -> node_140486099470224 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486126365424_OUT1 -> node_140486099470224 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486099470224_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486099470224 -> inter_140486099470224_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486099470224_OUT2 [shape=point, width=0.01, height=0.01];
- node_140486099470224 -> inter_140486099470224_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486099470224_h_new [shape=point, width=0.01, height=0.01];
- node_140486099470224 -> inter_140486099470224_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486100124480 [label="Clock\n(clock)", shape=Msquare];
- inter_140486168965904_OUT1 -> node_140486100124480 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_time [shape=point, width=0.01, height=0.01];
- node_140486100124480 -> inter_140486100124480_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486100124480_rel_time [shape=point, width=0.01, height=0.01];
- node_140486100124480 -> inter_140486100124480_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486100124480_delta [shape=point, width=0.01, height=0.01];
- node_140486100124480 -> inter_140486100124480_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486103606128 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
- inter_140486103606128_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486103606128 -> inter_140486103606128_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486102207936 [label="DelayBlock\n(HDelay)", shape=box];
- inter_140486099470224_h_new -> node_140486102207936 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486103606128_OUT1 -> node_140486102207936 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102207936_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486102207936 -> inter_140486102207936_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486126365424 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
- inter_140486126365424_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486126365424 -> inter_140486126365424_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486126364416 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
- inter_140486126364416_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486126364416 -> inter_140486126364416_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486126363312 [label=" ConstantBlock\n(k)\n0.08", shape=ellipse];
- inter_140486126363312_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486126363312 -> inter_140486126363312_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486106356608 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
- inter_140486106356608_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486106356608 -> inter_140486106356608_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486168965904 [label="MinBlock\n(Min)", shape=box];
- inter_140486106356608_OUT1 -> node_140486168965904 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102207936_OUT1 -> node_140486168965904 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486168965904_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486168965904 -> inter_140486168965904_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777089133824 [label="v", shape=none];
+ inter_139777091681680_OUT1 -> node_139777089133824 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777091681632 [label="x", shape=none];
+ inter_139777091681680_OUT2 -> node_139777091681632 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777091681680 [label="CBD\n(RK)", shape=Msquare];
+ inter_139777094075536_OUT1 -> node_139777091681680 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_time -> node_139777091681680 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_rel_time -> node_139777091681680 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_delta -> node_139777091681680 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777096314784_OUT1 -> node_139777091681680 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777094480416_OUT1 -> node_139777091681680 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091681680_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777091681680 -> inter_139777091681680_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777091681680_OUT2 [shape=point, width=0.01, height=0.01];
+ node_139777091681680 -> inter_139777091681680_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777091681680_h_new [shape=point, width=0.01, height=0.01];
+ node_139777091681680 -> inter_139777091681680_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777095941328 [label="Clock\n(clock)", shape=Msquare];
+ inter_139777096313680_OUT1 -> node_139777095941328 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_time [shape=point, width=0.01, height=0.01];
+ node_139777095941328 -> inter_139777095941328_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777095941328_rel_time [shape=point, width=0.01, height=0.01];
+ node_139777095941328 -> inter_139777095941328_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777095941328_delta [shape=point, width=0.01, height=0.01];
+ node_139777095941328 -> inter_139777095941328_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777088248848 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
+ inter_139777088248848_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777088248848 -> inter_139777088248848_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777091974480 [label="DelayBlock\n(HDelay)", shape=box];
+ inter_139777091681680_h_new -> node_139777091974480 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777088248848_OUT1 -> node_139777091974480 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091974480_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777091974480 -> inter_139777091974480_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094480416 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
+ inter_139777094480416_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094480416 -> inter_139777094480416_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096314784 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
+ inter_139777096314784_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096314784 -> inter_139777096314784_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094075536 [label=" ConstantBlock\n(k)\n0.08", shape=ellipse];
+ inter_139777094075536_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094075536 -> inter_139777094075536_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096314160 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
+ inter_139777096314160_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096314160 -> inter_139777096314160_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096313680 [label="MinBlock\n(Min)", shape=box];
+ inter_139777096314160_OUT1 -> node_139777096313680 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091974480_OUT1 -> node_139777096313680 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777096313680_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096313680 -> inter_139777096313680_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
 
 }

+ 50 - 50
examples/notebook/brakeODE.dot

@@ -5,55 +5,55 @@ digraph model {
  label=<<B>brakeODE (CBD)</B>>;
  labelloc="t";
  fontsize=20;
- node_140486099470176 [label="v", shape=none];
- inter_140486099470224_OUT1 -> node_140486099470176 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486099468544 [label="x", shape=none];
- inter_140486099470224_OUT2 -> node_140486099468544 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486099470224 [label="CBD\n(RK)", shape=Msquare];
- inter_140486126363312_OUT1 -> node_140486099470224 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_time -> node_140486099470224 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_rel_time -> node_140486099470224 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_delta -> node_140486099470224 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486126364416_OUT1 -> node_140486099470224 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486126365424_OUT1 -> node_140486099470224 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486099470224_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486099470224 -> inter_140486099470224_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486099470224_OUT2 [shape=point, width=0.01, height=0.01];
- node_140486099470224 -> inter_140486099470224_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486099470224_h_new [shape=point, width=0.01, height=0.01];
- node_140486099470224 -> inter_140486099470224_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486100124480 [label="Clock\n(clock)", shape=Msquare];
- inter_140486168965904_OUT1 -> node_140486100124480 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486100124480_time [shape=point, width=0.01, height=0.01];
- node_140486100124480 -> inter_140486100124480_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486100124480_rel_time [shape=point, width=0.01, height=0.01];
- node_140486100124480 -> inter_140486100124480_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486100124480_delta [shape=point, width=0.01, height=0.01];
- node_140486100124480 -> inter_140486100124480_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486103606128 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
- inter_140486103606128_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486103606128 -> inter_140486103606128_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486102207936 [label="DelayBlock\n(HDelay)", shape=box];
- inter_140486099470224_h_new -> node_140486102207936 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486103606128_OUT1 -> node_140486102207936 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102207936_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486102207936 -> inter_140486102207936_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486126365424 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
- inter_140486126365424_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486126365424 -> inter_140486126365424_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486126364416 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
- inter_140486126364416_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486126364416 -> inter_140486126364416_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486126363312 [label=" ConstantBlock\n(k)\n0.08", shape=ellipse];
- inter_140486126363312_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486126363312 -> inter_140486126363312_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486106356608 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
- inter_140486106356608_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486106356608 -> inter_140486106356608_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486168965904 [label="MinBlock\n(Min)", shape=box];
- inter_140486106356608_OUT1 -> node_140486168965904 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486102207936_OUT1 -> node_140486168965904 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486168965904_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486168965904 -> inter_140486168965904_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777089133824 [label="v", shape=none];
+ inter_139777091681680_OUT1 -> node_139777089133824 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777091681632 [label="x", shape=none];
+ inter_139777091681680_OUT2 -> node_139777091681632 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777091681680 [label="CBD\n(RK)", shape=Msquare];
+ inter_139777094075536_OUT1 -> node_139777091681680 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_time -> node_139777091681680 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_rel_time -> node_139777091681680 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_delta -> node_139777091681680 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777096314784_OUT1 -> node_139777091681680 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777094480416_OUT1 -> node_139777091681680 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091681680_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777091681680 -> inter_139777091681680_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777091681680_OUT2 [shape=point, width=0.01, height=0.01];
+ node_139777091681680 -> inter_139777091681680_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777091681680_h_new [shape=point, width=0.01, height=0.01];
+ node_139777091681680 -> inter_139777091681680_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777095941328 [label="Clock\n(clock)", shape=Msquare];
+ inter_139777096313680_OUT1 -> node_139777095941328 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777095941328_time [shape=point, width=0.01, height=0.01];
+ node_139777095941328 -> inter_139777095941328_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777095941328_rel_time [shape=point, width=0.01, height=0.01];
+ node_139777095941328 -> inter_139777095941328_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777095941328_delta [shape=point, width=0.01, height=0.01];
+ node_139777095941328 -> inter_139777095941328_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777088248848 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
+ inter_139777088248848_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777088248848 -> inter_139777088248848_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777091974480 [label="DelayBlock\n(HDelay)", shape=box];
+ inter_139777091681680_h_new -> node_139777091974480 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777088248848_OUT1 -> node_139777091974480 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091974480_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777091974480 -> inter_139777091974480_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094480416 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
+ inter_139777094480416_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094480416 -> inter_139777094480416_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096314784 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
+ inter_139777096314784_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096314784 -> inter_139777096314784_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094075536 [label=" ConstantBlock\n(k)\n0.08", shape=ellipse];
+ inter_139777094075536_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094075536 -> inter_139777094075536_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096314160 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
+ inter_139777096314160_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096314160 -> inter_139777096314160_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096313680 [label="MinBlock\n(Min)", shape=box];
+ inter_139777096314160_OUT1 -> node_139777096313680 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091974480_OUT1 -> node_139777096313680 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777096313680_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096313680 -> inter_139777096313680_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
 
 }

+ 50 - 50
examples/notebook/fricODE.dot

@@ -5,55 +5,55 @@ digraph model {
  label=<<B>fricODE (CBD)</B>>;
  labelloc="t";
  fontsize=20;
- node_140486099747120 [label="v", shape=none];
- inter_140486103170064_OUT1 -> node_140486099747120 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486099272656 [label="x", shape=none];
- inter_140486103170064_OUT2 -> node_140486099272656 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
- node_140486103170064 [label="CBD\n(RK)", shape=Msquare];
- inter_140486100170256_OUT1 -> node_140486103170064 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486159631504_time -> node_140486103170064 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486159631504_rel_time -> node_140486103170064 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486159631504_delta -> node_140486103170064 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486168195232_OUT1 -> node_140486103170064 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486099872928_OUT1 -> node_140486103170064 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486103170064_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486103170064 -> inter_140486103170064_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486103170064_OUT2 [shape=point, width=0.01, height=0.01];
- node_140486103170064 -> inter_140486103170064_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486103170064_h_new [shape=point, width=0.01, height=0.01];
- node_140486103170064 -> inter_140486103170064_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486159631504 [label="Clock\n(clock)", shape=Msquare];
- inter_140486107374832_OUT1 -> node_140486159631504 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486159631504_time [shape=point, width=0.01, height=0.01];
- node_140486159631504 -> inter_140486159631504_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486159631504_rel_time [shape=point, width=0.01, height=0.01];
- node_140486159631504 -> inter_140486159631504_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
- inter_140486159631504_delta [shape=point, width=0.01, height=0.01];
- node_140486159631504 -> inter_140486159631504_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486099871392 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
- inter_140486099871392_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486099871392 -> inter_140486099871392_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486099873168 [label="DelayBlock\n(HDelay)", shape=box];
- inter_140486103170064_h_new -> node_140486099873168 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486099871392_OUT1 -> node_140486099873168 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486099873168_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486099873168 -> inter_140486099873168_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486099872928 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
- inter_140486099872928_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486099872928 -> inter_140486099872928_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486168195232 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
- inter_140486168195232_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486168195232 -> inter_140486168195232_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486100170256 [label=" ConstantBlock\n(k)\n0.03", shape=ellipse];
- inter_140486100170256_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486100170256 -> inter_140486100170256_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486100220032 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
- inter_140486100220032_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486100220032 -> inter_140486100220032_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
- node_140486107374832 [label="MinBlock\n(Min)", shape=box];
- inter_140486100220032_OUT1 -> node_140486107374832 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486099873168_OUT1 -> node_140486107374832 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
- inter_140486107374832_OUT1 [shape=point, width=0.01, height=0.01];
- node_140486107374832 -> inter_140486107374832_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096514240 [label="v", shape=none];
+ inter_139777090224336_OUT1 -> node_139777096514240 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777096515152 [label="x", shape=none];
+ inter_139777090224336_OUT2 -> node_139777096515152 [headlabel="", arrowhead="normal", arrowtail="none", dir=both];
+ node_139777090224336 [label="CBD\n(RK)", shape=Msquare];
+ inter_139777091043392_OUT1 -> node_139777090224336 [headlabel="k", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093889376_time -> node_139777090224336 [headlabel="time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093889376_rel_time -> node_139777090224336 [headlabel="rel_time", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093889376_delta -> node_139777090224336 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777091458672_OUT1 -> node_139777090224336 [headlabel="IC1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777092687568_OUT1 -> node_139777090224336 [headlabel="IC2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777090224336_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777090224336 -> inter_139777090224336_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777090224336_OUT2 [shape=point, width=0.01, height=0.01];
+ node_139777090224336 -> inter_139777090224336_OUT2 [taillabel="OUT2", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777090224336_h_new [shape=point, width=0.01, height=0.01];
+ node_139777090224336 -> inter_139777090224336_h_new [taillabel="h_new", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777093889376 [label="Clock\n(clock)", shape=Msquare];
+ inter_139777093567872_OUT1 -> node_139777093889376 [headlabel="h", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093889376_time [shape=point, width=0.01, height=0.01];
+ node_139777093889376 -> inter_139777093889376_time [taillabel="time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777093889376_rel_time [shape=point, width=0.01, height=0.01];
+ node_139777093889376 -> inter_139777093889376_rel_time [taillabel="rel_time", arrowtail="invempty", arrowhead="none", dir=both];
+ inter_139777093889376_delta [shape=point, width=0.01, height=0.01];
+ node_139777093889376 -> inter_139777093889376_delta [taillabel="delta", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094289728 [label=" ConstantBlock\n(HIC)\n0.1", shape=ellipse];
+ inter_139777094289728_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094289728 -> inter_139777094289728_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777094290592 [label="DelayBlock\n(HDelay)", shape=box];
+ inter_139777090224336_h_new -> node_139777094290592 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777094289728_OUT1 -> node_139777094290592 [headlabel="IC", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777094290592_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777094290592 -> inter_139777094290592_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777092687568 [label=" ConstantBlock\n(x0)\n0.0", shape=ellipse];
+ inter_139777092687568_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777092687568 -> inter_139777092687568_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777091458672 [label=" ConstantBlock\n(v0)\n0.0", shape=ellipse];
+ inter_139777091458672_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777091458672 -> inter_139777091458672_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777091043392 [label=" ConstantBlock\n(k)\n0.03", shape=ellipse];
+ inter_139777091043392_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777091043392 -> inter_139777091043392_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777096207856 [label=" ConstantBlock\n(H)\ninf", shape=ellipse];
+ inter_139777096207856_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777096207856 -> inter_139777096207856_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
+ node_139777093567872 [label="MinBlock\n(Min)", shape=box];
+ inter_139777096207856_OUT1 -> node_139777093567872 [headlabel="IN1", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777094290592_OUT1 -> node_139777093567872 [headlabel="IN2", arrowhead="normal", arrowtail="none", dir=both];
+ inter_139777093567872_OUT1 [shape=point, width=0.01, height=0.01];
+ node_139777093567872 -> inter_139777093567872_OUT1 [taillabel="OUT1", arrowtail="invempty", arrowhead="none", dir=both];
 
 }

+ 22 - 13
src/CBD/converters/hybrid.py

@@ -171,16 +171,21 @@ class CBDRunner(AtomicDEVS):
 
 	Args:
 		name (str):         The name of the CBD model.
-		cbd (CBD.Core.CBD):  The CBD model to run.
+		cbd (CBD.Core.CBD): The CBD model to run.
 		initials (dict):    The initial conditions for all the inputs.
-		stopped (bool):     Whether to start from paused mode or not.
-							In this paused mode, the model will not
-							progress. Useful when in combination with
-							multiple ODEs. Defaults to :code:`False`.
-		algo:               The root finding algorithm function. See
-							:class:`CrossingDetection` for more info.
-		**kwargs:           Optional parameters for the zero-crossing
-							detection algorithm.
+		stopped (bool):     Whether to start from paused mode or not. In this paused mode, the
+							model will not progress. Useful when in combination with multiple
+							ODEs. Defaults to :code:`False`.
+		crossings (dict):   Dictionary of :code:`{ name -> value }` that defines which
+							variable needs to be detected for a crossing through a certain value.
+							The value can be a string, starting with either :code:`<`, :code:`>`
+							or :code:`=`, which respectively means a crossing from low to high,
+							high to low or either side. Notice that :code:`=` is the default
+							starting character assumed when the value is a float. When
+							:code:`None`, no detection will happen. Defaults to :code:`None`.
+		algo:               The root finding algorithm function. See :class:`CrossingDetection`
+							for more info.
+		**kwargs:           Optional parameters for the zero-crossing detection algorithm.
 	"""
 	def __init__(self, name, cbd, initials=None, stopped=False, crossings=None, algo=CrossingDetection.ITP, **kwargs):
 		AtomicDEVS.__init__(self, name)
@@ -384,14 +389,18 @@ class CBDRunner(AtomicDEVS):
 
 		cds = {}
 		# TODO: can this be computed for all signals at once, instead of signal per signal?
-		for z, y in self.crossings.items():
+		for z, yq in self.crossings.items():
 			value = self.get_signal(z)
+			y = yq
+			q = '='
+			if isinstance(yq, str):
+				y = float(yq[1:])
+				q = yq[0]
 			# print("POST", z, self.state["CBD"].getBlockByName(z).getSignal("OUT1")[-1])
 			if (old[z] - y) * (value - y) < 0:
-				# print(old[z], value, y, z, self.state["time"], self.state["delta_t"])
 				# A crossing will happen!
-				# print("CROSSING:", old[z], value, y)
-				cds.setdefault(self.crossing_detection(z, y, old[z]), []).append(z)
+				if q == '=' or (q == '<' and old[z] < value) or (q == '>' and old[z] > value):
+					cds.setdefault(self.crossing_detection(z, y, old[z]), []).append(z)
 		if len(cds) > 0:
 			fzc = min(cds)
 			self.state["zero_crossing"] = cds[fzc]

+ 69 - 16
src/CBD/converters/latexify.py

@@ -43,6 +43,12 @@ class CBD2Latex:
 								where :code:`operationType` identifies the operation to remap
 								and :code:`callable` a function that takes the name/symbol and
 								the arguments as input and produces a string representation.
+		merge_sums (bool):      Whether or not multiple additions of the same sub-equation should
+								be merged into a product. Defaults to :code:`True`.
+		merge_prods (bool):     Whether or not multiple products of the same sub-equation should
+								be merged into a power. Defaults to :code:`True`.
+		merge_negs (bool):      Whether or not all negations in a product should be merged into a
+								single negation. Defaults to :code:`True`.
 	"""
 	def __init__(self, model, **kwargs):
 		self.model = model
@@ -55,7 +61,12 @@ class CBD2Latex:
 			"time_format": "({time})",
 			"delta_t": "",
 			"replace_par": True,
-			"type_formats": {}
+			"type_formats": {},
+
+			# Fnc settings
+			"merge_sums": True,
+			"merge_prods": True,
+			"merge_negs": True
 		}
 
 		for k in kwargs:
@@ -98,7 +109,7 @@ class CBD2Latex:
 				if func in ["OutputPortBlock", "InputPortBlock", "WireBlock"]:
 					continue
 			if isinstance(func, str):
-				func = lambda b, p, f=func: (p("OUT1"), Fnc(f, [p("%s") % x for x in block.getInputPortNames()]))
+				func = lambda b, p, f=func: (p("OUT1"), Fnc(f, [self._rename(p("%s") % x) for x in block.getInputPortNames()]))
 			res = func(block, lambda x: self._rename(block.getPath() + "." + x))
 			if isinstance(res, tuple):
 				f = res[1]
@@ -218,7 +229,7 @@ class CBD2Latex:
 					while old != eqs[k]:
 						old = eqs[k]
 						if isinstance(eqs[k], Fnc):
-							eqs[k] = eqs[k].simplify()
+							eqs[k] = eqs[k].simplify(self.config["merge_sums"], self.config["merge_prods"], self.config["merge_negs"])
 					created["%s%s" % (k, self.config["time_format"].format(time=i))] = eqs[k]
 		return created
 
@@ -276,7 +287,7 @@ class CBD2Latex:
 					to_delete.remove(dep)
 		for k, f in self.equations.items():
 			if isinstance(f, Fnc):
-				self.equations[k] = f.simplify()
+				self.equations[k] = f.simplify(self.config["merge_sums"], self.config["merge_prods"], self.config["merge_negs"])
 		for td in to_delete:
 			del self.equations[td]
 
@@ -430,11 +441,24 @@ class Fnc:
 					self.args[i] = a.apply_delay(time)
 			return self
 
-	def simplify(self):
+	def simplify(self, merge_sums, merge_prods, merge_negs):
 		"""
 		Simplifies the function w.r.t. its meaning.
-		"""
-		nargs = self.args
+
+		Args:
+			merge_sums (bool):  Whether or not multiple additions of the same
+								sub-equation should be merged into a product.
+			merge_prods (bool): Whether or not multiple products of the same
+								sub-equation should be merged into a power.
+			merge_negs (bool):  Whether or not all negations in a product should
+								be merged into a single negation.
+		"""
+		nargs = []
+		for a in self.args:
+			if isinstance(a, Fnc):
+				nargs.append(a.simplify(merge_sums, merge_prods, merge_negs))
+			else:
+				nargs.append(a)
 		name = self.name
 		if name == '+':
 			val = 0
@@ -453,7 +477,11 @@ class Fnc:
 				if c == 1:
 					nargs.append(a)
 				else:
-					nargs.append(Fnc("*", [a, c], self.fmt))
+					if merge_sums:
+						nargs.append(Fnc("*", [a, c], self.fmt))
+					else:
+						for i in range(c):
+							nargs.append(a)
 			if len(nargs) == 1:
 				return nargs[0]
 			if len(nargs) == 0:
@@ -462,20 +490,36 @@ class Fnc:
 			val = 1
 			occ = {}
 			nargs = []
+			negs = 0
 			for a in self.args:
+				if merge_negs and isinstance(a, Fnc) and a.name == '-':
+					negs += 1
+					a = a.args[0]
 				if isinstance(a, (int, float)):
-					val *= a
+					val *= abs(a)
+					if a < 0:
+						negs += 1
 				elif a in occ:
 					occ[a] += 1
 				else:
 					occ[a] = 1
+			if val == 0:
+				return 0
+			if len(nargs) > 1 and merge_negs and negs % 2 == 1:
+				val *= -1
 			if val != 1:
 				nargs.append(val)
 			for a, c in occ.items():
 				if c == 1:
 					nargs.append(a)
 				else:
-					nargs.append(Fnc("^", [a, c], self.fmt))
+					if merge_prods:
+						nargs.append(Fnc("^", [a, c], self.fmt))
+					else:
+						for i in range(c):
+							nargs.append(a)
+			if merge_negs and negs % 2 == 1:
+				return Fnc("-", [Fnc(name, nargs, self.fmt)], self.fmt)
 			if len(nargs) == 1:
 				return nargs[0]
 		elif name == '^':
@@ -491,6 +535,9 @@ class Fnc:
 		elif name == '-':
 			if self.is_numeric():
 				return -self.args[0]
+			ar = self.args[0]
+			if isinstance(ar, Fnc) and ar.name == '-':
+				return ar.args[0]
 		elif name == '%':
 			if self.args[1] == 1:
 				return self.args[0]
@@ -561,6 +608,9 @@ class Fnc:
 			if self.args[0] == self.args[1]:
 				return self.args[0]
 
+		# for a in range(len(nargs)):
+		# 	if isinstance(nargs[a], Fnc):
+		# 		nargs[a] = nargs[a].simplify(merge_sums, merge_prods, merge_negs)
 		return Fnc(name, nargs, self.fmt)
 
 	def is_numeric(self):
@@ -764,17 +814,18 @@ if __name__ == '__main__':
 	from CBD.Core import CBD
 	from CBD.lib.std import *
 	class Test(CBD):
-		def __init__(self):
-			super().__init__("Test", [], ["x", "y"])
+		def __init__(self, name):
+			super().__init__(name, [], ["x"])
 			self.addBlock(AdderBlock("A"))
 			self.addBlock(ProductBlock("B"))
 			self.addBlock(ConstantBlock("C", 3.0))
+			self.addBlock(ConstantBlock("D", -4.0))
+			self.addBlock(ConstantBlock("E", -8.0))
 			self.addConnection("C", "A")
+			self.addConnection("D", "A")
 			self.addConnection("A", "B")
-			self.addConnection("A", "B")
-			self.addConnection("B", "A")
-			self.addConnection("B", "y")
-			self.addConnection("A", "x")
+			self.addConnection("E", "B")
+			self.addConnection("B", "x")
 
 	class FibonacciGen(CBD):
 		def __init__(self, block_name):
@@ -787,6 +838,7 @@ if __name__ == '__main__':
 			self.addBlock(AdderBlock("sum"))
 			self.addBlock(ConstantBlock("zero", value=(0)))
 			self.addBlock(ConstantBlock("one", value=(1)))
+			self.addBlock(ConstantBlock("dt", value=(0.1)))
 
 			# Create the Connections
 			self.addConnection("delay1", "delay2", output_port_name='OUT1', input_port_name='IN1')
@@ -794,6 +846,7 @@ if __name__ == '__main__':
 			self.addConnection("delay1", "sum", output_port_name='OUT1', input_port_name='IN1')
 			self.addConnection("delay2", "sum", output_port_name='OUT1', input_port_name='IN2')
 			self.addConnection("delay3", "delay1", output_port_name='OUT1', input_port_name='IN1')
+			self.addConnection("dt", "delay3", output_port_name='OUT1', input_port_name='delta_t')
 			self.addConnection("sum", "delay3", output_port_name='OUT1', input_port_name='IN1')
 			self.addConnection("zero", "delay1", output_port_name='OUT1', input_port_name='IC')
 			self.addConnection("one", "delay2", output_port_name='OUT1', input_port_name='IC')