Commit 0ec860ce authored by Claes Sjofors's avatar Claes Sjofors

Ge trend dynamics, Trend.TimeRangeAttr added for trend objects with dynamic time range

parent 87396e29
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -355,6 +355,7 @@ public class Dyn { ...@@ -355,6 +355,7 @@ public class Dyn {
public static final int eSave_Trend_minvalue_attr2 = 2304; public static final int eSave_Trend_minvalue_attr2 = 2304;
public static final int eSave_Trend_maxvalue_attr2 = 2305; public static final int eSave_Trend_maxvalue_attr2 = 2305;
public static final int eSave_Trend_hold_attr = 2306; public static final int eSave_Trend_hold_attr = 2306;
public static final int eSave_Trend_timerange_attr = 2307;
public static final int eSave_DigFlash_attribute = 2600; public static final int eSave_DigFlash_attribute = 2600;
public static final int eSave_DigFlash_color = 2601; public static final int eSave_DigFlash_color = 2601;
public static final int eSave_DigFlash_color2 = 2602; public static final int eSave_DigFlash_color2 = 2602;
...@@ -5854,6 +5855,7 @@ public class Dyn { ...@@ -5854,6 +5855,7 @@ public class Dyn {
String minvalue_attr2; String minvalue_attr2;
String maxvalue_attr2; String maxvalue_attr2;
String hold_attr; String hold_attr;
String timerange_attr;
int p1 = -1; int p1 = -1;
int database1; int database1;
boolean inverted1; boolean inverted1;
...@@ -5880,10 +5882,18 @@ public class Dyn { ...@@ -5880,10 +5882,18 @@ public class Dyn {
float old_min_value2; float old_min_value2;
double scan_time; double scan_time;
double acc_time; double acc_time;
int no_of_points;
int trend_hold; int trend_hold;
int hold_p; int hold_p;
int hold_database; int hold_database;
PwrtRefId hold_subid; PwrtRefId hold_subid;
int timerange_p;
int timerange_database;
PwrtRefId timerange_subid;
float old_timerange;
double orig_graph_scan_time;
double orig_graph_fast_scan_time;
double orig_graph_animation_scan_time;
public DynTrend( Dyn dyn) { public DynTrend( Dyn dyn) {
super(dyn, Dyn.mDynType1_Trend, 0, 0, 0, Dyn.eDynPrio_Trend); super(dyn, Dyn.mDynType1_Trend, 0, 0, 0, Dyn.eDynPrio_Trend);
...@@ -5898,6 +5908,7 @@ public class Dyn { ...@@ -5898,6 +5908,7 @@ public class Dyn {
maxvalue_attr1 = x.maxvalue_attr1; maxvalue_attr1 = x.maxvalue_attr1;
maxvalue_attr2 = x.maxvalue_attr2; maxvalue_attr2 = x.maxvalue_attr2;
hold_attr = x.hold_attr; hold_attr = x.hold_attr;
timerange_attr = x.timerange_attr;
} }
public int connect(GlowArrayElem o) { public int connect(GlowArrayElem o) {
...@@ -5956,6 +5967,7 @@ public class Dyn { ...@@ -5956,6 +5967,7 @@ public class Dyn {
} }
} }
no_of_points = object.get_no_of_points();
scan_time = object.get_scan_time(); scan_time = object.get_scan_time();
acc_time = scan_time; acc_time = scan_time;
trend_hold = 0; trend_hold = 0;
...@@ -6032,6 +6044,43 @@ public class Dyn { ...@@ -6032,6 +6044,43 @@ public class Dyn {
} }
} }
timerange_p = 0;
pname = dyn.parseAttrName(timerange_attr);
if ( pname != null && !pname.name.equals("")) {
ret = null;
switch( pname.database) {
case GraphIfc.eDatabase_Gdh:
ret = dyn.graph.getGdh().refObjectInfo( pname.tname);
break;
case GraphIfc.eDatabase_Local:
ret = dyn.graph.getLdb().refObjectInfo( graph, pname.name);
System.out.println("Timerange: " + ret + " pname " + pname.name);
break;
default:
ret = null;
}
if ( ret == null || ret.evenSts()) {
System.out.println("Trend: " + timerange_attr);
return 1;
}
else {
timerange_p = ret.id;
timerange_subid = ret.refid;
timerange_database = pname.database;
if ( pname.database == GraphIfc.eDatabase_Local) {
float timerange = dyn.graph.getLdb().getObjectRefInfoFloat(timerange_p);
if ( timerange == 0)
dyn.graph.getLdb().setObjectInfo( graph, pname.name,
(float)scan_time * no_of_points);
}
orig_graph_scan_time = dyn.graph.getScanTime();
orig_graph_fast_scan_time = dyn.graph.getFastScanTime();
orig_graph_animation_scan_time = dyn.graph.getAnimationScanTime();
}
}
return 1; return 1;
} }
...@@ -6050,6 +6099,8 @@ public class Dyn { ...@@ -6050,6 +6099,8 @@ public class Dyn {
dyn.graph.getGdh().unrefObjectInfo(max_value2_subid); dyn.graph.getGdh().unrefObjectInfo(max_value2_subid);
if ( hold_p != 0 && hold_database == GraphIfc.eDatabase_Gdh) if ( hold_p != 0 && hold_database == GraphIfc.eDatabase_Gdh)
dyn.graph.getGdh().unrefObjectInfo(hold_subid); dyn.graph.getGdh().unrefObjectInfo(hold_subid);
if ( timerange_p != 0 && hold_database == GraphIfc.eDatabase_Gdh)
dyn.graph.getGdh().unrefObjectInfo(timerange_subid);
} }
public void scan( GlowArrayElem o) { public void scan( GlowArrayElem o) {
...@@ -6072,6 +6123,79 @@ public class Dyn { ...@@ -6072,6 +6123,79 @@ public class Dyn {
return; return;
} }
if ( timerange_p != 0) {
float timerangeval = 10;
switch ( timerange_database) {
case GraphIfc.eDatabase_Gdh:
timerangeval = dyn.graph.getGdh().getObjectRefInfoFloat(timerange_p);
break;
case GraphIfc.eDatabase_Local:
timerangeval = dyn.graph.getLdb().getObjectRefInfoFloat(timerange_p);
break;
}
if ( Math.abs(timerangeval - old_timerange) > Float.MIN_VALUE) {
double dt = timerangeval / no_of_points;
System.out.println("Timerange: " + timerangeval + " " + no_of_points + " " + dt);
if ( dt >= 0.001) {
object.set_scan_time( dt);
scan_time = dt;
if ( cycle == Glow.eCycle_Slow) {
double current_graph_scan_time = dyn.graph.getScanTime();
double current_graph_fast_scan_time = dyn.graph.getFastScanTime();
double current_graph_animation_scan_time = dyn.graph.getAnimationScanTime();
if ( current_graph_scan_time > scan_time)
dyn.graph.setScanTime(scan_time);
else {
if ( scan_time > orig_graph_scan_time)
dyn.graph.setScanTime(orig_graph_scan_time);
else
dyn.graph.setScanTime(scan_time);
}
if ( current_graph_fast_scan_time > scan_time)
dyn.graph.setFastScanTime(scan_time);
else {
if ( scan_time > orig_graph_fast_scan_time)
dyn.graph.setFastScanTime(orig_graph_fast_scan_time);
else
dyn.graph.setFastScanTime(scan_time);
}
if ( current_graph_animation_scan_time > scan_time)
dyn.graph.setAnimationScanTime(scan_time);
else {
if ( scan_time > orig_graph_animation_scan_time)
dyn.graph.setAnimationScanTime(orig_graph_animation_scan_time);
else
dyn.graph.setAnimationScanTime(scan_time);
}
}
else {
// Fast cycle
double current_graph_fast_scan_time = dyn.graph.getFastScanTime();
double current_graph_animation_scan_time = dyn.graph.getAnimationScanTime();
if ( current_graph_fast_scan_time > scan_time)
dyn.graph.setFastScanTime(scan_time);
else {
if ( scan_time > orig_graph_fast_scan_time)
dyn.graph.setFastScanTime(orig_graph_fast_scan_time);
else
dyn.graph.setFastScanTime(scan_time);
}
if ( current_graph_animation_scan_time > scan_time)
dyn.graph.setAnimationScanTime(scan_time);
else {
if ( scan_time > orig_graph_animation_scan_time)
dyn.graph.setAnimationScanTime(orig_graph_animation_scan_time);
else
dyn.graph.setAnimationScanTime(scan_time);
}
}
}
old_timerange = timerangeval;
}
}
float minval, maxval; float minval, maxval;
if ( max_value1_p != 0 && min_value1_p != 0) { if ( max_value1_p != 0 && min_value1_p != 0) {
minval = dyn.graph.getGdh().getObjectRefInfoFloat( min_value1_p); minval = dyn.graph.getGdh().getObjectRefInfoFloat( min_value1_p);
...@@ -6087,7 +6211,10 @@ public class Dyn { ...@@ -6087,7 +6211,10 @@ public class Dyn {
if ( firstScan) if ( firstScan)
firstScan = false; firstScan = false;
acc_time += dyn.graph.getScanTime(); if ( cycle == Glow.eCycle_Slow)
acc_time += dyn.graph.getScanTime();
else
acc_time += dyn.graph.getFastScanTime();
if ( acc_time + Double.MIN_VALUE >= scan_time) { if ( acc_time + Double.MIN_VALUE >= scan_time) {
if ( p1 != -1) { if ( p1 != -1) {
switch ( a_typeid1) { switch ( a_typeid1) {
...@@ -6138,8 +6265,8 @@ public class Dyn { ...@@ -6138,8 +6265,8 @@ public class Dyn {
} }
} }
acc_time = 0;
} }
acc_time = 0;
} }
public void open( BufferedReader reader) { public void open( BufferedReader reader) {
...@@ -6184,6 +6311,10 @@ public class Dyn { ...@@ -6184,6 +6311,10 @@ public class Dyn {
if ( token.hasMoreTokens()) if ( token.hasMoreTokens())
hold_attr = token.nextToken(); hold_attr = token.nextToken();
break; break;
case Dyn.eSave_Trend_timerange_attr:
if ( token.hasMoreTokens())
timerange_attr = token.nextToken();
break;
case Dyn.eSave_End: case Dyn.eSave_End:
end_found = true; end_found = true;
break; break;
......
...@@ -568,10 +568,26 @@ public class Graph implements GraphIfc, GrowApplIfc { ...@@ -568,10 +568,26 @@ public class Graph implements GraphIfc, GrowApplIfc {
return appl.isAuthorized(access); return appl.isAuthorized(access);
} }
public void setScanTime( double scan_time) {
this.scan_time = scan_time;
}
public void setFastScanTime( double fast_scan_time) {
this.fast_scan_time = fast_scan_time;
}
public void setAnimationScanTime( double animation_scan_time) {
this.animation_scan_time = animation_scan_time;
}
public double getScanTime() { public double getScanTime() {
return scan_time; return scan_time;
} }
public double getFastScanTime() {
return fast_scan_time;
}
public double getAnimationScanTime() { public double getAnimationScanTime() {
if ( scan_time < animation_scan_time) if ( scan_time < animation_scan_time)
return scan_time; return scan_time;
......
...@@ -63,7 +63,11 @@ public interface GraphIfc { ...@@ -63,7 +63,11 @@ public interface GraphIfc {
public Object getCurrentSlider(); public Object getCurrentSlider();
public void setCurrentSlider(GrowSlider currentSlider); public void setCurrentSlider(GrowSlider currentSlider);
public boolean isAuthorized(int access); public boolean isAuthorized(int access);
public void setScanTime(double scan_time);
public void setFastScanTime(double fast_scan_time);
public void setAnimationScanTime(double animation_scan_time);
public double getScanTime(); public double getScanTime();
public double getFastScanTime();
public double getAnimationScanTime(); public double getAnimationScanTime();
public String getCommand(String cmd); public String getCommand(String cmd);
public void setClickActive(int active); public void setClickActive(int active);
......
...@@ -463,6 +463,11 @@ public class GrowTrend extends GrowRect { ...@@ -463,6 +463,11 @@ public class GrowTrend extends GrowRect {
draw(); draw();
} }
public void set_scan_time( double time) {
scan_time = time;
configure_curves();
}
public double get_scan_time() { public double get_scan_time() {
return scan_time; return scan_time;
} }
......
...@@ -2815,6 +2815,16 @@ MB2 in the working area. ...@@ -2815,6 +2815,16 @@ MB2 in the working area.
<b>Attribute <t><t>Description <b>Attribute <t><t>Description
Trend.Attribute1 <t><t>Signal for curve number 1. Trend.Attribute1 <t><t>Signal for curve number 1.
Trend.Attribute2 <t><t>Signal for curve number 2. Trend.Attribute2 <t><t>Signal for curve number 2.
Trend.MinValueAttr1 <t>Signal for minimum value curve number 1. Is used when the
<t>min value is dynamic. For static value, Trend.MinValue1 is used.
Trend.MaxValueAttr1 <t>Signal for maximum value curve number 1. Is used when the
<t>max value is dynamic. For static value, Trend.MaxValue1 is used.
Trend.MinValueAttr2 <t>Signal for minimum value curve number 2. Is used when the
<t>min value is dynamic. For static value, Trend.MinValue1 is used.
Trend.MaxValueAttr2 <t>Signal for maximum value curve number 2. Is used when the
<t>max value is dynamic. For static value, Trend.MaxValue1 is used.
Trend.HoldAttr <t>Signal to freeze the curve.
Trend.TimeRangeAttr <t>Signal of type Float32 for the time range of the curve.
Trend.NoOfPoints <t><t>Number of points in the curve. Trend.NoOfPoints <t><t>Number of points in the curve.
Trend.ScanTime <t><t>Time interval between two points. Trend.ScanTime <t><t>Time interval between two points.
Trend.CurveLineWidth <t><t>Linewidth for the curve (1-8) Trend.CurveLineWidth <t><t>Linewidth for the curve (1-8)
......
...@@ -2797,6 +2797,16 @@ MB2 i arbetsarean. ...@@ -2797,6 +2797,16 @@ MB2 i arbetsarean.
<b>Attribut <t><t>Beskrivning <b>Attribut <t><t>Beskrivning
Trend.Attribute1 <t><t>Signal för kurva nr 1. Trend.Attribute1 <t><t>Signal för kurva nr 1.
Trend.Attribute2 <t><t>Signal för kurva nr 2. Trend.Attribute2 <t><t>Signal för kurva nr 2.
Trend.MinValueAttr1 <t>Signal för minvärde kurva nr 1. Används när minvärdet
<t>är dynamiskt. För statisk värde används Trend.MinValue1.
Trend.MaxValueAttr1 <t>Signal för maxvärde kurva nr 1. Används när maxvärdet
<t>är dynamiskt. För statisk värde används Trend.MaxValue1.
Trend.MinValueAttr2 <t>Signal för minvärde kurva nr 2. Används när minvärdet
<t>är dynamiskt. För statisk värde används Trend.MinValue2.
Trend.MaxValueAttr2 <t>Signal för maxvärde kurva nr 2. Används när maxvärdet
<t>är dynamiskt. För statisk värde används Trend.MaxValue2.
Trend.HoldAttr <t>Signal för att frysa kurvan.
Trend.TimeRangeAttr <t>Signal av typen Float32 för kurvans tidskala.
Trend.NoOfPoints <t><t>Antal punkter på kurvan Trend.NoOfPoints <t><t>Antal punkter på kurvan
Trend.ScanTime <t><t>Tidsintervall mellan två punkter. Trend.ScanTime <t><t>Tidsintervall mellan två punkter.
Trend.CurveLineWidth <t><t>Linjebredd på kurvan (1-8) Trend.CurveLineWidth <t><t>Linjebredd på kurvan (1-8)
......
...@@ -21,7 +21,7 @@ vpath %.pwgc $(hw_source):$(os_source):$(co_source) ...@@ -21,7 +21,7 @@ vpath %.pwgc $(hw_source):$(os_source):$(co_source)
source_dirs = $(hw_source) $(os_source) $(co_source) source_dirs = $(hw_source) $(os_source) $(co_source)
pwg_sources := $(sort \ pwg_c_sources := $(sort \
$(foreach file, \ $(foreach file, \
$(foreach dir, \ $(foreach dir, \
$(source_dirs), \ $(source_dirs), \
...@@ -30,6 +30,15 @@ pwg_sources := $(sort \ ...@@ -30,6 +30,15 @@ pwg_sources := $(sort \
) \ ) \
) )
pwg_t_sources := $(sort \
$(foreach file, \
$(foreach dir, \
$(source_dirs), \
$(wildcard $(dir)/pwr_t_*.pwg) \
), $(notdir $(file)) \
) \
)
pwsg_sources := $(sort \ pwsg_sources := $(sort \
$(foreach file, \ $(foreach file, \
$(foreach dir, \ $(foreach dir, \
...@@ -57,7 +66,7 @@ html_sources := $(sort \ ...@@ -57,7 +66,7 @@ html_sources := $(sort \
) \ ) \
) )
export_pwg := $(addprefix $(exe_dir)/,$(pwg_sources)) export_pwg := $(addprefix $(exe_dir)/,$(pwg_c_sources)) $(addprefix $(exe_dir)/,$(pwg_t_sources))
export_pwsg := $(addprefix $(exe_dir)/,$(pwsg_sources)) export_pwsg := $(addprefix $(exe_dir)/,$(pwsg_sources))
export_pwgc := $(addprefix $(exe_dir)/,$(pwgc_sources)) export_pwgc := $(addprefix $(exe_dir)/,$(pwgc_sources))
export_html := $(addprefix $(exe_dir)/,$(html_sources)) export_html := $(addprefix $(exe_dir)/,$(html_sources))
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -31,18 +31,18 @@ ...@@ -31,18 +31,18 @@
101 20 101 20
102 10 102 10
103 -30 103 -30
104 3.711 104 3.31865
136 3.711 136 3.31865
105 100 105 100
106 1 106 1
107 -5 107 -4
108 46 108 46
109 1 109 1
110 15.0315 110 15.0315
111 0.5 111 0.5
116 0 116 0
117 0 117 0
118 136 118 192
119 112 119 112
120 0 120 0
121 Claes context 121 Claes context
...@@ -8725,12 +8725,12 @@ pwr_exe: ...@@ -8725,12 +8725,12 @@ pwr_exe:
0 0
0 0
0 0
1006 42.95 1006 42.9501
1007 41.85 1007 41.8476
1008 8.05 1008 8.05
1009 7.05 1009 7.05
1013 42.95 1013 42.9501
1014 41.85 1014 41.8476
1015 8.05 1015 8.05
1016 7.05 1016 7.05
1003 1003
...@@ -8793,7 +8793,7 @@ pwr_exe: ...@@ -8793,7 +8793,7 @@ pwr_exe:
101 2048 101 2048
106 0 106 0
102 6 102 6
103 0 103 2
60 60
6000 $object.ActualValue##Boolean 6000 $object.ActualValue##Boolean
6001 6001
...@@ -9047,7 +9047,7 @@ pwr_exe: ...@@ -9047,7 +9047,7 @@ pwr_exe:
101 0 101 0
106 0 106 0
102 65532 102 65532
103 0 103 2
23 23
2300 $object.ActualValue##Boolean 2300 $object.ActualValue##Boolean
2301 2301
...@@ -9056,6 +9056,7 @@ pwr_exe: ...@@ -9056,6 +9056,7 @@ pwr_exe:
2304 2304
2305 2305
2306 $local.HoldTrend##Boolean 2306 $local.HoldTrend##Boolean
2307 $local.ScanTime##Float32
99 99
99 99
99 99
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment