Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


System requirements

TwinCAT PLC Library: 太阳位置算法

系统要求

  • 编程环境：
    • XP, XPe;
    • TwinCAT 安装级别: TwinCAT PLC 或者更高;
    • TwinCAT 系统版本 2.10.0 build 1320 或者更高;
    • TcSPA.Lib 这个 PLC 库必须集成在 PLC 项目上。 所有其他的库会自动添加。 (Standard.Lib; TcMath.Lib; TcBaseMath.Lib; TcSystem.Lib; TcBase.Lib 自动集成)
  • 目标平台：
    • PC or CX (x86): XP, XPe, CE;
    • CX (ARM): CE (image v2.18 或更高);
    • Note: In 由于复杂的内部计算，在系统中没有浮点单元的性能是有限的。在异常的事件中周期时间应该被检查。I
    • TwinCAT PLC 运行系统平台2.10.0 build 1320 或者更高;


Copyright

TwinCAT PLC Library: 太阳位置算法

版权所有

该算法是基于国家可再生能源实验室(NREL)，美国 (2009-1-14修订版)I. Reda & A. Andreas,的“太阳位置算法在太阳能 辐射中的应用”的技术报告。

公告
版权所有(C) 2007 可持续能源联盟, 有限责任公司, 保留所有权利

这款计算机软件是由可持续能源联盟, 有限责任公司开发的，以下简称承包商，根据和能源部(DOE)签订的合同DE-AC36-08GO28308 (Contract)。美国政府一直给予自己和其它的关于它的代表一份缴足，这是非排他性的，不可撤销的，复制软件方面的许可，制作衍生品，并进行公开的展示和演示。Beginning
five (5) years after the date permission to assert copyright is obtained from the DOE, and
subject to any subsequent five (5) year renewals, the United States Government is granted
for itself and others acting on its behalf a paid-up, non-exclusive, irrevocable, worldwide
license in the Software to reproduce, prepare derivative works, distribute copies to the
public, perform publicly and display publicly, and to permit others to do so. If the
Contractor ceases to make this computer software available, it may be obtained from DOE's
Office of Scientific and Technical Information's Energy Science and Technology Software Center
(ESTSC) at P.O.Box 62, 1 Science Gov Way, Oak Ridge, TN 37831-1020. THIS SOFTWARE IS PROVIDED
BY THE CONTRACTOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE CONTRACTOR OR THE U.S. GOVERNMENT BE LIABLE FOR ANY SPECIAL, INDIRECT
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER, INCLUDING BUT NOT LIMITED TO CLAIMS
ASSOCIATED WITH THE LOSS OF DATA OR PROFITS, WHICH MAY RESULT FROM AN ACTION IN CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS CLAIM THAT ARISES OUT OF OR IN CONNECTION WITH THE ACCESS, USE
OR PERFORMANCE OF THIS SOFTWARE.


F_GetVersionTcSPA

这个函数可以用来读取PLC库的版本信息。

FUNCTION F_GetVersionTcSPA: UINT

VAR_INPUT
    nVersionElement : INT;
END_VAR

nVersionElement : Version 元素被读取。可能的参数：

  • 1 : 主设备号;
  • 2 : 次设备号;
  • 3 : 修订号;

开发环境 | 目标平台 | 需要连接的PLC库
TwinCAT v2.10 build >= 1320 | PC or CX (x86, ARM) | TcSPA.Lib


ST_SPA_TIMESTRUCT

TYPE ST_SPA_TIMESTRUCT :
STRUCT
    iYear		:INT(-2000..6000);	(* 4-digit year, valid range: -2000 TO 6000, error code: 1	*)
    iMonth		:INT(1..12); 	(* 2-digit month, valid range: 1 to 12 (Jan.= 1), error code: 2	*)
    iDay		:INT(1..31);	(* 2-digit day, valid range: 1 to 31, error code: 3		*)
    iHour		:INT(0..24); 	(* Observer local hour, valid range: 0 to 24, error code: 4	*)
    iMinute		:INT(0..59); 	(* Observer local minute, valid range: 0 to 59, error code: 5	*)
    iSecond		:INT(0..59);	(* Observer local second, valid range: 0 TO 59, error code: 6	*)
END_STRUCT
END_TYPE

ST_SPA_TIMESTRUCT 的结构包括日期和时间的信息。它是在输入端用在 FB_SPA功能块为了指定该位置的本地时间。此本地时间的最小单位是秒。

各种时间尺度都在使用。通用时 (UT1) 用于基于在ST_SPA_TIMESTRUCT指定的时间的太阳位置计算。如果对太阳角来说误差为+/-0.005°是可以接受的，那么世界协调时 (UTC) 就可以作为计算时间。 解释性说明可以在概述页面找到。


E_SPA_FunctionCode

TYPE E_SPA_FunctionCode :(
(* enumeration for function codes to select desired final outputs from SPA *)
    eSPA_ZA, 			(*calculate zenith AND azimuth		[default setting]	*)
    eSPA_ZA_INC,		(*calculate zenith, azimuth, AND incidence			*)
    eSPA_ZA_RTS,		(*calculate zenith, azimuth, AND sun rise/transit/set values	*)
    eSPA_ALL			(*calculate all SPA output values				*)
);
END_TYPE

枚举E_SPA_FunctionCode s 定义了可以被功能块FB_SPA执行的不同函数的常量。除了太阳的角度，视选择而定，日出和日落的时间也可以被计算。 此术语的一个详细解释可以在概述页面找到。

eSPA_ZA : 如果函数的代码eSPA_ZAIf被唯一选择计算太阳角(顶角, 方位角, azimuth180) [DEFAULT]。

eSPA_ZA_INC : 除了太阳角，入射角也是从有关的指定表面发出的。

eSPA_ZA_RTS : 除了太阳角，日出，太阳顶点和日落都是可以被计算的。

eSPA_ALL : 所有提供的数据被计算，并在输出端显示。

注意：为计算所需的时间在很大程度上取决于所选择的函数代码。


E_SPA_ErrorCode

TYPE E_SPA_ErrorCode :(
(* enumeration for error codes returned as iErrorCode output of FB_SPA
////////////////////////////////////////////////////////////////////////
//   Note: A non-zero return error code indicates that one of the     //
//         input values did not pass simple bounds tests.             //
//////////////////////////////////////////////////////////////////////// *)
    eSPA_ERR_NoError			:= 0,
    eSPA_ERR_InvalidYear,
    eSPA_ERR_InvalidMonth,
    eSPA_ERR_InvalidDay,
    eSPA_ERR_InvalidHour,
    eSPA_ERR_InvalidMinute,
    eSPA_ERR_InvalidSecond,
    eSPA_ERR_InvalidDeltaT,
    eSPA_ERR_InvalidTimezone,
    eSPA_ERR_InvalidLongitude,
    eSPA_ERR_InvalidLatitude,
    eSPA_ERR_InvalidElevation,
    eSPA_ERR_InvalidPressure,
    eSPA_ERR_InvalidTemperature,
    eSPA_ERR_InvalidSlope,
    eSPA_ERR_InvalidAZMRotation,
    eSPA_ERR_InvalidAtmosRefract,
    eSPA_ERR_InvalidFunctionCode
);
END_TYPE

枚举 E_SPA_ErrorCode 定义了对可能在库中通常出现的不同错误的常量。

这些值可以在表示PLC SPA功能块FB_SPA在一个错误事件中输出端的相关的整数值的输出变量 iErrorCode 中再次发现。