Commit 49e06cc1 authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master' of newton:/data1/x0-0-0/pwr

parents 4edbdaf7 977f2ae9
......@@ -35950,7 +35950,7 @@ ABB ACS800 Aggregate
EndObject
Object Template ABB_ACS_PnDevice 2158198784 01-JAN-1970 01:00:00.00
Body RtBody 26-NOV-2010 09:19:26.26
Attr Super.Specification = "ABB ACS800 Profibus slave"
Attr Super.Specification = "ABB ACS800 Profinet device"
Attr Super.DataSheet = "$pwr_lang/dsh/abb_acs800.html"
Attr Super.GSDMLfile = "$pwr_exe/GSDML-V2.0-ABBdrives-RETA02-20070621.xml"
Attr Super.Process = 1
......@@ -134,6 +134,7 @@ void RunTimeCounterFo_exec( plc_sThread *tp,
o->OldReset = *o->ResetP;
}
/*_*
CompModePID_Fo
......@@ -567,6 +568,7 @@ void CompOnOffZoneFo_exec( plc_sThread *tp,
co->CycleCount = 0;
}
//---- modified v0.3-----------------------------------------------START--------
/*_*
PLC interface & calculus to discrete time Internal Model Controler component
......@@ -574,13 +576,17 @@ void CompOnOffZoneFo_exec( plc_sThread *tp,
@aref compimc
@aref compimc_fo CompImc_Fo
2015 - 12 - 19 Bruno: initial object.
2016 - 04 - 11 Bruno: cleaning.
2015 - 12 - 19 Bruno: initial object. v0.1
2016 - 04 - 11 Bruno: cleaning. v0.2
2017 - 04 - 14 Bruno: remove "division by zero" potential bugs v0.3
*/
#define Clamp(x, min, max) x = ((x)<(min)) ? (min) : (((x)>(max)) ? (max) : (x))
#define Normalize(x, y, xmin, xmax, ymin, ymax) y = (((((ymax)-(ymin))/((xmax)-(xmin)))*((x)-(xmin)))+(ymin))
#define Te tp->ActualScanTime
#define MAXCELLS 100
#define Clamp(x, min, max) x = ((x)<(min)) ? (min) : (((x)>(max)) ? (max) : (x))
//#define Normalize(x, y, xmin, xmax, ymin, ymax) y = (((((ymax)-(ymin))/((xmax)-(xmin)))*((x)-(xmin)))+(ymin)) // replaced by a function in v0.3
void CompIMC_Fo_init( pwr_sClass_CompIMC_Fo *plc_obj)
{
......@@ -590,7 +596,7 @@ void CompIMC_Fo_init( pwr_sClass_CompIMC_Fo *plc_obj)
if ( EVEN(sts))
plc_obj->PlcConnectP = 0;
}
void CompIMC_Fo_exec( plc_sThread *tp,
pwr_sClass_CompIMC_Fo *plc_obj)
......@@ -598,6 +604,11 @@ void CompIMC_Fo_exec( plc_sThread *tp,
pwr_sClass_CompIMC *plant_obj = (pwr_sClass_CompIMC *) plc_obj->PlcConnectP;
if ( !plant_obj) return;
pwr_tFloat32 man_OP, sig, yr, LSP, PV, nLSP, nPV, Tl1, Tl2;
void Normalize (pwr_tFloat32 x, pwr_tFloat32 *y, pwr_tFloat32 xmin, pwr_tFloat32 xmax, pwr_tFloat32 ymin, pwr_tFloat32 ymax) // v0.3
{
if((xmax-xmin)!=0.0) *y =(ymax-ymin)/(xmax-xmin)*(x-xmin)+ymin; else return;
}
void LagFilter(pwr_tInt16 n, pwr_tFloat32 Tlag)
{
......@@ -614,7 +625,8 @@ void CompIMC_Fo_exec( plc_sThread *tp,
pwr_tFloat32 kd = T2/Te;
pwr_tFloat32 ka = 1.0+kd;
pwr_tFloat32 kb = 1.0-kc;
if (ka<=0) return; // v0.3
Clamp (plant_obj->S[n+1], 0.0, 100.0);
plant_obj->S[n+1] =
kd/ka* plant_obj->S[n+1]
......@@ -630,7 +642,8 @@ void CompIMC_Fo_exec( plc_sThread *tp,
pwr_tFloat32 a1 = 2.0*(ksi*Te*w0P+1.0);
pwr_tFloat32 a2 = -1.0;
pwr_tFloat32 b0 = Te*Te*w0P*w0P;
if (a0<=0) return; // v0.3
Clamp (plant_obj->S[n+1], 0.0, 100.0);
plant_obj->uOutm2 = plant_obj->uOutm1;
plant_obj->uOutm1 = plant_obj->S[n+1];
......@@ -651,6 +664,7 @@ void CompIMC_Fo_exec( plc_sThread *tp,
pwr_tFloat32 a1 = w0*w0*(2.0*Tl1*Tl2+Te*(Tl1+Tl2));
pwr_tFloat32 a2 = -w0*w0*Tl1*Tl2;
if (a0<=0) return; // v0.3
Clamp (plant_obj->S[n+1], 0.0, 100.0);
plant_obj->Outm2 = plant_obj->Outm1;
plant_obj->Outm1 = plant_obj->S[n+1];
......@@ -706,16 +720,16 @@ void CompIMC_Fo_exec( plc_sThread *tp,
LSP=plant_obj->SP+plant_obj->Trim_SP; // Calculate working setpoint
Clamp (LSP, plant_obj->LL_SP, plant_obj->HL_SP); // Apply limits
Normalize(LSP,nLSP, plant_obj->LR_PV, plant_obj->HR_PV,0.0,100.0); // Normalize setpoint value
Normalize(LSP,&nLSP, plant_obj->LR_PV, plant_obj->HR_PV,0.0,100.0); // Normalize setpoint value // v0.3
PV = plant_obj->PV; // Copy from GUI
Normalize(PV,nPV, plant_obj->LR_PV, plant_obj->HR_PV,0.0,100.0); // Normalize process value
Normalize(PV,&nPV, plant_obj->LR_PV, plant_obj->HR_PV,0.0,100.0); // Normalize process value // v0.3
sig = (plant_obj->Inverse) ? nLSP - nPV : nPV - nLSP; // Error signal after direct/inverse Comparator
plant_obj->EP=-sig; // Calculate error value to display
if(!plant_obj->aut){ // Manage manual mode & reset all buffers
sig=0;
Normalize(*plc_obj->Man_OPP, man_OP, plant_obj->LR_OP, plant_obj->HR_OP, 0.0, 100.0);
Normalize(*plc_obj->Man_OPP, &man_OP, plant_obj->LR_OP, plant_obj->HR_OP, 0.0, 100.0); // v0.3
for (i=0; i<12; i++) plant_obj->S[i]=man_OP;
for (i=0; i<100; i++) plant_obj->D[i]=man_OP;
......@@ -729,7 +743,9 @@ void CompIMC_Fo_exec( plc_sThread *tp,
}
else{ // Calculate IMC controller
sig /= plant_obj->Gain; // Apply static gain
if (Te<=0) return; // v0.3
if (plant_obj->Accel<1.0) return; // v0.3
if (plant_obj->Gain>0.0) sig /= plant_obj->Gain; else return; // Apply static gain // v0.3
plant_obj->S[0] = sig+plant_obj->S[11]; // Add previous model's feedback
......@@ -757,7 +773,7 @@ void CompIMC_Fo_exec( plc_sThread *tp,
OP=plant_obj->S[6];
Clamp (OP, 0.0, 100.0); // Apply limits on model output
Normalize(OP,yr,0.0,100.0,plant_obj->LR_OP, plant_obj->HR_OP); // Denormalize output
Normalize(OP,&yr,0.0,100.0,plant_obj->LR_OP, plant_obj->HR_OP); // Denormalize output // v0.3
yr+=plant_obj->FF; // Add feedforward input value
Clamp (yr, plant_obj->LL_OP, plant_obj->HL_OP); // Apply limits to control signal
plc_obj->OP=plant_obj->OP = yr; // copy to GUI objects
......@@ -778,11 +794,13 @@ void CompIMC_Fo_exec( plc_sThread *tp,
Delay(10, plant_obj->DelayT);
// ----
}
}
//---- modified v0.3-----------------------------------------------END----
/*_*
PLC Mode interface to a discrete time Internal Model Controler component
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -29,22 +29,22 @@
100 20
135 20
101 20
102 1
103 -21
104 2.73277
136 2.73277
102 58
103 78
104 2.75
136 2.75
105 100
106 0
107 -2
106 2
107 1
108 57
109 1
110 36.5428
111 0.499952
116 0
117 0
118 169
119 112
120 1
116 5
117 9
118 105
119 93
120 0
121 Claes context
122 0
126 0.5
......@@ -4465,7 +4465,7 @@ pwr_exe:
3000 0.63148
3001 0.23148
3002 0.696505
3003 0.146505
3003 0.246505
3008 0
3010 4
3011 2
......@@ -7622,6 +7622,10 @@ pwr_exe:
2305 $object.PV_MaxShow##Float32
2306 $local.TrendHold##Boolean
2307 $object.TrendTimeRange##Float32
2308
2309
2310 9999
2311 9999
99
99
99
......@@ -8152,6 +8156,10 @@ pwr_exe:
2305
2306 $local.TrendHold##Boolean
2307 $object.TrendTimeRange##Float32
2308
2309
2310 9999
2311 9999
99
99
99
......@@ -9025,6 +9033,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -9175,6 +9184,7 @@ pwr_exe:
1308
1309 0
1310 0
1311 0
99
99
99
......@@ -9325,6 +9335,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -10248,6 +10259,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -10312,11 +10324,11 @@ pwr_exe:
0
1006 12.6859
1007 7.35936
1008 13.1805
1008 13.1806
1009 12.0966
1013 12.6859
1014 7.35936
1015 13.1805
1015 13.1806
1016 12.0966
1003
0
......@@ -10380,7 +10392,7 @@ pwr_exe:
102 22
103 0
12
1200 $object.Gain##Float32
1200 $object.Accel##Float32
1201 %10.3f
1202 1
1203 1
......@@ -10398,6 +10410,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -10721,6 +10734,7 @@ pwr_exe:
1308
1309 0
1310 0
1311 0
99
99
99
......@@ -11084,6 +11098,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -11481,6 +11496,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -11844,6 +11860,7 @@ pwr_exe:
1308
1309 0
1310 0
1311 0
99
99
99
......@@ -12241,6 +12258,7 @@ pwr_exe:
1308
1309 0
1310 0
1311 0
99
99
99
......@@ -12638,6 +12656,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -13029,6 +13048,7 @@ pwr_exe:
1308
1309 0
1310 0
1311 0
99
99
99
......@@ -13426,6 +13446,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -14461,6 +14482,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -14611,6 +14633,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -14761,6 +14784,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......@@ -14911,6 +14935,7 @@ pwr_exe:
1308
1309 0
1310 2
1311 0
99
99
99
......
This diff is collapsed.
......@@ -326,6 +326,7 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Qcom_putString
data = (*env)->GetStringUTFChars( env, jdata, 0);
cstr = (char *)data;
put.data = (char *)data;
put.allocate = 1;
put.size = strlen(data) + 1;
put.type.b = qcom_eBtype__;
put.type.s = qcom_eStype__;
......
......@@ -4,7 +4,8 @@ link_rule_mk := 1
link = $(ldxx) -L$(pwr_elib) $(elinkflags) $(domap) -o $(pwr_exe)/profinet_viewer_gtk \
$(bld_dir)/profinet_viewer_gtk.o \
$(bld_dir)/pn_viewer_gtk.o $(bld_dir)/pn_viewernav_gtk.o \
$(bld_dir)/pn_viewer.o $(bld_dir)/pn_viewernav.o $(bld_dir)/pn_viewer_pnac.o\
$(bld_dir)/pn_viewer.o $(bld_dir)/pn_viewernav.o \
$(bld_dir)/pn_viewer_pnac.o\
$(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o \
$(pwre_conf_libdir) $(pwre_conf_libpwrxttgtk) $(pwre_conf_libpwrxtt) $(pwre_conf_libgtk) \
......
......@@ -63,6 +63,7 @@ class PnViewerGtk : public PnViewer {
GtkWidget *toplevel;
GtkWidget *form;
GtkWidget *nav_widget;
GtkWidget *navconf_widget;
GtkWidget *msg_label;
GtkWidget *cmd_prompt;
GtkWidget *cmd_input;
......@@ -79,6 +80,7 @@ class PnViewerGtk : public PnViewer {
static void valchanged_cmd_input( GtkWidget *w, gpointer data);
static void activate_exit( GtkWidget *w, gpointer data);
static void activate_update( GtkWidget *w, gpointer data);
static void activate_filter( GtkWidget *w, gpointer data);
static void activate_setdevice( GtkWidget *w, gpointer data);
static void activate_changevalue( GtkWidget *w, gpointer data);
static void activate_zoom_in( GtkWidget *w, gpointer data);
......
......@@ -58,8 +58,9 @@ extern "C" {
PnViewerNavGtk::PnViewerNavGtk (
void *l_parent_ctx,
GtkWidget *l_parent_wid,
viewer_eType l_type,
GtkWidget **w) :
PnViewerNav( l_parent_ctx), parent_wid(l_parent_wid)
PnViewerNav( l_parent_ctx, l_type), parent_wid(l_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new(
PnViewerNav::init_brow_cb, this, &brow_widget);
......
......@@ -46,8 +46,9 @@
class PnViewerNavGtk : public PnViewerNav {
public:
PnViewerNavGtk(
void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
void *v_parent_ctx,
GtkWidget *v_parent_wid,
viewer_eType v_type,
GtkWidget **w);
~PnViewerNavGtk();
......
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.
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.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -55,3 +55,4 @@ subterminated <Subwindow is terminated> /info
name_long <Name is too long> /error
name_invchar <Invalid character for name> /error
name_alrexist <Name already exist> /error
swapterminated <Ctx is swapped> /info
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.
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.
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.
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.
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.
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.
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.
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