![]() |
Solar Monitor Lua Library
|
Functions | |
static int | sm_bOp_AND (lua_State *L) |
Returns result of (A & B). More... | |
static int | sm_bOp_OR (lua_State *L) |
Returns result of (A | B). More... | |
static int | sm_bOp_INV (lua_State *L) |
Returns result of ~A. More... | |
static int | sm_GetDeviceState (lua_State *L) |
Returns State of a Device selected by Device ID. 0 = Uninitialized, 1 = OK, 2 = Communication Timeout. More... | |
static int | sm_GetDeviceValue (lua_State *L) |
Returns Value from a Device selected by Device ID and Value Name. More... | |
static int | sm_SetDeviceValue (lua_State *L) |
Writes to a Value found in a Device selected by Device ID and Value Name. More... | |
static int | sm_AddDeviceValue (lua_State *L) |
Adds Value to a Device selected by Device ID. More... | |
static int | sm_GetCounterTotal (lua_State *L) |
Finds and returns a value from a Counter selected by Counter ID. More... | |
static int | sm_SetCounterTotal (lua_State *L) |
Writes Total value of a Counter selected by Counter ID. More... | |
static int | sm_GetBinaryInput (lua_State *L) |
Returns a state of a Binary Input selected by BInput ID. More... | |
static int | sm_GetBinaryOutput (lua_State *L) |
Returns a state of a Binary Output selected by BOutput ID. More... | |
static int | sm_SetBinaryOutput (lua_State *L) |
Sets a state of a Binary Output selected by BOutput ID. More... | |
static int | sm_GetSensorValue (lua_State *L) |
Returns a value of a Sensor selected by Sensor ID. More... | |
static int | sm_GetAnalogOutput (lua_State *L) |
Returns a value of a Analog Output selected by AOutput ID. More... | |
static int | sm_SetAnalogOutput (lua_State *L) |
Sets a value of a Analog Output selected by AOutput ID. More... | |
static int | sm_SetPCMode (lua_State *L) |
Sets Mode by which Power Control is applied (Off, Global, Selective) More... | |
static int | sm_SetPCActive (lua_State *L) |
Writes Active Power Limit value to a Power Control. More... | |
static int | sm_GetPCActive (lua_State *L) |
Returns Active Power Limit value from a Power Control. More... | |
static int | sm_SetPCReactive (lua_State *L) |
Writes Reactive Power (CosPhi) value to a Power Control. More... | |
static int | sm_GetPCReactive (lua_State *L) |
Returns Reactive Power (CosPhi) value from a Power Control. More... | |
static int | sm_GetPCModuleActive (lua_State *L) |
Returns Active Power Limit value from a connected PC Module. More... | |
static int | sm_GetPCModuleReactive (lua_State *L) |
Returns Reactive Power (CosPhi) value from a connected PC Module. More... | |
static int | sm_Delay (lua_State *L) |
Pauses Lua Script execution for a specified time delay (ms). More... | |
static int | sm_StopScript (lua_State *L) |
Stops Lua Script execution and sets it's state to Idle. More... | |
static int | sm_SetScriptCycleTime (lua_State *L) |
Sets Lua Script execution period (minimum 100 ms). More... | |
static int | sm_SendEmail (lua_State *L) |
Sends Email from Lua Script. More... | |
static int | sm_PIDInit (lua_State *L) |
Initializes PID Controller. More... | |
static int | sm_PIDProcess (lua_State *L) |
Takes SetPoint and Feedback parameters and calculates regulated output value based on PID Parameters initialized by sm_PIDInit(). More... | |
static int | sm_GetSpotPrice (lua_State *L) |
Returns Energy Spot Price for specified hour, range is from 00:00 of the current day to 00:00 of the next day (48 hours) More... | |
static int | sm_GetBatteryPlan (lua_State *L) |
Returns Battery Plan command for specified hour, range is from 00:00 of the current day to 00:00 of the next day (48 hours) More... | |
|
static |
Adds Value to a Device selected by Device ID.
Number of parameters depends on a Value Type(1 = Integer, 2 = Enum, 4 = Float, 5 = String).
Example calls:
sm_AddDeviceValue(1, 1, "ValueName", "Unit", 1);
sm_AddDeviceValue(1, 2, "ValueName");
sm_AddDeviceValue(1, 4, "ValueName", "Unit", 1.0);
sm_AddDeviceValue(1, 5, "ValueName", 20);
Integer | Device ID. |
Integer | Value Type. |
String | Name of the value. |
String/Integer | Unit of the Value / length if the Value Type is a String. |
Integer | Multiplier. |
|
static |
Returns result of (A & B).
Integer(uint32_t) | Operand A. |
Integer(uint32_t) | Operand B. |
|
static |
Returns result of ~A.
Integer(uint32_t) | Operand A. |
|
static |
Returns result of (A | B).
Integer(uint32_t) | Operand A. |
Integer(uint32_t) | Operand B. |
|
static |
Pauses Lua Script execution for a specified time delay (ms).
Integer | Delay in ms. |
|
static |
Returns a value of a Analog Output selected by AOutput ID.
Integer | AOutput ID. |
|
static |
Returns Battery Plan command for specified hour, range is from 00:00 of the current day to 00:00 of the next day (48 hours)
Meaning of the command value for the Battery Plan returned by this function
0 = No action 'Baterie zůstává nezměněna'
1 = Charge from production 'Nabíjení z výroby'
2 = Charge from grid 'Nabíjení ze sítě'
3 = Discharge to consumption 'Vybíjení do spotřeby'
4 = Discharge to grid 'Vybíjení do sítě'
5 = Discharge to consumption and grid 'Vybíjení do spotřeby a do sítě'
Integer | - Hour |
|
static |
Returns a state of a Binary Input selected by BInput ID.
Integer | BInput ID. |
|
static |
Returns a state of a Binary Output selected by BOutput ID.
Integer | BOutput ID. |
|
static |
Finds and returns a value from a Counter selected by Counter ID.
Integer | Counter ID. |
|
static |
Returns State of a Device selected by Device ID. 0 = Uninitialized, 1 = OK, 2 = Communication Timeout.
Integer | Device ID. |
|
static |
Returns Value from a Device selected by Device ID and Value Name.
Integer | Device ID. |
String | Name of the Value. |
|
static |
Returns Active Power Limit value from a Power Control.
|
static |
Returns Active Power Limit value from a connected PC Module.
|
static |
Returns Reactive Power (CosPhi) value from a connected PC Module.
|
static |
Returns Reactive Power (CosPhi) value from a Power Control.
|
static |
Returns a value of a Sensor selected by Sensor ID.
Integer | Sensor ID. |
|
static |
Returns Energy Spot Price for specified hour, range is from 00:00 of the current day to 00:00 of the next day (48 hours)
Integer | - Hour |
Integer | - optional currency selector (0 = EUR, 1 = CZK, default(undefined parameter) = EUR) |
|
static |
Initializes PID Controller.
Number | Kp Proportional gain. |
Number | Ki Integral gain. |
Number | Kd Derivative gain. |
Number | Output_Max Maximum PID output value. |
Number | Output_Min Minimum PID output value. |
Number | KdLPF_Cutoff Kd lowpass filter cutoff frequency in Hz. |
Number | TransportDelay Response time of the controlled system(optional, not yet implemented) |
Number | PID Controller Instance [0...3] (optional parameter - defaults to 0) |
|
static |
Takes SetPoint and Feedback parameters and calculates regulated output value based on PID Parameters initialized by sm_PIDInit().
Number | SetPoint (desired output of a system). |
Number | Feedback (measured real output of a system) |
Number | PID Controller Instance [0...3] (optional parameter - defaults to 0) |
|
static |
Sends Email from Lua Script.
Integer/String | Recipient ID(from Email Settings Page) / Email address. |
String | Message(body). |
String | Subject(optional) if not provided then a Subject from the Email settings is applied |
|
static |
Sets a value of a Analog Output selected by AOutput ID.
Integer | AOutput ID. |
Number | value. |
|
static |
Sets a state of a Binary Output selected by BOutput ID.
Integer | BOutput ID. |
Integer | State of the Output (1 = ON, 0 = OFF). |
|
static |
Writes Total value of a Counter selected by Counter ID.
Integer | Counter ID. |
Number | value. |
|
static |
Writes to a Value found in a Device selected by Device ID and Value Name.
Integer | Device ID. |
String | Name of the Value. |
Number/String | value. |
|
static |
Writes Active Power Limit value to a Power Control.
Integer | 0 <= PLim <= 100. |
Integer | Device ID (optional depending on Lua Power Control Mode). |
|
static |
Sets Mode by which Power Control is applied (Off, Global, Selective)
Mode Description:
Off: Calling functions sm_SetPCActive and sm_SetPCReactive has no effect.
Global: sm_SetPCActive and sm_SetPCReactive functions are executed on all devices.
Selective: sm_SetPCActive and sm_SetPCReactive will require second parameter (Device ID) to which Power Control values will be applied.
Integer | Mode -> 0 = Off, 1 = Global, 2 = Selective. |
|
static |
Writes Reactive Power (CosPhi) value to a Power Control.
Number | CosPhi. -1.0 <= CosPhi <= 1.0 |
Integer | Device ID (optional depending on Lua Power Control Mode). |
|
static |
Sets Lua Script execution period (minimum 100 ms).
Integer | Period in ms. |
|
static |
Stops Lua Script execution and sets it's state to Idle.