Commit c269f138 authored by claes's avatar claes

IEqual, IGreaterEqual etc added

parent 65ef725f
......@@ -12,6 +12,7 @@
#endif
#include <limits.h>
#include <math.h>
#include <float.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
......@@ -686,7 +687,19 @@ void Equal_exec(
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 == o->In2);
o->Status = (fabsf(o->In1 - o->In2) < FLT_EPSILON);
}
/*_*
@aref notequal NotEqual
*/
void NotEqual_exec(
plc_sThread *tp,
pwr_sClass_NotEqual *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = !(fabsf(o->In1 - o->In2) < FLT_EPSILON);
}
/*_*
......@@ -698,7 +711,7 @@ void GreaterEqual_exec(
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 >= o->In2);
o->Status = (o->In1 >= o->In2) || (fabsf(o->In1 - o->In2) < FLT_EPSILON);
}
/*_*
......@@ -722,7 +735,7 @@ void LessEqual_exec(
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 <= o->In2);
o->Status = (o->In1 <= o->In2) || (fabsf(o->In1 - o->In2) < FLT_EPSILON);
}
/*_*
......@@ -737,6 +750,78 @@ void LessThan_exec(
o->Status = (o->In1 < o->In2);
}
/*_*
@aref iequal IEqual
*/
void IEqual_exec(
plc_sThread *tp,
pwr_sClass_IEqual *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 == o->In2);
}
/*_*
@aref iequal INotEqual
*/
void INotEqual_exec(
plc_sThread *tp,
pwr_sClass_INotEqual *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 != o->In2);
}
/*_*
@aref igreaterequal IGreaterEqual
*/
void IGreaterEqual_exec(
plc_sThread *tp,
pwr_sClass_IGreaterEqual *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 >= o->In2);
}
/*_*
@aref igreaterthan IGreaterThan
*/
void IGreaterThan_exec(
plc_sThread *tp,
pwr_sClass_IGreaterThan *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 > o->In2);
}
/*_*
@aref ilessequal ILessEqual
*/
void ILessEqual_exec(
plc_sThread *tp,
pwr_sClass_ILessEqual *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 <= o->In2);
}
/*_*
@aref ilessthan ILessThan
*/
void ILessThan_exec(
plc_sThread *tp,
pwr_sClass_ILessThan *o)
{
o->In1 = *o->In1P;
o->In2 = *o->In2P;
o->Status = (o->In1 < o->In2);
}
/*_*
IAdd Integer addition.
......
......@@ -11,12 +11,12 @@ SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_arithm.c
! @Group Plc,PlcInteger
! @Summary Check if two integer are equal.
! Equal compare two integer values and returnes true if they are equal.
! @Group Plc,PlcAnalog
! @Summary Check if two analog values are equal.
! Equal compare two analog values and returnes true if they are equal.
! @image orm_equal_fo.gif
!*/
Object Equal $ClassDef 391
Object Equal $ClassDef 419
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
......@@ -27,24 +27,24 @@ SObject pwrb:Class
Attr StructName = "Equal"
EndBody
!/**
! Integer input 1.
! Analog input 1.
!*/
Object In1 $Input 1
Body SysBody
Attr Flags |= PWR_MASK_NOREMOVE
Attr Flags |= PWR_MASK_NOINVERT
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In1"
EndBody
EndObject
!/**
! Integer input 2.
! Analog input 2.
!*/
Object In2 $Input 2
Body SysBody
Attr Flags |= PWR_MASK_NOINVERT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In2"
EndBody
EndObject
......
......@@ -11,13 +11,13 @@ SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_arithm.c
! @Group Plc,PlcInteger
! @Summary Check if an integer value is greater than or equal another.
! GreaterEqual compares two integer values and returns true if the first
! @Group Plc,PlcAnalog
! @Summary Check if an analog value is greater than or equal another.
! GreaterEqual compares two analog values and returns true if the first
! is greater than or equal the second.
! @image orm_greaterequal_fo.gif
!*/
Object GreaterEqual $ClassDef 392
Object GreaterEqual $ClassDef 420
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
......@@ -28,24 +28,24 @@ SObject pwrb:Class
Attr StructName = "GreaterEqual"
EndBody
!/**
! Integer input 1.
! Analog input 1.
!*/
Object In1 $Input 1
Body SysBody
Attr Flags |= PWR_MASK_NOREMOVE
Attr Flags |= PWR_MASK_NOINVERT
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In1"
EndBody
EndObject
!/**
! Integer input 2.
! Analog input 2.
!*/
Object In2 $Input 2
Body SysBody
Attr Flags |= PWR_MASK_NOINVERT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In2"
EndBody
EndObject
......
......@@ -11,13 +11,13 @@ SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_arithm.c
! @Group Plc,PlcInteger
! @Summary Check if an integer value is greater than another.
! GreaterThan compares two integer values and returns true if the first
! @Group Plc,PlcAnalog
! @Summary Check if an analog value is greater than another.
! GreaterThan compares two analog values and returns true if the first
! is greater than the second.
! @image orm_greaterthan_fo.gif
!*/
Object GreaterThan $ClassDef 393
Object GreaterThan $ClassDef 421
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
......@@ -28,24 +28,24 @@ SObject pwrb:Class
Attr StructName = "GreaterThan"
EndBody
!/**
! Integer input 1.
! Analog input 1.
!*/
Object In1 $Input 1
Body SysBody
Attr Flags |= PWR_MASK_NOREMOVE
Attr Flags |= PWR_MASK_NOINVERT
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In1"
EndBody
EndObject
!/**
! Integer input 2.
! Analog input 2.
!*/
Object In2 $Input 2
Body SysBody
Attr Flags |= PWR_MASK_NOINVERT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In2"
EndBody
EndObject
......
......@@ -11,13 +11,13 @@ SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_arithm.c
! @Group Plc,PlcInteger
! @Summary Check if an integer value is less than or equal another.
! LessEqual compares two integer values and returns true if the first
! @Group Plc,PlcAnalog
! @Summary Check if an analog value is less than or equal another.
! LessEqual compares two analog values and returns true if the first
! is less than or equal the second.
! @image orm_lessequal_fo.gif
!*/
Object LessEqual $ClassDef 394
Object LessEqual $ClassDef 422
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
......@@ -28,24 +28,24 @@ SObject pwrb:Class
Attr StructName = "LessEqual"
EndBody
!/**
! Integer input 1.
! Analog input 1.
!*/
Object In1 $Input 1
Body SysBody
Attr Flags |= PWR_MASK_NOREMOVE
Attr Flags |= PWR_MASK_NOINVERT
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In1"
EndBody
EndObject
!/**
! Integer input 2.
! Analog input 2.
!*/
Object In2 $Input 2
Body SysBody
Attr Flags |= PWR_MASK_NOINVERT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In2"
EndBody
EndObject
......
......@@ -11,13 +11,13 @@ SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_arithm.c
! @Group Plc,PlcInteger
! @Summary Check if an integer value is less than another.
! LessThan compares two integer values and returns true if the first
! @Group Plc,PlcAnalog
! @Summary Check if an analog value is less than another.
! LessThan compares two analog values and returns true if the first
! is less than the second.
! @image orm_lessthan_fo.gif
!*/
Object LessThan $ClassDef 395
Object LessThan $ClassDef 423
Body SysBody
Attr Editor = pwr_eEditor_PlcEd
Attr Method = pwr_eMethod_Connections
......@@ -28,24 +28,24 @@ SObject pwrb:Class
Attr StructName = "LessThan"
EndBody
!/**
! Integer input 1.
! Analog input 1.
!*/
Object In1 $Input 1
Body SysBody
Attr Flags |= PWR_MASK_NOREMOVE
Attr Flags |= PWR_MASK_NOINVERT
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In1"
EndBody
EndObject
!/**
! Integer input 2.
! Analog input 2.
!*/
Object In2 $Input 2
Body SysBody
Attr Flags |= PWR_MASK_NOINVERT
Attr TypeRef = "pwrs:Type-$Int32"
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "In2"
EndBody
EndObject
......
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