Added a basic creatable loop object with PID control (#1141)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
+6
-2
@@ -1232,6 +1232,7 @@ int bacapp_known_property_tag(
|
||||
|
||||
case PROP_MANIPULATED_VARIABLE_REFERENCE:
|
||||
case PROP_CONTROLLED_VARIABLE_REFERENCE:
|
||||
case PROP_SETPOINT_REFERENCE:
|
||||
case PROP_INPUT_REFERENCE:
|
||||
case PROP_EVENT_ALGORITHM_INHIBIT_REF:
|
||||
/* Properties using BACnetObjectPropertyReference */
|
||||
@@ -1321,8 +1322,11 @@ int bacapp_known_property_tag(
|
||||
/* BACnetLogRecord */
|
||||
return BACNET_APPLICATION_TAG_LOG_RECORD;
|
||||
case PROP_ACTION:
|
||||
/* BACnetActionCommand */
|
||||
return BACNET_APPLICATION_TAG_ACTION_COMMAND;
|
||||
if (object_type == OBJECT_COMMAND) {
|
||||
/* BACnetActionCommand */
|
||||
return BACNET_APPLICATION_TAG_ACTION_COMMAND;
|
||||
}
|
||||
return -1;
|
||||
case PROP_SCALE:
|
||||
/* BACnetScale */
|
||||
return BACNET_APPLICATION_TAG_SCALE;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
/* config is always first to allow developers to override */
|
||||
#include "bacnet/config.h"
|
||||
/* BACnet Stack core enumerations */
|
||||
|
||||
@@ -599,7 +599,8 @@ typedef enum {
|
||||
|
||||
typedef enum BACnetAction {
|
||||
ACTION_DIRECT = 0,
|
||||
ACTION_REVERSE = 1
|
||||
ACTION_REVERSE = 1,
|
||||
BACNET_ACTION_MAX = 2
|
||||
} BACNET_ACTION;
|
||||
|
||||
typedef enum BACnetBinaryPV {
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "bacnet/basic/object/iv.h"
|
||||
#include "bacnet/basic/object/osv.h"
|
||||
#include "bacnet/basic/object/piv.h"
|
||||
#include "bacnet/basic/object/loop.h"
|
||||
#include "bacnet/basic/object/time_value.h"
|
||||
#include "bacnet/basic/object/timer.h"
|
||||
#include "bacnet/basic/object/channel.h"
|
||||
@@ -386,6 +387,14 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
NULL /* Create */, NULL /* Delete */, NULL /* Timer */ },
|
||||
{ OBJECT_LOOP, Loop_Init, Loop_Count,
|
||||
Loop_Index_To_Instance, Loop_Valid_Instance,
|
||||
Loop_Object_Name, Loop_Read_Property,
|
||||
Loop_Write_Property, Loop_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
Loop_Create, Loop_Delete, Loop_Timer },
|
||||
{ OBJECT_PROGRAM, Program_Init, Program_Count,
|
||||
Program_Index_To_Instance, Program_Valid_Instance,
|
||||
Program_Object_Name, Program_Read_Property,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,214 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief API for Loop object type
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date November 2025
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#ifndef BACNET_BASIC_OBJECT_LOOP_H
|
||||
#define BACNET_BASIC_OBJECT_LOOP_H
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
/* BACnet Stack defines - first */
|
||||
#include "bacnet/bacdef.h"
|
||||
/* BACnet Stack API */
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/timer_value.h"
|
||||
#include "bacnet/wp.h"
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/list_element.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Proprietary_Property_List_Set(const int *pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Read_Property_Proprietary_Callback_Set(read_property_function cb);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Write_Property_Proprietary_Callback_Set(write_property_function cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Loop_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Loop_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Loop_Instance_To_Index(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Loop_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Description(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *description);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Description_Set(uint32_t instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Loop_Description_ANSI(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Out_Of_Service_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Loop_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Reliability_Set(uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Present_Value_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Loop_Update_Interval(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Update_Interval_Set(uint32_t object_instance, uint32_t value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Loop_Output_Units(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Output_Units_Set(uint32_t instance, uint16_t units);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Manipulated_Variable_Reference(
|
||||
uint32_t object_instance, BACNET_OBJECT_PROPERTY_REFERENCE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Manipulated_Variable_Reference_Set(
|
||||
uint32_t object_instance, BACNET_OBJECT_PROPERTY_REFERENCE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Controlled_Variable_Reference(
|
||||
uint32_t object_instance, BACNET_OBJECT_PROPERTY_REFERENCE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Controlled_Variable_Reference_Set(
|
||||
uint32_t object_instance, BACNET_OBJECT_PROPERTY_REFERENCE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Controlled_Variable_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Controlled_Variable_Value_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Loop_Controlled_Variable_Units(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Controlled_Variable_Units_Set(uint32_t instance, uint16_t units);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Setpoint_Reference(
|
||||
uint32_t instance, BACNET_OBJECT_PROPERTY_REFERENCE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Setpoint_Reference_Set(
|
||||
uint32_t instance, BACNET_OBJECT_PROPERTY_REFERENCE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Setpoint(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Setpoint_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ACTION Loop_Action(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Action_Set(uint32_t object_instance, BACNET_ACTION value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Proportional_Constant(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Proportional_Constant_Set(uint32_t object_instance, float value);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Loop_Proportional_Constant_Units(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Proportional_Constant_Units_Set(uint32_t instance, uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Integral_Constant(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Integral_Constant_Set(uint32_t object_instance, float value);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Loop_Integral_Constant_Units(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Integral_Constant_Units_Set(uint32_t instance, uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Derivative_Constant(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Derivative_Constant_Set(uint32_t object_instance, float value);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Loop_Derivative_Constant_Units(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Derivative_Constant_Units_Set(uint32_t instance, uint16_t units);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Bias(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Bias_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Maximum_Output(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Maximum_Output_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_Minimum_Output(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Minimum_Output_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t Loop_Priority_For_Writing(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Priority_For_Writing_Set(uint32_t object_instance, uint8_t value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Loop_COV_Increment(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_COV_Increment_Set(uint32_t instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Reliability_Evaluation_Inhibit(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Reliability_Evaluation_Inhibit_Set(uint32_t instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Timer(uint32_t object_instance, uint16_t elapsed_milliseconds);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Write_Property_Internal_Callback_Set(write_property_function cb);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Read_Property_Internal_Callback_Set(read_property_function cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Loop_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Loop_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Loop_Delete(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t Loop_Size(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Init(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void *Loop_Context_Get(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Loop_Context_Set(uint32_t object_instance, void *context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "bacnet/basic/object/iv.h"
|
||||
#include "bacnet/basic/object/time_value.h"
|
||||
#include "bacnet/basic/object/timer.h"
|
||||
#include "bacnet/basic/object/loop.h"
|
||||
#include "bacnet/basic/object/channel.h"
|
||||
#include "bacnet/basic/object/program.h"
|
||||
#include "bacnet/basic/object/lo.h"
|
||||
@@ -134,6 +135,7 @@
|
||||
defined(CONFIG_BACNET_BASIC_OBJECT_BITSTRING_VALUE) || \
|
||||
defined(CONFIG_BACNET_BASIC_OBJECT_TIME_VALUE) || \
|
||||
defined(CONFIG_BACNET_BASIC_OBJECT_TIMER) || \
|
||||
defined(CONFIG_BACNET_BASIC_OBJECT_LOOP) || \
|
||||
defined(CONFIG_BACNET_BASIC_OBJECT_PROGRAM) || \
|
||||
defined(CONFIG_BACNET_BASIC_OBJECT_CHARACTERSTRING_VALUE))
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_ALL
|
||||
@@ -166,6 +168,7 @@
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_BITSTRING_VALUE
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_TIME_VALUE
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_TIMER
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_LOOP
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_PROGRAM
|
||||
#define CONFIG_BACNET_BASIC_OBJECT_CHARACTERSTRING_VALUE
|
||||
#endif
|
||||
@@ -828,6 +831,28 @@ static object_functions_t My_Object_Table[] = {
|
||||
Timer_Delete,
|
||||
Timer_Task },
|
||||
#endif
|
||||
#if defined(CONFIG_BACNET_BASIC_OBJECT_LOOP)
|
||||
{ OBJECT_LOOP,
|
||||
Loop_Init,
|
||||
Loop_Count,
|
||||
Loop_Index_To_Instance,
|
||||
Loop_Valid_Instance,
|
||||
Loop_Object_Name,
|
||||
Loop_Read_Property,
|
||||
Loop_Write_Property,
|
||||
Loop_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */,
|
||||
NULL /* Remove_List_Element */,
|
||||
Loop_Create,
|
||||
Loop_Delete,
|
||||
Loop_Timer },
|
||||
#endif
|
||||
#if defined(CONFIG_BACNET_BASIC_OBJECT_PROGRAM)
|
||||
{ OBJECT_BITSTRING_VALUE,
|
||||
Program_Init,
|
||||
|
||||
@@ -1851,6 +1851,7 @@ static const int Loop_Properties_Optional[] = {
|
||||
/* unordered list of properties */
|
||||
PROP_DESCRIPTION,
|
||||
PROP_RELIABILITY,
|
||||
PROP_UPDATE_INTERVAL,
|
||||
PROP_PROPORTIONAL_CONSTANT,
|
||||
PROP_PROPORTIONAL_CONSTANT_UNITS,
|
||||
PROP_INTEGRAL_CONSTANT,
|
||||
|
||||
Reference in New Issue
Block a user