POWER REDUNDANCY AND SEASON MODE SCRIPT
This page will show you how to set up a script that will add or remove degrees from the set point based on which season is selected insdie a drop down menu (Summer / Winter). This script will take care eather of the current instant power, if the power is enaugh then the function will proceed its course if not the function won’t start and the set point will be set back to its first value.
This script uses variables in order to gather first information that are needed for the function process later on. At each variable you must associate a component ID. You can get the component ID once you add the component inside the project.
var instant_power: Component that contain the instant power;
var redundancy_power_level: Production level beyond which consumption is triggered;
var normal_power_level: Level which under everything get stoped;
var season: Components that indicates the current season;
var setpoint: Component that indicates the current setpoint;
var active: Indicates if the system is in redundancy;
var previous_setpoint_value: Get the fisrt value of the set point in order to set it back at its original value.
In this script we will use one major function.
Function 1: power_changing:
This function will get the instant_power value, if the redundancy is not active then the function will proceed.
Function 1 part 2: Setting the corrisponding value to the set point, interrupting the function if the power goes under the minimum value
If the power level is above the minimum threshold the function will continue by gatherning the current value of the set point and the value of the drop down menu, finally it will save the initial set point value. Based on the value of the drop down menu Summer/Winter a value to the set point will be added or removed, Instead, if the system end up beign redundancy, the set point will be reset to its fisrt value and the system will be brought back to normal mode active=false.
Now, in order to trigger the function you need to apply the setTrigger statement. This will set the trigger to the function power_changing , without it the function won’t start. Click this link for further information about the set trigger statement.