Fixed Decimal Export

This commit is contained in:
2021-03-25 10:35:58 +01:00
parent c34bb44662
commit cd88b1aadf
12 changed files with 397 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
<?AutomationStudio Version="4.9.2.46" WorkingVersion="4.9"?>
<Project Version="1.00.0" Edition="Standard" EditionComment="Standard" xmlns="http://br-automation.co.at/AS/Project">
<Communication>
<OnlineConfiguration Name="Pana-Dickenmessung" DeviceType="TCPIP" DeviceParameters="/IF=tcpip /LOPO=11159 /SA=1" ConnectionParameters="/COMT=2500 /RT=1000 /AM=* /SDT=5 /DAIP=192.168.30.60 /REPO=11159 /ANSL=1 /PT=11169" Description="" UserName="michi" />
<OnlineConfiguration Name="Pana-Dickenmessung" DeviceType="TCPIP" DeviceParameters="/IF=tcpip /LOPO=11159 /SA=1" ConnectionParameters="/COMT=2500 /RT=1000 /AM=* /SDT=5 /DAIP=192.168.30.60 /REPO=11159 /ANSL=1 /PT=11169" Description="" />
</Communication>
<ANSIC DefaultIncludes="true" />
<IEC ExtendedConstants="true" IecExtendedComments="true" KeywordsAsStructureMembers="false" NamingConventions="true" Pointers="true" Preprocessor="false" />

View File

