WSWIN-variables basic course from Matthias Krücke, homepage: http://www.woldegk-wetter.de Each WSWIN variable starts with a %-sign and ends with it. If it is missing, the variable does not work! The same applies to Memory variables (%ws_setmem[1]=xyz%) or also calculation variables (%ws_calc[+]=2~3~0%) etc. There are the memory variables (%ws_setmem[xyz]=text or calculation%), where xyz is the memory number (1-128). I can do that with it Stored at any point (unless I have previously used the same memory number otherwise !!!) with the Variables %ws_getmem[xyz]%, either as a result or for further processing. I put a WSWIN variable in a memory variable, e.g. the act. Outside temperature %curval[0]%, the whole thing looks like this: %Setmem[1]=%curval[0]%%. Both the memory variable and the Varaible of the outside temperature need the %-signs at the beginning and end! In this case, there are two!! %-Character. The same applies to the comparison variable %ws_compare[x]=...% Here is an example for the statement no frost, frost or permafrost: Compare if the 24h Mintemp. is below 0°. If yes, then 1 else 0. %ws_setmem[1]=%ws_compare[5]=%minval[0]%~0~1~0%% Compare if the 24h Maxtemp. is below 0 °. If yes, then 2 else 0. %ws_setmem[2]=%ws_compare[5]=%maxval[0]%~0~2~0%% Add value from memory variable 1 + 2 and save in memvar3. %ws_setmem[3]=%ws_calc[+]=%ws_getmem[1]%~%ws_getmem[2]%~0%% Now we compare: %ws_setmem[4]=%ws_compare[3]=%ws_getmem[3]%~1~frost~no frost%% %ws_compare[3]=%ws_getmem[3]%~3~permafrost~%ws_getmem[4]%% If I want to cache the result to use it elsewhere, it looks like this: %ws_setmem[5]=%ws_compare[3]=%ws_getmem[3]%~3~permafrost~%ws_getmem[4]%%% In this case the variable calculation ends with 3%-signs! Once for the memory variable %ws_setmem[5]=...; then for the Comparison variable %ws_compare[3]=...; and (because at the end within the comparison variable) for %ws_getmem[4]%. For calculations or comparisons, the units must be turned off!!! %unit_off% and %unit_on% must not be in the same row, otherwise the units will be switched off! After the calculation you should switch the units back on with %unit_on%, otherwise they will stay switched off for the rest of the script (or even for the following scripts)! The complete number as calculation: %unit_off% %ws_setmem[1]=%ws_compare[5]=%minval[0]%~0~1~0%% %ws_setmem[2]=%ws_compare[5]=%maxval[0]%~0~2~0%% %ws_setmem[3]=%ws_calc[+]=%ws_getmem[1]%~%ws_getmem[2]%~0%% %ws_setmem[4]=%ws_compare[3]=%ws_getmem[3]%~1~frost~no frost%% currently we have %ws_compare[3]=%ws_getmem[3]%~3~permafrost~%ws_getmem[4]%% %unit_on% Or so, here is a comparison made in comparison: %unit_off% %ws_setmem[1]=%ws_compare[5]=%minval[0]%~0~1~0%% %ws_setmem[2]=%ws_compare[5]=%maxval[0]%~0~2~0%% %ws_setmem[3]=%ws_calc[+]=%ws_getmem[1]%~%ws_getmem[2]%~0%% currently we have %ws_compare[3]=%ws_getmem[3]%~3~permafrost~%ws_compare[2]=%ws_getmem[1]%~1~frost~no frost%% %unit_on% In this variant, there is a peculiarity: in a calculation variable may NOT be the same comparison 2x. So 2x %ws_compare[3]= one after another does not work. User settings Many of my scripts have individual user settings where you can store certain parameters. Use all these user settings the storage variable %ws_setmem[xyz]=%. The most common mistake made here is the missing %-sign at the end. Example: - It should be deposited one month, either as a fixed value (for example, for May = 05) or as current month (%ws_month2%). %ws_setmem[128]=05% or with current month %ws_setmem[128]=%ws_month2%% In the last case, logically, at the end of the entry there are 2%-signs !! ------------------------------------------------- Update 28.01.2019 | Main variables for calculation This group includes: the comparison variable %ws_compare[x]=w1~w2~true~false% the calculation variable %ws_calc[x]=w1~w2~decimal places% Basically, the units must be turned off at each comparison or calculation - s.o .. --- The comparison variable: %ws_compare[x]=w1~w2~true~false% Where x is the type of comparison (greater >; smaller <; equal =; greater than or equal to >=; and less than or equal to <=). For each of these Comparison types is a number provided: greater=1; small=5; the same=3; greater-than-or-equal to=2; less-than-or-equal-to=4 w1 and w2 are the comparative parameters (numerical values) Examples: %ws_compare[1]=25~30~true~false% (is 25 greater then 30?) # false Of course, you can use other variables for the result ~true~false%. Examples: %ws_compare[5]=%curval[0]%~0~Snow remains~Thaw% # is the outdoor temp. <0°C then; "Snow remains", otherwise: "thaw" %ws_compare[2]=%curval[35]%~30~%curval[44]%~%curval[0]%% # if the wind speed >=30km/h then windchill, otherwise outside temp. --- The calculation variable: %ws_calc[x]=w1~w2~decimal places% Where x is the function of the four basic arithmetic operations + - / * w1 and w2 are the numerical values to be calculated Examples: %ws_calc[+]=13.123~15.123~0% # 28 %ws_calc[+]=13.123~15.123~3% # 28.246 %ws_calc[-]=%curval[45]%~%curval[35]%~2% # gusts - wind = difference in km/h --- The calcmem variable (%ws_calcmem[x]=memstart~memend~decimal places%) allows you to calculate stored values in one operation. The x stands for Addition + and mean 0. It is important to note that the set of memory variables (numbers for x, %ws_setmem[x]=a%) are contiguous, start and end are freely selectable. Instead of fixed numerical values ??(2.1, 3.2, 4.3 ...), sensor values and/or values can also be used from previously stored calculations. Examples: %ws_setmem[1]=2.1% %ws_setmem[2]=3.2% %ws_setmem[3]=4.3% %ws_setmem[4]=5.4% %ws_setmem[5]=6.5% %ws_calcmem[+]=1~5~1% # 21.5 %ws_calcmem[+]=2~4~2% # 12.90 %ws_calcmem[0]=1~5~1% # 4.0 %ws_calcmem[0]=2~4~2% # 4.30 --- Example calculation for snow conditions Calculation can be taken directly into a custom file (custom.txt). The icon used for it can be found under the following address - and copied into the html folder: http://www.woldegk-wetter.de/snowheight.jpg %unit_off% %ws_compare[1]=%snowheight%~0~~% %unit_on% Explanation for programming / calculation: %ws_compare[1]=%snowheight%~0~~