add currentConsumed
This commit is contained in:
parent
69a08d0c3b
commit
ef988d40e4
|
@ -9,7 +9,7 @@ TODO
|
|||
int vis_textsize=12; //copy from Visualization class
|
||||
|
||||
//String logfile_name="LOG00008_rumfahren_neu.TXT";
|
||||
String logfile_name="20210528_Radweg/LOG00197.TXT";
|
||||
String logfile_name="20210528_Radweg/LOG00200REC_0002.TXT";
|
||||
int columnCount=20;
|
||||
|
||||
boolean useSerial=false; //false=read from csv log, true=read from serial port
|
||||
|
@ -19,6 +19,12 @@ Serial serial;
|
|||
String serialString=""; //last read string
|
||||
int serial_endchar=10; //10=ASCII Linefeed
|
||||
|
||||
float minCurrentDisplayed=-5;
|
||||
float maxCurrentDisplayed=20;
|
||||
|
||||
float minRPMDisplayed=-100;
|
||||
float maxRPMDisplayed=1000;
|
||||
|
||||
//timeline
|
||||
float logdata_start_time=0;
|
||||
float logdata_end_time=0;
|
||||
|
@ -95,6 +101,7 @@ int throttle;
|
|||
int brake;
|
||||
float speed;
|
||||
float trip;
|
||||
float currentConsumed;
|
||||
|
||||
color bg=color(0);
|
||||
|
||||
|
@ -170,15 +177,15 @@ void setup() {
|
|||
|
||||
// Speed
|
||||
color c_speed=color(50,50,255);
|
||||
vis_rpm_FrontL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||
vis_rpm_FrontL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,minRPMDisplayed,maxRPMDisplayed);
|
||||
|
||||
vis_rpm_FrontR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||
vis_rpm_FrontR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)pos_vis_cmd.y+vis_textsize,(int)size_vis_cmd.x,(int)size_vis_cmd.y,minRPMDisplayed,maxRPMDisplayed);
|
||||
vis_rpm_FrontR.setTitle("speed");
|
||||
|
||||
vis_rpm_RearL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||
vis_rpm_RearL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,minRPMDisplayed,maxRPMDisplayed);
|
||||
vis_rpm_RearL.setValueUnit("rpm");
|
||||
|
||||
vis_rpm_RearR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-100,600);
|
||||
vis_rpm_RearR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2),(int)(pos_vis_cmd.y+vis_textsize+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,minRPMDisplayed,maxRPMDisplayed);
|
||||
|
||||
vis_rpm_FrontL.setcmain(c_speed);
|
||||
vis_rpm_FrontR.setcmain(c_speed);
|
||||
|
@ -187,15 +194,15 @@ void setup() {
|
|||
|
||||
// Current
|
||||
color c_current=color(255,200,50);
|
||||
vis_current_FrontL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2*2),(int)pos_vis_cmd.y+vis_textsize*2,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-1,10);
|
||||
vis_current_FrontL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2*2),(int)pos_vis_cmd.y+vis_textsize*2,(int)size_vis_cmd.x,(int)size_vis_cmd.y,minCurrentDisplayed,maxCurrentDisplayed);
|
||||
|
||||
vis_current_FrontR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2*2),(int)pos_vis_cmd.y+vis_textsize*2,(int)size_vis_cmd.x,(int)size_vis_cmd.y,-1,10);
|
||||
vis_current_FrontR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2*2),(int)pos_vis_cmd.y+vis_textsize*2,(int)size_vis_cmd.x,(int)size_vis_cmd.y,minCurrentDisplayed,maxCurrentDisplayed);
|
||||
vis_current_FrontR.setTitle("current");
|
||||
|
||||
vis_current_RearL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2*2),(int)(pos_vis_cmd.y+vis_textsize*2+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-1,10);
|
||||
vis_current_RearL = new BarV_cmd((int)(pos_vis_cmd.x-size_vis_cmd.x*2*2),(int)(pos_vis_cmd.y+vis_textsize*2+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,minCurrentDisplayed,maxCurrentDisplayed);
|
||||
vis_current_RearL.setValueUnit("A");
|
||||
|
||||
vis_current_RearR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2*2),(int)(pos_vis_cmd.y+vis_textsize*2+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,-1,10);
|
||||
vis_current_RearR = new BarV_cmd((int)(pos_vis_cmd.x+dist_vis_cmd.x+size_vis_cmd.x*2*2),(int)(pos_vis_cmd.y+vis_textsize*2+dist_vis_cmd.y),(int)size_vis_cmd.x,(int)size_vis_cmd.y,minCurrentDisplayed,maxCurrentDisplayed);
|
||||
|
||||
vis_current_FrontL.setcmain(c_current);
|
||||
vis_current_FrontR.setcmain(c_current);
|
||||
|
@ -222,14 +229,14 @@ void setup() {
|
|||
vis_c_speed.setShowMinMax(true);
|
||||
|
||||
//RPM Man
|
||||
vis_c_rpm_mean = new Tacho(width/2-400,height-150,75,-100,1000);
|
||||
vis_c_rpm_mean = new Tacho(width/2-400,height-150,75,minRPMDisplayed,maxRPMDisplayed);
|
||||
vis_c_rpm_mean.setTitle("RPM");
|
||||
vis_c_rpm_mean.setValueUnit("rpm");
|
||||
vis_c_rpm_mean.setShowMinMax(true);
|
||||
|
||||
//Current
|
||||
color c_currentall=color(240,255,50);
|
||||
vis_currentAll = new Tacho(width/2+150,height-150,100,-1,10);
|
||||
vis_currentAll = new Tacho(width/2+150,height-150,100,minCurrentDisplayed,maxCurrentDisplayed);
|
||||
vis_currentAll.setTitle("currentAll");
|
||||
vis_currentAll.setValueUnit("A");
|
||||
vis_currentAll.setcmain(c_currentall); //currentAll color
|
||||
|
@ -242,12 +249,12 @@ void setup() {
|
|||
PVector size_vis_graph1= new PVector(400,200);
|
||||
PVector pos_vis_graph1= new PVector(width-size_vis_graph1.x-60,250);
|
||||
|
||||
vis_graph_speed_mean = new GraphRoll_minimal(int(pos_vis_graph1.x), int(pos_vis_graph1.y), int(size_vis_graph1.x),int(size_vis_graph1.y),-100,600,1);
|
||||
vis_graph_speed_mean = new GraphRoll_minimal(int(pos_vis_graph1.x), int(pos_vis_graph1.y), int(size_vis_graph1.x),int(size_vis_graph1.y),minRPMDisplayed,maxRPMDisplayed,1);
|
||||
vis_graph_speed_mean.setcborder(c_speed);
|
||||
vis_graph_speed_mean.setcmain(c_speed);
|
||||
vis_graph_speed_mean.setValueUnit("rpm");
|
||||
|
||||
vis_graph_currentAll = new GraphRoll_minimal(int(pos_vis_graph1.x), int(pos_vis_graph1.y), int(size_vis_graph1.x),int(size_vis_graph1.y),-1,10,1);
|
||||
vis_graph_currentAll = new GraphRoll_minimal(int(pos_vis_graph1.x), int(pos_vis_graph1.y), int(size_vis_graph1.x),int(size_vis_graph1.y),minCurrentDisplayed,maxCurrentDisplayed,1);
|
||||
vis_graph_currentAll.setcborder(c_currentall);
|
||||
vis_graph_currentAll.setcmain(c_currentall);
|
||||
vis_graph_currentAll.setValueUnit("A");
|
||||
|
@ -312,7 +319,10 @@ void draw() {
|
|||
vbat_Rear=parseFloat(list[16]);
|
||||
currentAll=parseFloat(list[17]);
|
||||
throttle=parseInt(list[18]);
|
||||
brake=parseInt(trim(list[19]));
|
||||
brake=parseInt(list[19]);
|
||||
speed=parseFloat(list[20]);
|
||||
trip=parseFloat(list[21]);
|
||||
currentConsumed=parseFloat(trim(list[22]));
|
||||
}else{ //data missing or too much
|
||||
dataErrorCount++;
|
||||
}
|
||||
|
@ -352,6 +362,7 @@ void draw() {
|
|||
brake=row.getInt("brake");
|
||||
speed=row.getFloat("speed");
|
||||
trip=row.getFloat("trip");
|
||||
currentConsumed=row.getFloat("currentConsumed");
|
||||
|
||||
if (loopmillis-nextTimeData>1000 && nextTimeData>lastTimeData) {//too much behind
|
||||
long _timestep=nextTimeData-lastTimeData; //approximated time step
|
||||
|
@ -389,7 +400,8 @@ void draw() {
|
|||
|
||||
textAlign(LEFT);
|
||||
textSize(vis_textsize);
|
||||
text(trip+" m", width/2-10,height-110);
|
||||
text(trip+" m", width/2-10,height-110); //trip
|
||||
text(currentConsumed+" Ah", width/2-10,height-110+vis_textsize); //consumed Current
|
||||
|
||||
int speed_mean=int((rpm_FrontL+rpm_FrontR+rpm_RearL+rpm_RearR)/4.0);
|
||||
vis_c_rpm_mean.setValue(speed_mean); vis_c_rpm_mean.drawVis();
|
||||
|
|
Loading…
Reference in New Issue