@@ -0,0 +1,72 @@
{REDUND_OK} FUNCTION brmatan2 : REAL (*calculates the arc tangent of y/x*)
VAR_INPUT
y :REAL; (*y*)
x :REAL; (*x*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmceil : REAL (*calculates the smallest integer value which is greater than or equal to the input value*)
VAR_INPUT
x :REAL; (*input value*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmcosh : REAL (*calculates the hyperbolic cosine of x*)
VAR_INPUT
x :REAL; (*input value*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmfloor : REAL (*calculates the largest integer value which is less than or equal to the input value*)
VAR_INPUT
x :REAL; (*input value*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmfmod : REAL (*calculates the remainder of the division x/y*)
VAR_INPUT
x :REAL; (*numerator*)
y :REAL; (*denominator*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmfrexp : REAL (*calculates the mantissa and the exponent of a floating point number*)
VAR_INPUT
x :REAL; (*input value*)
pExp :UDINT; (*address of the exponent (address of DINT) (base 2)*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmldexp : REAL (*calculates a floating point number from mantissa x and exponent exp*)
VAR_INPUT
x :REAL; (*mantissa*)
exp_val :DINT; (*exponent (base 2)*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmmodf : REAL (*separates a floating point number into an integer and decimal part*)
VAR_INPUT
x :REAL; (*input value*)
plp :UDINT; (*address of the integer part (address of a REAL value)*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmpow : REAL (*calculates x raised to the power of y*)
VAR_INPUT
x :REAL; (*base*)
y :REAL; (*exponent*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmsinh : REAL (*calculates the hyperbolic sine of x*)
VAR_INPUT
x :REAL; (*input value*)
END_VAR
END_FUNCTION
{REDUND_OK} FUNCTION brmtanh : REAL (*calculates the hyperbolic tangent of x*)
VAR_INPUT
x :REAL; (*input value*)
END_VAR
END_FUNCTION

View File

@@ -0,0 +1,4 @@
TYPE
END_TYPE

View File

@@ -0,0 +1,25 @@
VAR CONSTANT
brm2_SQRTPI : REAL := 1.12838; (*2/(square root from PI)*)
brmSQRT1_2 : REAL := 0.707107; (*square root from 1/2*)
brmSQRTPI : REAL := 1.77245; (*square root from PI*)
brmLOG2_E : REAL := 0.693147; (*log with the base 2 from E*)
brmLOG10E : REAL := 0.434294; (*log with the base 10 from E*)
brmIVLN10 : REAL := 0.434294; (*1/(ln from 10)*)
brmINVLN2 : REAL := 1.4427; (*1/(ln from 2)*)
brmTWOPI : REAL := 6.28319; (*2 PI*)
brmSQRT3 : REAL := 1.73205; (*square root from 3*)
brmSQRT2 : REAL := 1.41421; (*square root from 2*)
brmLOG2E : REAL := 1.4427; (*log with the base 2 from E*)
brmLN2LO : REAL := 1.90821e-010; (*log with the base 2 from LOW*)
brmLN2HI : REAL := 0.693147; (*log with the base 2 from HIGH*)
brm3PI_4 : REAL := 2.35619; (*3/4 PI*)
brmPI_4 : REAL := 0.785398; (*PI/4*)
brmPI_2 : REAL := 1.5708; (*PI/2*)
brmLN10 : REAL := 2.30259; (*ln from 10*)
brm2_PI : REAL := 0.63662; (*2/PI*)
brm1_PI : REAL := 0.31831; (*1/PI*)
brmLN2 : REAL := 0.693147; (*ln from 2*)
brmPI : REAL := 3.14159; (*PI*)
brmE : REAL := 2.71828; (*E*)
END_VAR

View File

@@ -0,0 +1,90 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASBRMATH_
#define _ASBRMATH_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define brm2_SQRTPI 1.12838
#define brmSQRT1_2 0.707107
#define brmSQRTPI 1.77245
#define brmLOG2_E 0.693147
#define brmLOG10E 0.434294
#define brmIVLN10 0.434294
#define brmINVLN2 1.4427
#define brmTWOPI 6.28319
#define brmSQRT3 1.73205
#define brmSQRT2 1.41421
#define brmLOG2E 1.4427
#define brmLN2LO 1.90821e-010
#define brmLN2HI 0.693147
#define brm3PI_4 2.35619
#define brmPI_4 0.785398
#define brmPI_2 1.5708
#define brmLN10 2.30259
#define brm2_PI 0.63662
#define brm1_PI 0.31831
#define brmLN2 0.693147
#define brmPI 3.14159
#define brmE 2.71828
#else
_IEC_CONST float brm2_SQRTPI = 1.12838;
_IEC_CONST float brmSQRT1_2 = 0.707107;
_IEC_CONST float brmSQRTPI = 1.77245;
_IEC_CONST float brmLOG2_E = 0.693147;
_IEC_CONST float brmLOG10E = 0.434294;
_IEC_CONST float brmIVLN10 = 0.434294;
_IEC_CONST float brmINVLN2 = 1.4427;
_IEC_CONST float brmTWOPI = 6.28319;
_IEC_CONST float brmSQRT3 = 1.73205;
_IEC_CONST float brmSQRT2 = 1.41421;
_IEC_CONST float brmLOG2E = 1.4427;
_IEC_CONST float brmLN2LO = 1.90821e-010;
_IEC_CONST float brmLN2HI = 0.693147;
_IEC_CONST float brm3PI_4 = 2.35619;
_IEC_CONST float brmPI_4 = 0.785398;
_IEC_CONST float brmPI_2 = 1.5708;
_IEC_CONST float brmLN10 = 2.30259;
_IEC_CONST float brm2_PI = 0.63662;
_IEC_CONST float brm1_PI = 0.31831;
_IEC_CONST float brmLN2 = 0.693147;
_IEC_CONST float brmPI = 3.14159;
_IEC_CONST float brmE = 2.71828;
#endif
/* Prototyping of functions and function blocks */
float brmatan2(float y, float x);
float brmceil(float x);
float brmcosh(float x);
float brmfloor(float x);
float brmfmod(float x, float y);
float brmfrexp(float x, unsigned long pExp);
float brmldexp(float x, signed long exp_val);
float brmmodf(float x, unsigned long plp);
float brmpow(float x, float y);
float brmsinh(float x);
float brmtanh(float x);
#ifdef __cplusplus
};
#endif
#endif /* _ASBRMATH_ */

View File

@@ -0,0 +1,92 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASBRMATH_
#define _ASBRMATH_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#ifndef _BUR_PUBLIC
#define _BUR_PUBLIC
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define brmE 2.71828f
#define brmPI 3.14159f
#define brmLN2 0.693147f
#define brm1_PI 0.31831f
#define brm2_PI 0.63662f
#define brmLN10 2.30259f
#define brmPI_2 1.5708f
#define brmPI_4 0.785398f
#define brm3PI_4 2.35619f
#define brmLN2HI 0.693147f
#define brmLN2LO 1.90821e-10f
#define brmLOG2E 1.4427f
#define brmSQRT2 1.41421f
#define brmSQRT3 1.73205f
#define brmTWOPI 6.28319f
#define brmINVLN2 1.4427f
#define brmIVLN10 0.434294f
#define brmLOG10E 0.434294f
#define brmLOG2_E 0.693147f
#define brmSQRTPI 1.77245f
#define brmSQRT1_2 0.707107f
#define brm2_SQRTPI 1.12838f
#else
#ifndef _GLOBAL_CONST
#define _GLOBAL_CONST _WEAK const
#endif
_GLOBAL_CONST float brmE;
_GLOBAL_CONST float brmPI;
_GLOBAL_CONST float brmLN2;
_GLOBAL_CONST float brm1_PI;
_GLOBAL_CONST float brm2_PI;
_GLOBAL_CONST float brmLN10;
_GLOBAL_CONST float brmPI_2;
_GLOBAL_CONST float brmPI_4;
_GLOBAL_CONST float brm3PI_4;
_GLOBAL_CONST float brmLN2HI;
_GLOBAL_CONST float brmLN2LO;
_GLOBAL_CONST float brmLOG2E;
_GLOBAL_CONST float brmSQRT2;
_GLOBAL_CONST float brmSQRT3;
_GLOBAL_CONST float brmTWOPI;
_GLOBAL_CONST float brmINVLN2;
_GLOBAL_CONST float brmIVLN10;
_GLOBAL_CONST float brmLOG10E;
_GLOBAL_CONST float brmLOG2_E;
_GLOBAL_CONST float brmSQRTPI;
_GLOBAL_CONST float brmSQRT1_2;
_GLOBAL_CONST float brm2_SQRTPI;
#endif
/* Prototyping of functions and function blocks */
_BUR_PUBLIC float brmatan2(float y, float x);
_BUR_PUBLIC float brmceil(float x);
_BUR_PUBLIC float brmcosh(float x);
_BUR_PUBLIC float brmfloor(float x);
_BUR_PUBLIC float brmfmod(float x, float y);
_BUR_PUBLIC float brmfrexp(float x, unsigned long pExp);
_BUR_PUBLIC float brmldexp(float x, signed long exp_val);
_BUR_PUBLIC float brmmodf(float x, unsigned long plp);
_BUR_PUBLIC float brmpow(float x, float y);
_BUR_PUBLIC float brmsinh(float x);
_BUR_PUBLIC float brmtanh(float x);
#ifdef __cplusplus
};
#endif
#endif /* _ASBRMATH_ */

View File

@@ -0,0 +1,90 @@
/* Automation Studio generated header file */
/* Do not edit ! */
#ifndef _ASBRMATH_
#define _ASBRMATH_
#ifdef __cplusplus
extern "C"
{
#endif
#include <bur/plctypes.h>
#ifndef _IEC_CONST
#define _IEC_CONST _WEAK const
#endif
/* Constants */
#ifdef _REPLACE_CONST
#define brm2_SQRTPI 1.12838
#define brmSQRT1_2 0.707107
#define brmSQRTPI 1.77245
#define brmLOG2_E 0.693147
#define brmLOG10E 0.434294
#define brmIVLN10 0.434294
#define brmINVLN2 1.4427
#define brmTWOPI 6.28319
#define brmSQRT3 1.73205
#define brmSQRT2 1.41421
#define brmLOG2E 1.4427
#define brmLN2LO 1.90821e-010
#define brmLN2HI 0.693147
#define brm3PI_4 2.35619
#define brmPI_4 0.785398
#define brmPI_2 1.5708
#define brmLN10 2.30259
#define brm2_PI 0.63662
#define brm1_PI 0.31831
#define brmLN2 0.693147
#define brmPI 3.14159
#define brmE 2.71828
#else
_IEC_CONST float brm2_SQRTPI = 1.12838;
_IEC_CONST float brmSQRT1_2 = 0.707107;
_IEC_CONST float brmSQRTPI = 1.77245;
_IEC_CONST float brmLOG2_E = 0.693147;
_IEC_CONST float brmLOG10E = 0.434294;
_IEC_CONST float brmIVLN10 = 0.434294;
_IEC_CONST float brmINVLN2 = 1.4427;
_IEC_CONST float brmTWOPI = 6.28319;
_IEC_CONST float brmSQRT3 = 1.73205;
_IEC_CONST float brmSQRT2 = 1.41421;
_IEC_CONST float brmLOG2E = 1.4427;
_IEC_CONST float brmLN2LO = 1.90821e-010;
_IEC_CONST float brmLN2HI = 0.693147;
_IEC_CONST float brm3PI_4 = 2.35619;
_IEC_CONST float brmPI_4 = 0.785398;
_IEC_CONST float brmPI_2 = 1.5708;
_IEC_CONST float brmLN10 = 2.30259;
_IEC_CONST float brm2_PI = 0.63662;
_IEC_CONST float brm1_PI = 0.31831;
_IEC_CONST float brmLN2 = 0.693147;
_IEC_CONST float brmPI = 3.14159;
_IEC_CONST float brmE = 2.71828;
#endif
/* Prototyping of functions and function blocks */
float brmatan2(float y, float x);
float brmceil(float x);
float brmcosh(float x);
float brmfloor(float x);
float brmfmod(float x, float y);
float brmfrexp(float x, unsigned long pExp);
float brmldexp(float x, signed long exp_val);
float brmmodf(float x, unsigned long plp);
float brmpow(float x, float y);
float brmsinh(float x);
float brmtanh(float x);
#ifdef __cplusplus
};
#endif
#endif /* _ASBRMATH_ */

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Library SubType="binary" Description="This library integrates mathematical functions such as angle functions, rounding off, etc. into the program." xmlns="http://br-automation.co.at/AS/Library">
<Files>
<File>AsBrMath.fun</File>
<File>AsBrMath.typ</File>
<File>AsBrMath.var</File>
</Files>
</Library>

View File

@@ -11,5 +11,6 @@
<Object Type="Library" Language="binary" Description="The AsBrStr Library contains FBKs for memory and character string handling.">AsBrStr</Object>
<Object Type="Library" Language="binary" Description="The FileIO library provides function blocks for file handling.">FileIO</Object>
<Object Type="Library" Language="binary" Description="This library contains function blocks to handle USB devices on the target.">AsUSB</Object>
<Object Type="Library" Language="binary" Description="This library integrates mathematical functions such as angle functions, rounding off, etc. into the program.">AsBrMath</Object>
</Objects>
</Package>

View File

@@ -15,8 +15,10 @@ PROGRAM _CYCLIC
brsmemset (ADR (strLine), 0, SIZEOF (strLine));
brsstrcpy (ADR (strLine), ADR (gsCurrentTime));
brsstrcat (ADR (strLine), ADR (';'));
diTempNum[1] := LREAL_TO_DINT (Result.rThickness[1] * 10.0) / 10;
brsitoa (diTempNum[1], ADR (strTempNum[1]));
rTempFrac[1] := brmmodf (LREAL_TO_REAL (Result.rThickness[1]), ADR (rTempNum[1]));
//diTempNum[1] := LREAL_TO_DINT (Result.rThickness[1] * 10.0) / 10;
brsitoa (REAL_TO_DINT (rTempNum[1]), ADR (strTempNum[1]));
brsstrcat (ADR (strLine), ADR (strTempNum[1]));
brsstrcat (ADR (strLine), ADR (','));
diTempFrac[1] := LREAL_TO_DINT (Result.rThickness[1] * 100.0) MOD 100 + 100;
@@ -25,8 +27,9 @@ PROGRAM _CYCLIC
brsstrcat (ADR (strLine), ADR (strTempFrac[1]) + 1);
brsstrcat (ADR (strLine), ADR (';'));
diTempNum[2] := LREAL_TO_DINT (Result.rThickness[2] * 10.0) / 10;
brsitoa (diTempNum[2], ADR (strTempNum[2]));
rTempFrac[2] := brmmodf (LREAL_TO_REAL (Result.rThickness[2]), ADR (rTempNum[2]));
//diTempNum[1] := LREAL_TO_DINT (Result.rThickness[1] * 10.0) / 10;
brsitoa (REAL_TO_DINT (rTempNum[2]), ADR (strTempNum[2]));
brsstrcat (ADR (strLine), ADR (strTempNum[2]));
brsstrcat (ADR (strLine), ADR (','));
diTempFrac[2] := LREAL_TO_DINT (Result.rThickness[2] * 100.0) MOD 100 + 100;
@@ -35,8 +38,9 @@ PROGRAM _CYCLIC
brsstrcat (ADR (strLine), ADR (strTempFrac[2]) + 1);
brsstrcat (ADR (strLine), ADR (';'));
diTempNum[3] := LREAL_TO_DINT (Result.rThickness[3] * 10.0) / 10;
brsitoa (diTempNum[3], ADR (strTempNum[3]));
rTempFrac[3] := brmmodf (LREAL_TO_REAL (Result.rThickness[3]), ADR (rTempNum[3]));
//diTempNum[3] := LREAL_TO_DINT (Result.rThickness[3] * 10.0) / 10;
brsitoa (REAL_TO_DINT (rTempNum[3]), ADR (strTempNum[3]));
brsstrcat (ADR (strLine), ADR (strTempNum[3]));
brsstrcat (ADR (strLine), ADR (','));
diTempFrac[3] := LREAL_TO_DINT (Result.rThickness[3] * 100.0) MOD 100 + 100;

View File

@@ -3,7 +3,8 @@ VAR
udLogfileIdent : UDINT;
udTest : UDINT;
udNodeList : ARRAY[0..7] OF UDINT;
diTempNum : ARRAY[1..3] OF DINT;
rTempFrac : ARRAY[1..3] OF REAL;
rTempNum : ARRAY[1..3] OF REAL;
diTempFrac : ARRAY[1..3] OF DINT;
strLocDevice : STRING[80];
strUSBDevice : STRING[80];

View File

@@ -67,5 +67,6 @@
<LibraryObject Name="asieccon" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="astime" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
<LibraryObject Name="AsUSB" Source="Libraries.AsUSB.lby" Memory="UserROM" Language="binary" Debugging="true" />
<LibraryObject Name="AsBrMath" Source="Libraries.AsBrMath.lby" Memory="UserROM" Language="binary" Debugging="true" />
</Libraries>
</SwConfiguration>