diff options
author | Sunil Shetye | 2025-05-09 21:49:08 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-05-10 01:56:50 +0530 |
commit | 5fbfdea75fddc95c40dfcdc23c0677ae141b9c0b (patch) | |
tree | 4734bb567c015ee85ae46707b8b67d5bb343a70f | |
parent | fa8c71654fe91f36702768d74b9a1e0ad0557588 (diff) | |
download | Common-Interface-Project-5fbfdea75fddc95c40dfcdc23c0677ae141b9c0b.tar.gz Common-Interface-Project-5fbfdea75fddc95c40dfcdc23c0677ae141b9c0b.tar.bz2 Common-Interface-Project-5fbfdea75fddc95c40dfcdc23c0677ae141b9c0b.zip |
use format(17) or %.17g for real numbers
cleanup
-rw-r--r-- | blocks/Xcos/common/AAAAAA.py | 12 | ||||
-rw-r--r-- | blocks/ajax-scilab/cont_frm_write.sci | 4 | ||||
-rw-r--r-- | blocks/ajax-scilab/get_colormap_values.sci | 4 | ||||
-rw-r--r-- | blocks/ajax-scilab/randfunc.sci | 4 | ||||
-rw-r--r-- | blocks/ajax-scilab/scifunc-cleandata-do_spline.sci | 12 |
5 files changed, 15 insertions, 21 deletions
diff --git a/blocks/Xcos/common/AAAAAA.py b/blocks/Xcos/common/AAAAAA.py index 6615f279..f315ddf1 100644 --- a/blocks/Xcos/common/AAAAAA.py +++ b/blocks/Xcos/common/AAAAAA.py @@ -94,7 +94,6 @@ SCILAB_CURVE_C_SCI = "macros/Sources/CURVE_c.sci" SCILAB_EXPRESSION_SCI = "macros/Misc/EXPRESSION.sci" CONT_FRM_WRITE = "ajax-scilab/cont_frm_write.sci" -# DISC_FRM_WRITE = "ajax-scilab/disc_frm_write.sci" CLEANDATA_SCI_FUNC_WRITE = "ajax-scilab/scifunc-cleandata-do_spline.sci" EXP_SCI_FUNC_WRITE = "ajax-scilab/expression-sci-function.sci" GET_COLORMAP_VALUES_SCI_FUNC_WRITE = "ajax-scilab/get_colormap_values.sci" @@ -106,11 +105,6 @@ INTERNAL = { 'function': 'calculate_cont_frm', 'parameters': ['num', 'den'], }, - # 'getDiscOutput': { - # 'scriptfiles': [DISC_FRM_WRITE], - # 'function': 'calculate_disc_frm', - # 'parameters': ['num', 'den'], - # }, 'getExpressionOutput': { 'scriptfiles': [SCILAB_EXPRESSION_SCI, EXP_SCI_FUNC_WRITE], 'function': 'callFunctionAcctoMethod', @@ -175,6 +169,9 @@ def load_scripts(): cmd += f"{p}=poly(0,'{p}');" p = 'z' cmd += f"{p}=poly(0,'{p}');" + + cmd += 'format(17);' + return cmd @@ -1928,6 +1925,3 @@ def internal_fun(internal_key, **kwargs): def cont_frm(num, den): return internal_fun('getOutput', num=num, den=den) - -# def disc_frm(num, den): -# return internal_fun('getDiscOutput', num=num, den=den) diff --git a/blocks/ajax-scilab/cont_frm_write.sci b/blocks/ajax-scilab/cont_frm_write.sci index 7ee20b0c..7bb1829a 100644 --- a/blocks/ajax-scilab/cont_frm_write.sci +++ b/blocks/ajax-scilab/cont_frm_write.sci @@ -17,9 +17,9 @@ function cont_frm_write(varargin) for y = 1:n for z = 1:m if (k == loop-1) & (y == n) & (z == m) then - mfprintf(f_temp, '%f', variable(z, y)) + mfprintf(f_temp, '%.17g', variable(z, y)) else - mfprintf(f_temp, '%f,', variable(z, y)) + mfprintf(f_temp, '%.17g,', variable(z, y)) end end end diff --git a/blocks/ajax-scilab/get_colormap_values.sci b/blocks/ajax-scilab/get_colormap_values.sci index ff18e8e6..48816522 100644 --- a/blocks/ajax-scilab/get_colormap_values.sci +++ b/blocks/ajax-scilab/get_colormap_values.sci @@ -11,9 +11,9 @@ function getvaluesfromcolormap(filename,colormapstring) mfprintf(f_temp, '['); for i = 1:arry_length if i == arry_length then - mfprintf(f_temp, '%g', cmp_array(i)); //print values of array + mfprintf(f_temp, '%.17g', cmp_array(i)); //print values of array else - mfprintf(f_temp, '%g,', cmp_array(i)); // print values of array + mfprintf(f_temp, '%.17g,', cmp_array(i)); // print values of array end end mfprintf(f_temp, ']'); diff --git a/blocks/ajax-scilab/randfunc.sci b/blocks/ajax-scilab/randfunc.sci index 4c73581a..cdb5eb24 100644 --- a/blocks/ajax-scilab/randfunc.sci +++ b/blocks/ajax-scilab/randfunc.sci @@ -10,9 +10,9 @@ function randfunc(filename,inputvalue) for y = 1:m // no. of rows in variables for z = 1:n //no. of columns in variabes if z == n then - mfprintf(f_temp, '%g', cmd_values(y,z)); //Print the variable values + mfprintf(f_temp, '%.17g', cmd_values(y,z)); //Print the variable values else - mfprintf(f_temp, '%g,', cmd_values(y,z)); //Print the variable values + mfprintf(f_temp, '%.17g,', cmd_values(y,z)); //Print the variable values end end if y ~= m then diff --git a/blocks/ajax-scilab/scifunc-cleandata-do_spline.sci b/blocks/ajax-scilab/scifunc-cleandata-do_spline.sci index cfc2894e..9e42587d 100644 --- a/blocks/ajax-scilab/scifunc-cleandata-do_spline.sci +++ b/blocks/ajax-scilab/scifunc-cleandata-do_spline.sci @@ -18,9 +18,9 @@ function callFunctioncleandata(filename,xye) for y = 1:m // no. of rows in variables for z = 1:n //no. of columns in variabes if z == n then - mfprintf(f_temp, '%g', xy(y,z)); //Print the variable values + mfprintf(f_temp, '%.17g', xy(y,z)); //Print the variable values else - mfprintf(f_temp, '%g,', xy(y,z)); //Print the variable values + mfprintf(f_temp, '%.17g,', xy(y,z)); //Print the variable values end end if y ~= m then @@ -65,18 +65,18 @@ function Do_Spline_write(Xdummy,Ydummy,orpar,f_temp) mfprintf(f_temp, '""Xdummy"":['); for i = 1:length(Xdummy) if (i == length(Xdummy)) then - mfprintf(f_temp, '%f', Xdummy(i)); + mfprintf(f_temp, '%.17g', Xdummy(i)); else - mfprintf(f_temp, '%f,', Xdummy(i)); + mfprintf(f_temp, '%.17g,', Xdummy(i)); end end mfprintf(f_temp, ']'); mfprintf(f_temp, ',""Ydummy"":['); for i = 1:length(Ydummy) if (i == length(Ydummy)) then - mfprintf(f_temp, '%f', Ydummy(i)); + mfprintf(f_temp, '%.17g', Ydummy(i)); else - mfprintf(f_temp, '%f,', Ydummy(i)); + mfprintf(f_temp, '%.17g,', Ydummy(i)); end end mfprintf(f_temp, ']'); |