Visual Programming

Overview

There is an example implementation of the temperature cool sensor application available in the apps folder. In this implementation, it contains all the API functions and demos for how to use them.

The below table captures the function of vp.

Inputs and Outputs:

s.no

VP data group

Supported operations

Data group

Data operations
  • Read data

  • Write data

  • Constant

  • Triggered write

  • Typecast

Mathematical group

Math operations
  • Addition

  • Subtraction

  • Multiplication

  • Division

  • Modulous

  • Integer

  • Sign

  • Negate

  • Power

  • Exponential

  • Absolute

  • Square root

  • Trignometry(sin,cos,tan,sin-1,cos-1,tan-1)

  • Log(Log, Log10, Exp10)

  • Summation

  • Polynomial

Logical group

Logical operations
  • Gates(AND,OR,NOT,XOR)

  • Flipflops(SRFF, TFF, DFF)

  • Latch

Conditional group

Conditional operations
  • Equal to, Not equal to

  • Less than, Greater than

  • Less than or equal to, Greater than or equal to

Switches group

Switches operations
  • Selector

  • Switch negate

  • Switch priority

  • Switch minimum

  • Switch maximum

  • Toggle switch

  • Delay

Input Limiters group

Limiters operations
  • Integrator

  • Priority Encoder

  • Input limiter

  • Low pass filter

  • Input limiter

  • Slew limiter

  • PID controller

Transformation group

Transformation operations
  • Polar to Cartesian

  • Cartesian to Polar

  • Angular units

  • Length units

  • Mass units

  • Volume units

  • Time units

  • Temperature units

Physical group

Physical operations
  • IC Engine

  • Longitudinal Vehicle

Wave Generator group

Sinewave generator

The below table captures the function that are to be called from the application logic.

API Functions

Function

Description

rs_vp_init

To initialize the VP stack.

rs_vp_process

To be called periodically to process the block operations.

Callback Functions

Function

Description

rcb_vp_blk_error_info

Called when blocks error occurs.

Error Code

  • Every API’s for the VP returns some success or failure values. Please refer below section,

Implementation Guide

This section explains how to implement the VP using the RAPIDSEA stack, the steps to be followed are

  • Initialize the VP

  • Import flint project.

  • Call the vp process periodically to execute the VP blocks.

  • Blocks execute based on the flint project

VP Header

Documentation from the relevant header as follows:

Visual Programming Specific APIs.

Defines macros and functions specific to Visual Programming functionality

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Defines

RS_VPBLK_INVALID

VP BLOCK group macro’s.

RS_VPBLK_DATA_READ
RS_VPBLK_DATA_CUSTOM_READ
RS_VPBLK_DATA_WRITE
RS_VPBLK_TRIGGERED_DATA_WRITE
RS_VPBLK_DATA_CONSTANT
RS_VPBLK_DATA_TYPECAST
RS_VPBLK_LOGIC_OR

Logical group macro’s.

RS_VPBLK_LOGIC_AND
RS_VPBLK_LOGIC_XOR
RS_VPBLK_LOGIC_NOT
RS_VPBLK_LOGIC_SRFLIPFLOP
RS_VPBLK_LOGIC_TFLIPFLOP
RS_VPBLK_LOGIC_DFLIPFLOP
RS_VPBLK_LOGIC_LATCH
RS_VPBLK_LOGIC_BIT_AND
RS_VPBLK_LOGIC_BIT_OR
RS_VPBLK_LOGIC_BIT_XOR
RS_VPBLK_LOGIC_BIT_NOT
RS_VPBLK_LOGIC_BIT_LEFT_SHIFT
RS_VPBLK_LOGIC_BIT_RIGHT_SHIFT
RS_VPBLK_LOGIC_BIT_EXTRACT
RS_VPBLK_LOGIC_BIT_CLEAR
RS_VPBLK_LOGIC_BIT_SET
RS_VPBLK_MATH_ADD

Mathematical group macro’s.

RS_VPBLK_MATH_SUB
RS_VPBLK_MATH_MUL
RS_VPBLK_MATH_DIV
RS_VPBLK_MATH_MOD
RS_VPBLK_MATH_INT
RS_VPBLK_MATH_SIGN
RS_VPBLK_MATH_NEG
RS_VPBLK_MATH_POW
RS_VPBLK_MATH_EXP
RS_VPBLK_MATH_SQRT
RS_VPBLK_MATH_ABS
RS_VPBLK_MATH_TRIGONOMETRY
RS_VPBLK_MATH_LOG
RS_VPBLK_MATH_LOG10
RS_VPBLK_MATH_BASE10
RS_VPBLK_MATH_SUMMATION
RS_VPBLK_MATH_POLYNOMIAL
RS_VPBLK_SELECTOR

Swiches group macro’s.

RS_VPBLK_SWITCH_NEGATE
RS_VPBLK_SWITCH_PRIORITY
RS_VPBLK_SWITCH_MINIMUM
RS_VPBLK_SWITCH_MAXIMUM
RS_VPBLK_TOGGLE_SWITCH
RS_VPBLK_TIME_DELAY
RS_VPBLK_FUNC_INTEGRATOR

Input limiters group macro’s.

RS_VPBLK_FUNC_BIN_TO_DEC
RS_VPBLK_FUNC_DEC_TO_BIN
RS_VPBLK_FUNC_PRI_ENC
RS_VPBLK_FUNC_INP_LIM
RS_VPBLK_FUNC_LP_FILTER
RS_VPBLK_FUNC_SLEW_LIM
RS_VPBLK_FUNC_PID_CTRL
RS_VPBLK_SOURCE_PULSE_GEN

Source group macro’s.

RS_VPBLK_SOURCE_RANDOM_NUM_GEN
RS_VPBLK_SOURCE_COUNTER_FREE_RUNNING
RS_VPBLK_SOURCE_COUNTER_LIMITED
RS_VPBLK_PHYSICAL_IC_ENGINE

Physical group macro’s.

RS_VPBLK_PHYSICAL_LONGITUDINAL_VEHICLE
RS_VPBLK_TRANS_CARTESIAN_TO_POLAR

Transformation group macro’s.

RS_VPBLK_TRANS_POLAR_TO_CARTESIAN
RS_VPBLK_TRANS_ANGULAR_UNITS
RS_VPBLK_TRANS_LENGTH_UNITS
RS_VPBLK_TRANS_MASS_UNITS
RS_VPBLK_TRANS_VOLUME_UNITS
RS_VPBLK_TRANS_TIME_UNITS
RS_VPBLK_TRANS_TEMP_UNITS
RS_VPBLK_SINE_WAVE_GENERATOR

Transformation group macro’s.

RS_VPBLK_COMP_OP_EQUAL_TO

Comparative group macro’s.

RS_VPBLK_COMP_OP_NOT_EQUAL
RS_VPBLK_COMP_OP_GREATER_THAN
RS_VPBLK_COMP_OP_LESS_THAN
RS_VPBLK_COMP_OP_GREATER_THAN_OR_EQUAL_TO
RS_VPBLK_COMP_OP_LESS_THAN_OR_EQUAL_TO
RS_VPBLK_MSG_QUEUE

Modules group macro’s.

RS_VPBLK_MSG_QUEUE_PUSH
RS_VPBLK_MSG_QUEUE_POP
RS_VPBLK_MSG_QUEUE_RESET
RS_VPBLK_RING_BUF
RS_VPBLK_RING_BUF_PUSH
RS_VPBLK_RING_BUF_POP
RS_VPBLK_FILTER_MA
RS_VPBLK_FILTER_MA_ADD_INP
RS_VPBLK_FILTER_MA_GET_AVG
RS_VPBLK_FILTER_MA_RESET
RS_VPBLK_DISPATCHER_REG_MOD
RS_VPBLK_DISPATCHER_CONSUME_MSG
RS_VPBLK_DISPATCHER_DISPATCH_MSG
RS_VPBLK_SB_QUEUE
RS_VPBLK_SB_QUEUE_PUSH
RS_VPBLK_SB_QUEUE_PULL
RS_VPBLK_MAP
RS_VPBLK_MAP_SET
RS_VPBLK_MAP_GET
RS_VPBLK_MAP_ERASE
RS_VPBLK_MAP_ERASE_ALL
RS_VPBLK_FILE_SINK

File sink macro’s.

RS_VP_NUM_BLOCKS

Total number of VP Blocks.

RS_VPBLK_READ_ARG_CONST
RS_VPBLK_READ_ARG_FROM_MEM
RS_VPBLK_FILTER_SLIDING
RS_VPBLK_FILTER_EXPONENTIAL
RS_VPBLK_INTEGRATOR_PROP_WITH_LIMITS

Integrator group properties.

Apply limits to output

RS_VPBLK_INTEGRATOR_PROP_ENABLE_WRAP

Wraps if limits crossed.

RS_VPBLK_ANGLE_UNIT_DEG

Angular unit types

Angle in Degrees

RS_VPBLK_ANGLE_UNIT_RAD

Angle in Radians.

RS_VPBLK_ANGLE_UNIT_GRA

Angle in Gradians.

RS_VPBLK_LENGTH_UNIT_KM

Length unit types

Length in Kilometer

RS_VPBLK_LENGTH_UNIT_M

Length in Meter.

RS_VPBLK_LENGTH_UNIT_CM

Length in Centimeter.

RS_VPBLK_LENGTH_UNIT_MM

Length in Millimeter.

RS_VPBLK_LENGTH_UNIT_FEET

Length in Feet.

RS_VPBLK_LENGTH_UNIT_YARD

Length in Yard.

RS_VPBLK_LENGTH_UNIT_INCH

Length in Inch.

RS_VPBLK_LENGTH_UNIT_MILE

Length in Mile.

RS_VPBLK_MASS_UNIT_KG

Mass unit types.

Mass in Kilogram

RS_VPBLK_MASS_UNIT_GRAM

Mass in Gram.

RS_VPBLK_MASS_UNIT_MILLIGRAM

Mass in Milligram.

RS_VPBLK_MASS_UNIT_OUNCE

Mass in Ounce.

RS_VPBLK_MASS_UNIT_POUND

Mass in Pound.

RS_VPBLK_MASS_UNIT_TON

Mass in Ton.

RS_VPBLK_VOLUME_UNIT_LITRE

Volume unit types

Volume in Litre

RS_VPBLK_VOLUME_UNIT_ML

Volume in Milliliter.

RS_VPBLK_VOLUME_UNIT_KL

Volume in Kilolitre.

RS_VPBLK_VOLUME_UNIT_GALLON

Volume in Gallon.

RS_VPBLK_VOLUME_UNIT_PINT

Volume in Pint.

RS_VPBLK_VOLUME_UNIT_FLUID_OUNCE

Volume in Fluid ounce.

RS_VPBLK_VOLUME_UNIT_MM3

Volume in mm3.

RS_VPBLK_VOLUME_UNIT_M3

Volume in m3.

RS_VPBLK_TIME_UNIT_SEC

Time unit types.

Time in seconds

RS_VPBLK_TIME_UNIT_MIN

Time in Minutes.

RS_VPBLK_TIME_UNIT_HOUR

Time in Hour.

RS_VPBLK_TIME_UNIT_DAY

Time in Day.

RS_VPBLK_TIME_UNIT_MONTH

Time in Month.

RS_VPBLK_TIME_UNIT_WEEK

Time in Week.

RS_VPBLK_TIME_UNIT_YEAR

Time in Year.

RS_VPBLK_TEMP_UNIT_KELVIN

Temperature unit types

Temperature in Kelvin

RS_VPBLK_TEMP_UNIT_CELSIUS

Temperature in Celsius.

RS_VPBLK_TEMP_UNIT_FARENHEIT

Temperature in Farenheit.

RS_VPBLK_TRIG_SIN

Trigonometry types

Trigonometry sin

RS_VPBLK_TRIG_COS

Trigonometry cos.

RS_VPBLK_TRIG_TAN

Trigonometry tan.

RS_VPBLK_TRIG_ASIN

Trigonometry inverse sin.

RS_VPBLK_TRIG_ACOS

Trigonometry inverse cos.

RS_VPBLK_TRIG_ATAN

Trigonometry inverse tan

RS_VPBLK_FILE_LOG_FORMAT_CSV

File format type

RS_VPBLK_FL_DATA_FORMAT_TIMESERIES

Data format type

RS_VP_OP_DATA_TYPE_UINT8

VP Block supported output data types.

RS_VP_OP_DATA_TYPE_INT8
RS_VP_OP_DATA_TYPE_UINT16
RS_VP_OP_DATA_TYPE_INT16
RS_VP_OP_DATA_TYPE_UINT32
RS_VP_OP_DATA_TYPE_INT32
RS_VP_OP_DATA_TYPE_FLOAT
RS_VP_OP_DATA_TYPE_DOUBLE
RS_VP_OP_DATA_TYPE_UINT64
RS_VP_OP_DATA_TYPE_INT64
RS_VP_IP_DATA_TYPE_UINT8

VP Block supported input data types.

RS_VP_IP_DATA_TYPE_INT8
RS_VP_IP_DATA_TYPE_UINT16
RS_VP_IP_DATA_TYPE_INT16
RS_VP_IP_DATA_TYPE_UINT32
RS_VP_IP_DATA_TYPE_INT32
RS_VP_IP_DATA_TYPE_UINT64
RS_VP_IP_DATA_TYPE_INT64
RS_VP_IP_DATA_TYPE_FLOAT
RS_VP_IP_DATA_TYPE_DOUBLE

Typedefs

typedef struct tag_rs_vp_exec_context rs_vp_exec_context_t

Structure to hold information about the VP execute context.

typedef struct tag_rs_vp_logic_list rs_vp_logic_list_t

Structure to hold information about the VP logic list.

typedef struct tag_rs_vp_logic_prop rs_vp_logic_prop_t

Structure to hold information about the VP logic property.

Functions

rs_ret_val_t rs_vp_init(rs_vp_logic_prop_t **ptr_vp_logic_list)

Visual Programming initialization.

This function initialize the visual programming

Parameters:

ptr_vp_logic_list[in] - Pointer to the visual programming logic list

Returns:

0 for success or failure

rs_ret_val_t rs_vp_process(rs_vp_logic_prop_t **ptr_vp_logic_list)

Process for Visual Programming.

This function initiate the Visual Programming process

Parameters:

ptr_vp_logic_list[in] - Pointer to the VP logic list

Returns:

0 for success or failure

rs_ret_val_t rcb_vp_blk_error_info(rs_vp_exec_context_t *ptr_vp_ec)

Get the block error information.

This callback function for get the block error information

Parameters:

ptr_vp_ec[in] - Pointer to the VP execution context

Returns:

0 for success or failure

struct tag_rs_vp_exec_context
#include <rs_vp_core.h>

Structure to hold information about the VP execute context.

Public Members

uint16_t *ptr_list_arg

Pointer to location where the logic list is stored in per block.

uint8_t block_error

Block error flag.

int32_t error_code

Block error code.

struct tag_rs_vp_logic_list
#include <rs_vp_core.h>

Structure to hold information about the VP logic list.

Public Members

const uint16_t *ptr_logic

Pointer to location where the logic is stored.

uint16_t period_ms

Periodicity to execute this logic.

uint16_t reserved

Reserved.

struct tag_rs_vp_logic_prop
#include <rs_vp_core.h>

Structure to hold information about the VP logic property.

Public Members

rs_vp_logic_list_t *ptr_logic_list

Pointer to location where the logic is stored.

uint16_t period_ms

Periodicity to execute this logic.

uint16_t guard_id

Guard ID.

uint32_t res_2

Reserved for future use.

uint32_t res_3

Reserved for future use.