Commit 977f565e authored by Claes Sjofors's avatar Claes Sjofors

IO libnodave for Siemens PLC added

parent c1b0bc4c
/*
Part of Libnodave, a free communication libray for Siemens S7 300/400.
(C) Thomas Hergenhahn (thomas.hergenhahn@web.de) 2002, 2003.2004
Libnodave is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Libnodave is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libnodave; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef opensocket__
#define opensocket__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BCCWIN
#ifdef DOEXPORT
#define EXPORTSPEC __declspec (dllexport)
#else
#define EXPORTSPEC __declspec (dllimport)
#endif
EXPORTSPEC HANDLE __stdcall openSocket(const int port, const char * peer);
EXPORTSPEC int __stdcall closeSocket(HANDLE h);
#endif
#ifdef LINUX
#define EXPORTSPEC
int openSocket(const int port, const char * peer);
int closeSocket(int h);
#endif
#ifdef __cplusplus
}
#endif
#endif //opensocket__
/*
Changes:
07/12/03 moved openSocket to it's own file, because it can be reused in other TCP clients
04/07/04 ported C++ version to C
12/17/04 additonal defines for WIN32
04/09/05 removed CYGWIN defines. As there were no more differences against LINUX, it should
work with LINUX defines.
Version 0.8.4.5
07/10/09 Added closeSocket()
*/
......@@ -23,7 +23,7 @@ all : init copy lib
init :
copy : $(inc_dir)/libusbio.h $(inc_dir)/pwr_arduino_uno.pde
copy : $(inc_dir)/libusbio.h $(inc_dir)/openSocket.h $(inc_dir)/setport.h $(inc_dir)/pwr_arduino_uno.pde
lib :
......@@ -43,6 +43,14 @@ $(inc_dir)/libusbio.h : ../../libusbio.h
@ echo "Copying libusbio.h"
@ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/openSocket.h : ../../openSocket.h
@ echo "Copying openSocket.h"
@ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/setport.h : ../../setport.h
@ echo "Copying setport.h"
@ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/pwr_arduino_uno.pde : ../../pwr_arduino_uno.pde
@ echo "Copying pwr_arduino_uno.pde"
@ $(cp) $(cpflags) $(source) $(target)
......
/*
Part of Libnodave, a free communication libray for Siemens S7 300/400.
(C) Thomas Hergenhahn (thomas.hergenhahn@web.de) 2001.
Libnodave is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Libnodave is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libnodave; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef setport__
#define setport__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BCCWIN
#ifdef DOEXPORT
#define EXPORTSPEC __declspec (dllexport)
#else
#define EXPORTSPEC __declspec (dllimport)
#endif
EXPORTSPEC HANDLE __stdcall setPort(char * name, char* baud,char parity);
EXPORTSPEC int __stdcall closePort(HANDLE port);
#endif
#ifdef LINUX
int setPort(char * name, char* baud, char parity);
int closePort(int port);
#endif
#ifdef __cplusplus
}
#endif
#endif // setport__
/*
01/08/07 Put __cplusplus directive as where suggested by Keith Harrison.
*/
/*
Dummy for libnodave
*/
#include <stdint.h>
#define DECL2
#define EXPORTSPEC
typedef void * _daveOSserialType;
typedef void * daveInterface;
typedef void * daveConnection;
int openSocket(const int port, const char * peer) { return -1;}
int closeSocket(int h) { return -1;}
int setPort(char * name, char* baud, char parity) { return -1;}
int closePort(int port) { return -1;}
EXPORTSPEC int DECL2 daveInitAdapter(daveInterface * di) { return -1;}
EXPORTSPEC int DECL2 daveConnectPLC(daveConnection * dc) { return -1;}
EXPORTSPEC int DECL2 daveDisconnectPLC(daveConnection * dc) { return -1;}
EXPORTSPEC int DECL2 daveDisconnectAdapter(daveInterface * di) { return -1;}
EXPORTSPEC int DECL2 daveListReachablePartners(daveInterface * di, char * buf) { return -1;}
EXPORTSPEC daveInterface * DECL2 daveNewInterface(_daveOSserialType nfd, char * nname, int localMPI, int protocol, int speed) { return 0;}
EXPORTSPEC daveConnection * DECL2 daveNewConnection(daveInterface * di, int MPI,int rack, int slot) { return 0;}
EXPORTSPEC int DECL2 daveReadBytes(daveConnection * dc, int area, int DB, int start, int len, void * buffer) { return -1;}
EXPORTSPEC int DECL2 daveWriteBytes(daveConnection * dc,int area, int DB, int start, int len, void * buffer) { return -1;}
EXPORTSPEC char * DECL2 daveStrerror(int code) {
static char r[] = "Not build with libnodave";
return r;
}
EXPORTSPEC void DECL2 daveSetTimeout(daveInterface * di, int tmo) {}
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
/* ra_io_m_motioncontrol_usb.h -- I/O methods for class MotionControl_USBIO. */
/* ra_io_m_gpio.h -- I/O methods for GPIO. */
#ifndef ra_io_m_gpio_h
#define ra_io_m_gpio_h
#ifndef rt_io_m_gpio_h
#define rt_io_m_gpio_h
#define GPIO_MAX_CHANNELS 32
......
/* ra_io_m_motioncontrol_usb.h -- I/O methods for class MotionControl_USBIO. */
/* rt_io_m_motioncontrol_usb.h -- I/O methods for class MotionControl_USBIO. */
#ifndef ra_io_m_motioncontrol_usb_h
#define ra_io_m_motioncontrol_usb_h
#ifndef rt_io_m_motioncontrol_usb_h
#define rt_io_m_motioncontrol_usb_h
#define USB_MAX_CARDS 50
......
/* ra_io_m_nodave.h -- I/O methods for libnodave. */
#ifndef rt_io_m_nodave_h
#define rt_io_m_nodave_h
typedef struct {
_daveOSserialType fds;
daveInterface *di;
daveConnection *dc;
int status;
int reset_inputs;
char *input_area;
char *output_area;
unsigned int input_size;
unsigned int output_size;
} io_sRackLocal;
typedef struct {
int status;
int interval_cnt;
int has_read_method;
unsigned int input_size;
unsigned int output_size;
int op_read;
int op_write;
char *input_area;
char *output_area;
} io_sCardLocal;
#endif
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_nodave_plc.c -- io methods for a libnodave PLC
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <float.h>
#include "pwr.h"
#include "co_cdh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_gdh.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "rt_io_rack_init.h"
#include "rt_io_rack_close.h"
#include "rt_io_rack_read.h"
#include "rt_io_rack_write.h"
#include "rt_errh.h"
#include "co_cdh.h"
#include "co_time.h"
#if defined PWRE_CONF_NODAVE
#if defined OS_LINUX
#define LINUX
#endif
#include "nodave.h"
#include "openSocket.h"
#include "setport.h"
#include "rt_io_m_nodave.h"
/*----------------------------------------------------------------------------*\
Init method for the libnodave PLC
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
io_sRackLocal *local;
pwr_sClass_Nodave_PLC *op = (pwr_sClass_Nodave_PLC *)rp->op;
pwr_tObjName name;
int sts;
int speed;
int protocol;
int res;
io_sCard *cardp;
pwr_tCid cid;
io_sCardLocal *local_card;
sts = gdh_ObjidToName( rp->Objid, name, sizeof(name), cdh_mName_object);
if ( EVEN(sts)) return sts;
/* Allocate area for local data structure */
rp->Local = calloc(1, sizeof(io_sRackLocal));
local = rp->Local;
if ( op->Connection == pwr_eNodave_ConnectionEnum_Serial) {
/* Serial connection */
char serial_parity;
char serial_speed[40];
switch ( op->SerialParity) {
case pwr_eParityEnum_None:
serial_parity = 'N';
break;
case pwr_eParityEnum_Odd:
serial_parity = 'O';
break;
case pwr_eParityEnum_Even:
serial_parity = 'E';
break;
}
snprintf( serial_speed, sizeof(serial_speed), "%d", op->SerialSpeed);
local->fds.rfd = setPort( op->SerialDevice, serial_speed, serial_parity);
if ( local->fds.rfd <= 0) {
errh_Error( "Nodave PLC, open device error, %s", rp->Name);
strcpy( op->Status, "No such device");
return IO__ERRINIDEVICE;
}
}
else {
/* TCP connection */
local->fds.rfd = openSocket( op->Port, op->IP_Address);
local->fds.wfd = local->fds.rfd;
if ( local->fds.rfd <= 0) {
errh_Error( "Nodave PLC, open socket error, %s", rp->Name);
return IO__ERRINIDEVICE;
}
}
switch ( op->Protocol) {
case pwr_eNodave_ProtocolEnum_MPI:
protocol = daveProtoMPI;
break;
case pwr_eNodave_ProtocolEnum_MPI2:
protocol = daveProtoMPI2;
break;
case pwr_eNodave_ProtocolEnum_MPI3:
protocol = daveProtoMPI3;
break;
case pwr_eNodave_ProtocolEnum_MPI4:
protocol = daveProtoMPI4;
break;
case pwr_eNodave_ProtocolEnum_PPI:
protocol = daveProtoPPI;
break;
case pwr_eNodave_ProtocolEnum_AS511:
protocol = daveProtoAS511;
break;
case pwr_eNodave_ProtocolEnum_S7online:
protocol = daveProtoS7online;
break;
case pwr_eNodave_ProtocolEnum_ISOTCP:
protocol = daveProtoISOTCP;
break;
case pwr_eNodave_ProtocolEnum_ISOTCP243:
protocol = daveProtoISOTCP243;
break;
case pwr_eNodave_ProtocolEnum_ISOTCPR:
protocol = daveProtoISOTCPR;
break;
case pwr_eNodave_ProtocolEnum_MPI_IBH:
protocol = daveProtoMPI_IBH;
break;
case pwr_eNodave_ProtocolEnum_PPI_IBH:
protocol = daveProtoPPI_IBH;
break;
case pwr_eNodave_ProtocolEnum_UserTransport:
protocol = daveProtoUserTransport;
break;
}
switch ( op->Speed) {
case pwr_eNodave_SpeedEnum_9k:
speed = daveSpeed9k;
break;
case pwr_eNodave_SpeedEnum_19k:
speed = daveSpeed19k;
break;
case pwr_eNodave_SpeedEnum_187k:
speed = daveSpeed187k;
break;
case pwr_eNodave_SpeedEnum_500k:
speed = daveSpeed500k;
break;
case pwr_eNodave_SpeedEnum_1500k:
speed = daveSpeed1500k;
break;
case pwr_eNodave_SpeedEnum_45k:
speed = daveSpeed45k;
break;
case pwr_eNodave_SpeedEnum_93k:
speed = daveSpeed93k;
break;
}
local->di = daveNewInterface( local->fds, name, op->MPI_Local, protocol, speed);
res = daveInitAdapter( local->di);
if ( res != 0) {
errh_Error( "Nodave PLC, new interface error, %s, %s", daveStrerror(res), rp->Name);
strncpy( op->Status, daveStrerror(res), sizeof(op->Status));
local->status = IO__ERRINIDEVICE;
return IO__ERRINIDEVICE;
}
local->dc = daveNewConnection( local->di, op->MPI_Address, op->Rack, op->Slot);
res = daveConnectPLC( local->dc);
if ( res != 0) {
errh_Error( "Nodave PLC, new interface error, %s, %s", daveStrerror(res), rp->Name);
strncpy( op->Status, daveStrerror(res), sizeof(op->Status));
local->status = IO__ERRINIDEVICE;
return IO__ERRINIDEVICE;
}
if ( op->Timeout > FLT_EPSILON)
daveSetTimeout( local->di, op->Timeout * 1000000);
/* Do configuration check and initialize modules. */
unsigned int prev_input_area_offset = 0;
unsigned int prev_output_area_offset = 0;
unsigned int input_area_offset = 0;
unsigned int output_area_offset = 0;
unsigned int input_area_chansize = 0;
unsigned int output_area_chansize = 0;
/* Calculate total input and output area size */
cardp = rp->cardlist;
while(cardp) {
cid = cardp->Class;
/* Find the super class */
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Nodave_Transaction: {
io_bus_card_init( ctx, cardp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize,
op->ByteOrdering);
break;
}
}
cardp = cardp->next;
}
local->input_size = input_area_offset + input_area_chansize;
local->output_size = output_area_offset + output_area_chansize;
local->input_area = calloc( 1, local->input_size);
local->output_area = calloc( 1, local->output_size);
/* Initialize transactions */
prev_input_area_offset = 0;
prev_output_area_offset = 0;
input_area_offset = 0;
output_area_offset = 0;
input_area_chansize = 0;
output_area_chansize = 0;
cardp = rp->cardlist;
while(cardp) {
local_card = calloc(1, sizeof(*local_card));
cid = cardp->Class;
/* Find the super class */
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Nodave_Transaction: {
pwr_sClass_Nodave_Transaction *tp;
cardp->Local = local_card;
local_card->input_area = local->input_area + input_area_offset +
input_area_chansize;
local_card->output_area = local->output_area + output_area_offset +
output_area_chansize;
tp = (pwr_sClass_Nodave_Transaction *) cardp->op;
strcpy( tp->Status, "Starting...");
io_bus_card_init( ctx, cardp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize,
op->ByteOrdering);
local_card->input_size = input_area_offset + input_area_chansize -
prev_input_area_offset;
local_card->output_size = output_area_offset + output_area_chansize -
prev_output_area_offset;
break;
}
} /* End - switch ... */
prev_input_area_offset = input_area_offset + input_area_chansize;
prev_output_area_offset = output_area_offset + output_area_chansize;
cardp = cardp->next;
}
local->input_size = input_area_offset + input_area_chansize;
local->output_size = output_area_offset + output_area_chansize;
local->status = IO__SUCCESS;
strcpy( op->Status, "Running");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the libnodave PLC
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
io_sRackLocal *local = (io_sRackLocal *) rp->Local;
pwr_sClass_Nodave_PLC *op = (pwr_sClass_Nodave_PLC *)rp->op;
if ( op->Debug) {
int size = sizeof(op->Inputs);
if ( local->input_size < size)
size = local->input_size;
memcpy( op->Inputs, local->input_area, size);
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for nodave PLC
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
io_sRackLocal *local = (io_sRackLocal *) rp->Local;
pwr_sClass_Nodave_PLC *op = (pwr_sClass_Nodave_PLC *)rp->op;
if ( op->Debug) {
int size = sizeof(op->Outputs);
if ( local->output_size < size)
size = local->output_size;
memcpy( op->Outputs, local->output_area, size);
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackClose (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
io_sRackLocal *local = (io_sRackLocal *) rp->Local;
pwr_sClass_Nodave_PLC *op = (pwr_sClass_Nodave_PLC *)rp->op;
strcpy( op->Status, "Closed down");
if ( local->dc)
daveDisconnectPLC( local->dc);
if ( local->di)
daveDisconnectAdapter( local->di);
if ( local->fds.rfd)
closeSocket( local->fds.rfd);
if ( local->input_area)
free( local->input_area);
if ( local->output_area)
free( local->output_area);
free( local);
return IO__SUCCESS;
}
#else
static pwr_tStatus IoRackInit( io_tCtx ctx, io_sAgent *ap, io_sRack *rp) { return IO__RELEASEBUILD;}
static pwr_tStatus IoRackClose( io_tCtx ctx, io_sAgent *ap, io_sRack *rp) { return IO__RELEASEBUILD;}
static pwr_tStatus IoRackRead( io_tCtx ctx, io_sAgent *ap, io_sRack *rp) { return IO__RELEASEBUILD;}
static pwr_tStatus IoRackWrite( io_tCtx ctx, io_sAgent *ap, io_sRack *rp) { return IO__RELEASEBUILD;}
#endif
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Nodave_PLC) = {
pwr_BindIoMethod(IoRackInit),
pwr_BindIoMethod(IoRackRead),
pwr_BindIoMethod(IoRackWrite),
pwr_BindIoMethod(IoRackClose),
pwr_NullMethod
};
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#if defined PWRE_CONF_NODAVE
#if defined OS_LINUX
#define LINUX
#endif
#include "nodave.h"
#include "rt_io_m_nodave.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_Nodave_Transaction *op;
op = (pwr_sClass_Nodave_Transaction *) cp->op;
local = (io_sCardLocal *) cp->Local;
local->interval_cnt = 0;
local->status = 1;
strcpy( op->Status, "Initialized");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for libnodave transaction
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local = (io_sCardLocal *) cp->Local;
io_sRackLocal *local_rack = (io_sRackLocal *)rp->Local;
pwr_sClass_Nodave_Transaction *op = (pwr_sClass_Nodave_Transaction *) cp->op;
pwr_sClass_Nodave_PLC *plcp = (pwr_sClass_Nodave_PLC *) rp->op;
int res;
if ( op->Continous == pwr_eYesNoEnum_No) {
/* Only read if triggered by op */
if ( !op->SendOp)
return IO__SUCCESS;
else if ( local->op_write) {
op->SendOp = 0;
local->op_read = 0;
local->op_write = 0;
}
else
local->op_read = 1;
}
if ( local->input_size == 0)
return IO__SUCCESS;
if ( op->ScanInterval > 1) {
local->has_read_method = 1;
if ( local->interval_cnt != 0) {
local->interval_cnt++;
if ( local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
if (local_rack->status == IO__SUCCESS || local_rack->reset_inputs) {
if ( local_rack->reset_inputs)
memset( local->input_area, 0, local->input_size);
else {
res = daveReadBytes( local_rack->dc, op->Area, op->DataBlock, op->Address,
local->input_size, local->input_area);
if ( res != 0) {
strncpy( op->Status, daveStrerror(res), sizeof(op->Status));
plcp->ErrorCount++;
local->status = res;
if ( plcp->ErrorCount >= plcp->ErrorLimit) {
if ( plcp->StallAction == pwr_eStallActionEnum_ResetInputs) {
memset( local->input_area, 0, local->input_size);
local_rack->reset_inputs = 1;
}
else if ( plcp->StallAction == pwr_eStallActionEnum_EmergencyBreak) {
errh_Error( "IO Card ErrorLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
}
}
else if ( local->status != 0) {
strncpy( op->Status, "Success", sizeof(op->Status));
local->status = res;
}
}
if ( res == 0 || local_rack->reset_inputs)
io_bus_card_read(ctx, rp, cp, local->input_area, NULL, plcp->ByteOrdering,
plcp->FloatRepresentation);
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Nodave transaction
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local = (io_sCardLocal *) cp->Local;
io_sRackLocal *local_rack = (io_sRackLocal *)rp->Local;
pwr_sClass_Nodave_Transaction *op = (pwr_sClass_Nodave_Transaction *) cp->op;
pwr_sClass_Nodave_PLC *plcp = (pwr_sClass_Nodave_PLC *) rp->op;
int res;
if ( op->Continous == pwr_eYesNoEnum_No) {
/* Only write if triggered by op */
if ( !op->SendOp)
return IO__SUCCESS;
else if ( local->op_read) {
op->SendOp = 0;
local->op_read = 0;
local->op_write = 0;
}
else
local->op_write = 1;
}
if ( local->output_size == 0)
return IO__SUCCESS;
if ( op->ScanInterval > 1) {
if ( !local->has_read_method) {
if ( local->interval_cnt != 0) {
local->interval_cnt++;
if ( local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
else if ( local->interval_cnt != 1)
return IO__SUCCESS;
}
if ( local_rack->status == IO__SUCCESS) {
io_bus_card_write(ctx, cp, local->output_area, plcp->ByteOrdering,
plcp->FloatRepresentation);
res = daveWriteBytes( local_rack->dc, op->Area, op->DataBlock, op->Address,
local->output_size, local->output_area);
if ( res != 0) {
strncpy( op->Status, daveStrerror(res), sizeof(op->Status));
plcp->ErrorCount++;
local->status = res;
if ( plcp->ErrorCount >= plcp->ErrorLimit) {
if ( plcp->StallAction == pwr_eStallActionEnum_ResetInputs) {
local_rack->reset_inputs = 1;
}
else if ( plcp->StallAction == pwr_eStallActionEnum_EmergencyBreak) {
errh_Error( "IO Card ErrorLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
}
}
else if ( local->status != 0) {
strncpy( op->Status, "Success", sizeof(op->Status));
local->status = res;
}
}
return IO__SUCCESS;
}
#else
static pwr_tStatus IoCardInit( io_tCtx ctx, io_sAgent *ap) { return IO__RELEASEBUILD;}
static pwr_tStatus IoCardRead( io_tCtx ctx, io_sAgent *ap) { return IO__RELEASEBUILD;}
static pwr_tStatus IoCardWrite( io_tCtx ctx, io_sAgent *ap) { return IO__RELEASEBUILD;}
#endif
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Nodave_Transaction) = {
pwr_BindIoMethod(IoCardInit),
pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite),
pwr_NullMethod
};
......@@ -26,4 +26,6 @@ Hilscher_cifX_Module
USB_Joystick
UDP_IO
SPI_Slave
Nodave_PLC
Nodave_Transaction
#endif
\ No newline at end of file
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X308"
Attr NextCix = "_X36"
Attr NextTix[0] = "_X11"
Attr NextOix = "_X368"
Attr NextCix = "_X38"
Attr NextTix[0] = "_X15"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
Object MotionControl_StatusEnum $TypeDef 1 15-NOV-2007 14:36:24.17
......@@ -591,6 +591,306 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
EndObject
Object Nodave_ConnectionEnum $TypeDef 11 27-FEB-2012 10:37:06.88
Body SysBody 27-FEB-2012 10:37:19.64
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object Serial $Value 309 27-FEB-2012 10:37:34.18
Body SysBody 27-FEB-2012 10:37:36.12
Attr Text = "Serial"
Attr PgmName = "Serial"
EndBody
EndObject
Object TCP $Value 310 27-FEB-2012 10:37:46.23
Body SysBody 27-FEB-2012 10:37:49.39
Attr Text = "TCP"
Attr PgmName = "TCP"
Attr Value = 1
EndBody
EndObject
EndObject
Object Nodave_ProtocolEnum $TypeDef 12 27-FEB-2012 10:38:40.00
Body SysBody 27-FEB-2012 10:38:53.86
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object MPI $Value 311 27-FEB-2012 10:39:09.14
Body SysBody 27-FEB-2012 10:39:11.15
Attr Text = "MPI"
Attr PgmName = "MPI"
EndBody
EndObject
Object MPI2 $Value 312 27-FEB-2012 10:39:22.09
Body SysBody 27-FEB-2012 10:39:25.16
Attr Text = "MPI2"
Attr PgmName = "MPI2"
Attr Value = 1
EndBody
EndObject
Object MPI3 $Value 357 27-FEB-2012 15:29:51.18
Body SysBody 27-FEB-2012 15:33:12.92
Attr Text = "MPI3"
Attr PgmName = "MPI3"
Attr Value = 2
EndBody
EndObject
Object MPI4 $Value 356 27-FEB-2012 15:29:44.26
Body SysBody 27-FEB-2012 15:33:15.49
Attr Text = "MPI4"
Attr PgmName = "MPI4"
Attr Value = 3
EndBody
EndObject
Object PPI $Value 313 27-FEB-2012 10:39:37.92
Body SysBody 27-FEB-2012 15:33:21.00
Attr Text = "PPI"
Attr PgmName = "PPI"
Attr Value = 10
EndBody
EndObject
Object AS511 $Value 358 27-FEB-2012 15:30:19.12
Body SysBody 27-FEB-2012 15:33:28.07
Attr Text = "AS511"
Attr PgmName = "AS511"
Attr Value = 20
EndBody
EndObject
Object S7online $Value 359 27-FEB-2012 15:30:38.37
Body SysBody 27-FEB-2012 15:33:31.90
Attr Text = "S7online"
Attr PgmName = "S7online"
Attr Value = 50
EndBody
EndObject
Object ISOTCP $Value 314 27-FEB-2012 10:39:56.80
Body SysBody 27-FEB-2012 15:33:39.45
Attr Text = "ISOTCP"
Attr PgmName = "ISOTCP"
Attr Value = 122
EndBody
EndObject
Object ISOTCP243 $Value 315 27-FEB-2012 10:40:19.75
Body SysBody 27-FEB-2012 15:33:46.35
Attr Text = "ISOTCP243"
Attr PgmName = "ISOTCP243"
Attr Value = 123
EndBody
EndObject
Object ISOTCPR $Value 360 27-FEB-2012 15:31:04.25
Body SysBody 27-FEB-2012 15:33:55.33
Attr Text = "ISOTCPR"
Attr PgmName = "ISOTCPR"
Attr Value = 124
EndBody
EndObject
Object MPI_IBH $Value 316 27-FEB-2012 15:31:22.97
Body SysBody 27-FEB-2012 15:34:05.10
Attr Text = "MPI_IBH"
Attr PgmName = "MPI_IBH"
Attr Value = 223
EndBody
EndObject
Object PPI_IBH $Value 361 27-FEB-2012 15:31:43.04
Body SysBody 27-FEB-2012 15:34:09.73
Attr Text = "PPI_IBH"
Attr PgmName = "PPI_IBH"
Attr Value = 224
EndBody
EndObject
Object NLpro $Value 362 27-FEB-2012 15:32:03.99
Body SysBody 27-FEB-2012 15:34:16.98
Attr Text = "NLpro"
Attr PgmName = "NLpro"
Attr Value = 230
EndBody
EndObject
Object UserTransport $Value 363 27-FEB-2012 15:32:20.58
Body SysBody 27-FEB-2012 15:34:24.34
Attr Text = "UserTransport"
Attr PgmName = "UserTransport"
Attr Value = 255
EndBody
EndObject
EndObject
Object Nodave_SpeedEnum $TypeDef 13 27-FEB-2012 11:02:15.62
Body SysBody 27-FEB-2012 10:41:49.42
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object 9k $Value 317 27-FEB-2012 10:42:03.76
Body SysBody 27-FEB-2012 10:42:05.53
Attr Text = "9k"
Attr PgmName = "9k"
EndBody
EndObject
Object 19k $Value 318 27-FEB-2012 10:42:20.99
Body SysBody 27-FEB-2012 10:42:23.47
Attr Text = "19k"
Attr PgmName = "19k"
Attr Value = 1
EndBody
EndObject
Object 187k $Value 319 27-FEB-2012 10:42:33.41
Body SysBody 27-FEB-2012 10:42:40.19
Attr Text = "187k"
Attr PgmName = "187k"
Attr Value = 2
EndBody
EndObject
Object 500k $Value 320 27-FEB-2012 10:42:51.40
Body SysBody 27-FEB-2012 10:43:01.02
Attr Text = "500k"
Attr PgmName = "500k"
Attr Value = 3
EndBody
EndObject
Object 1500k $Value 321 27-FEB-2012 10:43:09.53
Body SysBody 27-FEB-2012 10:43:18.32
Attr Text = "1500k"
Attr PgmName = "1500k"
Attr Value = 4
EndBody
EndObject
Object 45k $Value 322 27-FEB-2012 10:43:27.52
Body SysBody 27-FEB-2012 10:43:38.61
Attr Text = "45k"
Attr PgmName = "45k"
Attr Value = 5
EndBody
EndObject
Object 93k $Value 323 27-FEB-2012 10:43:59.04
Body SysBody 27-FEB-2012 10:44:02.36
Attr Text = "93k"
Attr PgmName = "93k"
Attr Value = 6
EndBody
EndObject
EndObject
Object Nodave_AreaEnum $TypeDef 14 27-FEB-2012 11:02:22.46
Body SysBody 27-FEB-2012 10:45:05.66
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object SysInfo $Value 332 27-FEB-2012 15:39:57.16
Body SysBody 27-FEB-2012 15:42:11.44
Attr Text = "SysInfo"
Attr PgmName = "SysInfo"
Attr Value = 3
EndBody
EndObject
Object SysFlags $Value 333 27-FEB-2012 15:40:01.47
Body SysBody 27-FEB-2012 15:42:16.06
Attr Text = "SysFlags"
Attr PgmName = "SysFlags"
Attr Value = 5
EndBody
EndObject
Object AnaIn $Value 334 27-FEB-2012 15:40:07.25
Body SysBody 27-FEB-2012 15:42:19.86
Attr Text = "AnaIn"
Attr PgmName = "AnaIn"
Attr Value = 6
EndBody
EndObject
Object AnaOut $Value 335 27-FEB-2012 15:40:10.37
Body SysBody 27-FEB-2012 15:42:23.85
Attr Text = "AnaOut"
Attr PgmName = "AnaOut"
Attr Value = 7
EndBody
EndObject
Object P $Value 331 27-FEB-2012 15:40:16.29
Body SysBody 27-FEB-2012 15:42:49.20
Attr Text = "P"
Attr PgmName = "P"
Attr Value = 128
EndBody
EndObject
Object Inputs $Value 327 27-FEB-2012 15:40:21.19
Body SysBody 27-FEB-2012 15:42:56.17
Attr Text = "Inputs"
Attr PgmName = "Inputs"
Attr Value = 129
EndBody
EndObject
Object Outputs $Value 328 27-FEB-2012 15:40:23.03
Body SysBody 27-FEB-2012 15:43:00.10
Attr Text = "Outputs"
Attr PgmName = "Outputs"
Attr Value = 130
EndBody
EndObject
Object Flags $Value 326 27-FEB-2012 15:40:33.51
Body SysBody 27-FEB-2012 15:43:05.27
Attr Text = "Flags"
Attr PgmName = "Flags"
Attr Value = 131
EndBody
EndObject
Object DB $Value 325 27-FEB-2012 10:45:43.55
Body SysBody 27-FEB-2012 15:43:11.49
Attr Text = "DB"
Attr PgmName = "DB"
Attr Value = 132
EndBody
EndObject
Object DI $Value 364 27-FEB-2012 15:40:52.35
Body SysBody 27-FEB-2012 15:43:20.09
Attr Text = "DI"
Attr PgmName = "DI"
Attr Value = 133
EndBody
EndObject
Object Local $Value 365 27-FEB-2012 15:41:04.18
Body SysBody 27-FEB-2012 15:43:24.26
Attr Text = "Local"
Attr PgmName = "Local"
Attr Value = 134
EndBody
EndObject
Object V $Value 366 27-FEB-2012 15:41:13.31
Body SysBody 27-FEB-2012 15:43:33.17
Attr Text = "V"
Attr PgmName = "V"
Attr Value = 135
EndBody
EndObject
Object Counter $Value 330 27-FEB-2012 15:41:22.03
Body SysBody 27-FEB-2012 15:43:41.50
Attr Text = "Counter"
Attr PgmName = "Counter"
Attr Value = 28
EndBody
EndObject
Object Timer $Value 329 27-FEB-2012 10:46:27.15
Body SysBody 27-FEB-2012 15:43:45.21
Attr Text = "Timer"
Attr PgmName = "Timer"
Attr Value = 29
EndBody
EndObject
Object Counter200 $Value 337 27-FEB-2012 15:41:28.81
Body SysBody 27-FEB-2012 15:43:50.97
Attr Text = "Counter200"
Attr PgmName = "Counter200"
Attr Value = 30
EndBody
EndObject
Object Timer200 $Value 336 27-FEB-2012 10:49:10.43
Body SysBody 27-FEB-2012 15:43:54.13
Attr Text = "Timer200"
Attr PgmName = "Timer200"
Attr Value = 31
EndBody
EndObject
Object RawMemory $Value 368 27-FEB-2012 15:42:02.81
Body SysBody 27-FEB-2012 15:42:04.21
Attr Text = "RawMemory"
Attr PgmName = "RawMemory"
EndBody
EndObject
EndObject
EndObject
Object Class $ClassHier 2 15-NOV-2007 14:35:40.72
!/**
......@@ -2112,7 +2412,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
! Parity of the serial port.
!*/
Object Parity $Attribute 11 18-OCT-2011 11:09:38.47
Body SysBody 18-OCT-2011 11:10:12.61
Body SysBody 27-FEB-2012 10:57:54.49
Attr PgmName = "Parity"
Attr TypeRef = "pwrb:Type-ParityEnum"
EndBody
......@@ -6316,5 +6616,557 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
EndObject
!/**
! @Version 1.0
! @Group IO
! @Summary Rack object for libnodave connection to Siemens PLC.
! Rack object for libnodave connection to Siemens PLC.
!
! This object is placed below the Node object in the node hierarchy
! and specifies a connection to a PLC.
!
! Below this read and write transactions are configured by
! Nodave_Transaction objects.
!
! @b See also
! @classlink Nodave_Transaction otherio_nodave_transaction.html
!*/
Object Nodave_PLC $ClassDef 36 27-FEB-2012 10:52:15.43
Body SysBody 27-FEB-2012 11:05:42.83
Attr Editor = 0
Attr Method = 0
Attr Flags = 43088
EndBody
Object RtBody $ObjBodyDef 1 27-FEB-2012 10:52:30.36
Body SysBody 27-FEB-2012 10:52:30.36
Attr StructName = "Nodave_PLC"
Attr NextAix = "_X27"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 2 27-FEB-2012 10:54:34.29
Body SysBody 27-FEB-2012 10:54:34.29
Attr PgmName = "Description"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Current status.
!*/
Object Status $Attribute 12 28-FEB-2012 08:50:54.98
Body SysBody 27-FEB-2012 13:25:54.45
Attr PgmName = "Status"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! @Summary Process that handles the module. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the module.
!
! 1: The module is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The module is read by the rt_io_comm process.
! 4: The module is handled by an application program.
!*/
Object Process $Attribute 3 27-FEB-2012 10:54:34.29
Body SysBody 27-FEB-2012 10:54:34.29
Attr PgmName = "Process"
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
!/**
! @Summary Plc thread that handles the card.
! The PlcThread object of the plc thread that handles the card.
! The card is read with the scantime of the thread.
!*/
Object ThreadObject $Attribute 4 27-FEB-2012 10:54:34.29
Body SysBody 27-FEB-2012 10:54:34.29
Attr PgmName = "ThreadObject"
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! Type of connection, serial or TCP.
!*/
Object Connection $Attribute 1 27-FEB-2012 10:54:53.89
Body SysBody 27-FEB-2012 10:55:22.28
Attr PgmName = "Connection"
Attr TypeRef = "OtherIO:Type-Nodave_ConnectionEnum"
EndBody
EndObject
!/**
! Serial device.
! Only valid for serial connections.
!*/
Object SerialDevice $Attribute 5 27-FEB-2012 10:55:47.87
Body SysBody 27-FEB-2012 10:56:00.85
Attr PgmName = "SerialDevice"
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! Baudrate of the serial port.
! Only valid for serial connections.
!*/
Object SerialSpeed $Attribute 6 27-FEB-2012 10:56:24.61
Body SysBody 27-FEB-2012 10:56:47.23
Attr PgmName = "SerialSpeed"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Parity of the serial port.
! Only valid for serial connections.
!*/
Object SerialParity $Attribute 7 27-FEB-2012 10:57:02.36
Body SysBody 27-FEB-2012 10:58:03.88
Attr PgmName = "SerialParity"
Attr TypeRef = "pwrb:Type-ParityEnum"
EndBody
EndObject
!/**
! Port number for TCP connection, usually 102 for ISO over TCP or 1099 for the
! IBH/MHJ NetLink protocol.
! Only valid for TCP connections.
!*/
Object Port $Attribute 8 27-FEB-2012 10:58:23.89
Body SysBody 27-FEB-2012 10:58:28.52
Attr PgmName = "Port"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! IP address for TCP connection.
! Only valid for TCP connections.
!*/
Object IP_Address $Attribute 9 27-FEB-2012 10:58:40.12
Body SysBody 27-FEB-2012 10:59:40.59
Attr PgmName = "IP_Address"
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! @Summary Protocol type.
! Protocol type.
! MPI MPI for S7 300/400
! MPI2 MPI for S7 300/400, "Andrew's version" without STX
! MPI3 MPI for S7 300/400, Step 7 Version, not yet implemented
! MPI4 MPI for S7 300/400, "Andrew's version" with STX
! PPI PPI for S7 200
! AS511 S5 programming port protocol
! S7online -
! ISOTCP ISO over TCP
! ISOTCP243 ISO over TCP with CP243
! ISOTCPR ISO over TCP with Routing
! MPI_IBH MPI with IBH NetLink MPI to ethernet gateway
! PPI_IBH PPI with IBH NetLink PPI to ethernet gateway
! NLpro MPI with NetLink Pro MPI to ethernet gateway
! UserTransport Libnodave will pass the PDUs of S7 Communication to user
!*/
Object Protocol $Attribute 10 27-FEB-2012 11:00:54.94
Body SysBody 27-FEB-2012 11:01:10.58
Attr PgmName = "Protocol"
Attr TypeRef = "OtherIO:Type-Nodave_ProtocolEnum"
EndBody
EndObject
!/**
! Speed used by the interface.
! Only valid for MPI and PPI.
!*/
Object Speed $Attribute 11 27-FEB-2012 11:01:25.21
Body SysBody 27-FEB-2012 11:02:50.69
Attr PgmName = "Speed"
Attr TypeRef = "OtherIO:Type-Nodave_SpeedEnum"
EndBody
EndObject
!/**
! MPI address of the PLC.
!*/
Object MPI_Address $Attribute 16 27-FEB-2012 11:24:22.58
Body SysBody 27-FEB-2012 11:27:11.83
Attr PgmName = "MPI_Address"
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! MPI address used by the Proview node.
!*/
Object MPI_Local $Attribute 22 27-FEB-2012 16:05:07.48
Body SysBody 27-FEB-2012 16:05:07.48
Attr PgmName = "MPI_Local"
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Rack number for the PLC.
!*/
Object Rack $Attribute 17 27-FEB-2012 11:27:47.91
Body SysBody 27-FEB-2012 11:27:52.50
Attr PgmName = "Rack"
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Slot number for the PLC.
!*/
Object Slot $Attribute 18 27-FEB-2012 11:27:56.30
Body SysBody 27-FEB-2012 11:28:02.01
Attr PgmName = "Slot"
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Byte ordering for PLC.
! Usually big endian.
!*/
Object ByteOrdering $Attribute 19 27-FEB-2012 13:22:36.34
Body SysBody 27-FEB-2012 13:22:36.34
Attr PgmName = "ByteOrdering"
Attr TypeRef = "pwrb:Type-ByteOrderingEnum"
EndBody
EndObject
!/**
! Float representation for PLC.
!*/
Object FloatRepresentation $Attribute 23 28-FEB-2012 08:57:55.13
Body SysBody 28-FEB-2012 08:57:55.13
Attr PgmName = "FloatRepresentation"
Attr TypeRef = "pwrb:Type-FloatRepEnum"
EndBody
EndObject
!/**
! Timeout for communication in seconds.
!*/
Object Timeout $Attribute 20 27-FEB-2012 13:24:57.87
Body SysBody 27-FEB-2012 13:25:25.02
Attr PgmName = "Timeout"
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Specifies the action when the errorcounter has reached the error limit.
!
! No no action.
! Reset inputs the inputs for the slave are reset.
! Emergency break all I/O is stopped.
!*/
Object StallAction $Attribute 13 27-FEB-2012 11:04:38.73
Body SysBody 27-FEB-2012 11:04:27.83
Attr PgmName = "StallAction"
Attr TypeRef = "pwrb:Type-StallActionEnum"
EndBody
EndObject
!/**
! @Summary Error count for the connection.
! Error count for the connection.
! When ErrorCount reaches the ErrorLimit the action in StallAction is executed.
!*/
Object ErrorCount $Attribute 14 27-FEB-2012 11:04:27.83
Body SysBody 27-FEB-2012 16:04:40.30
Attr PgmName = "ErrorCount"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! @Summary Error limit of the connection.
! Error limit of the connection.
! When ErrorCount reaches the ErrorLimit the action in StallAction is exectued.
!*/
Object ErrorLimit $Attribute 15 27-FEB-2012 11:04:27.83
Body SysBody 27-FEB-2012 16:04:44.77
Attr PgmName = "ErrorLimit"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! View read and write values in the Inputs and Outputs areas.
!*/
Object Debug $Attribute 24 28-FEB-2012 13:43:24.06
Body SysBody 28-FEB-2012 13:43:25.34
Attr PgmName = "Debug"
Attr Flags = 16777216
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Inputs $Attribute 25 28-FEB-2012 13:43:38.60
Body SysBody 28-FEB-2012 13:44:39.78
Attr PgmName = "Inputs"
Attr Flags = 16779282
Attr Elements = 200
Attr TypeRef = "pwrs:Type-$UInt8"
EndBody
EndObject
Object Outputs $Attribute 26 28-FEB-2012 13:44:12.16
Body SysBody 28-FEB-2012 13:44:30.91
Attr PgmName = "Outputs"
Attr Flags = 16779282
Attr Elements = 200
Attr TypeRef = "pwrs:Type-$UInt8"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 347 27-FEB-2012 11:17:37.94
Object IoRackInit $Method 348 27-FEB-2012 11:17:56.87
Body SysBody 27-FEB-2012 11:18:17.91
Attr MethodName = "Nodave_PLC-IoRackInit"
EndBody
EndObject
Object IoRackClose $Method 349 27-FEB-2012 11:18:29.27
Body SysBody 27-FEB-2012 11:18:34.44
Attr MethodName = "Nodave_PLC-IoRackClose"
EndBody
EndObject
Object IoRackRead $Method 350 27-FEB-2012 11:18:42.14
Body SysBody 27-FEB-2012 11:18:50.03
Attr MethodName = "Nodave_PLC-IoRackRead"
EndBody
EndObject
Object IoRackWrite $Method 351 27-FEB-2012 11:19:05.59
Body SysBody 27-FEB-2012 11:19:17.23
Attr MethodName = "Nodave_PLC-IoRackWrite"
EndBody
EndObject
EndObject
Object ConfiguratorPoson $Menu 352 27-FEB-2012 11:17:37.94
Object Pointed $Menu 353 27-FEB-2012 11:17:37.94
Object Connect $MenuButton 354 27-FEB-2012 11:17:37.94
Body SysBody 27-FEB-2012 11:17:37.94
Attr ButtonName = "Connect PlcThread"
Attr MethodName = "$Objid-Connect"
Attr MethodArguments[0] = "ThreadObject"
Attr MethodArguments[1] = "PlcThread"
Attr FilterName = "$Objid-IsOkConnect"
Attr FilterArguments[0] = "ThreadObject"
Attr FilterArguments[1] = "PlcThread"
EndBody
EndObject
EndObject
EndObject
Object PostCreate $DbCallBack 355 27-FEB-2012 11:17:37.94
Body SysBody 27-FEB-2012 11:19:32.32
Attr MethodName = "BaseIORack-PostCreate"
EndBody
EndObject
Object Template Nodave_PLC 2157150208 01-JAN-1970 01:00:00.00
Body RtBody 28-FEB-2012 08:58:58.24
Attr Process = 1
Attr SerialDevice = "/dev/ttyS0"
Attr SerialSpeed = 38400
Attr Port = 102
Attr Slot = 2
Attr FloatRepresentation = 1
Attr ErrorLimit = 50
EndBody
EndObject
EndObject
!/**
! @Version 1.0
! @Group IO
! @Summary Card object for libnodave connection to Siemens PLC.
! Card object for libnodave connection to Siemens PLC.
!
! This object is placed below a Nodave_PLC object in the node hierarchy
! and specifies a read or write transaction.
!
! The read or write area is specified by creating channel objects below
! the Nodave_Transaction objects. The combination of channels with various
! types and representations specifies the organization of the read or write area.
!
! @b See also
! @classlink Nodave_PLC otherio_nodave_plc.html
!*/
Object Nodave_Transaction $ClassDef 37 27-FEB-2012 11:06:13.56
Body SysBody 27-FEB-2012 11:06:23.77
Attr Editor = 0
Attr Method = 0
Attr Flags = 51280
EndBody
Object RtBody $ObjBodyDef 1 27-FEB-2012 11:06:36.61
Body SysBody 27-FEB-2012 11:06:36.61
Attr StructName = "Nodave_Transaction"
Attr NextAix = "_X11"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1 27-FEB-2012 11:06:54.14
Body SysBody 27-FEB-2012 11:06:54.14
Attr PgmName = "Description"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Current status.
!*/
Object Status $Attribute 7 28-FEB-2012 08:50:44.69
Body SysBody 27-FEB-2012 13:26:24.31
Attr PgmName = "Status"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! @Summary Process that handles the module. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the module.
!
! 1: The module is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The module is read by the rt_io_comm process.
! 4: The module is handled by an application program.
!*/
Object Process $Attribute 2 27-FEB-2012 11:06:54.14
Body SysBody 27-FEB-2012 11:06:54.14
Attr PgmName = "Process"
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
!/**
! @Summary Plc thread that handles the card.
! The PlcThread object of the plc thread that handles the card.
! The card is read with the scantime of the thread.
!*/
Object ThreadObject $Attribute 3 27-FEB-2012 11:06:54.14
Body SysBody 27-FEB-2012 11:06:54.14
Attr PgmName = "ThreadObject"
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! @Summary Memory area in the PLC.
! Memory area in the PLC.
!
! SysInfo System info of 200 family
! SysFlags System flags of 200 family
! AnaIn Analog inputs of 200 family
! AnaOut Analog outputs of 200 family
! P Direct peripheral access
! Inputs
! Outputs
! Flags
! DB Data blocks
! DI Instance data blocks
! Local -
! V -
! Counter S7 counters
! Timer S7 timers
! Counter200 IEC counters (200 family)
! Timer200 IEC timers (200 family)
! SysDataS5 -
! RawMemoryS5 Just the raw memory
!*/
Object Area $Attribute 4 27-FEB-2012 11:07:07.46
Body SysBody 27-FEB-2012 11:07:24.24
Attr PgmName = "Area"
Attr TypeRef = "OtherIO:Type-Nodave_AreaEnum"
EndBody
EndObject
!/**
! Data block number.
!*/
Object DataBlock $Attribute 5 27-FEB-2012 11:07:39.57
Body SysBody 27-FEB-2012 11:07:47.90
Attr PgmName = "DataBlock"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Start address.
!*/
Object Address $Attribute 6 27-FEB-2012 11:07:57.32
Body SysBody 27-FEB-2012 11:08:02.20
Attr PgmName = "Address"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Specifies, in relation to the scantime of the thread, how
! often the module is handled. If ScanInterval i 1, the module
! is handled every scan. If ScanInterval is for example 10, it
! is handled every 10'th scan, i.e. the scantime for the module
! will be ScanInterval times the scantime of the thread.
!*/
Object ScanInterval $Attribute 8 27-FEB-2012 13:24:07.85
Body SysBody 27-FEB-2012 13:24:07.85
Attr PgmName = "ScanInterval"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! @Summary Continous operation of the module.
! If set to Yes the module is scanned cylically for each scan (read or write operation).
! If set to false the action defined by the FunctionCode-attribute will only be executed
! when the SendOp-attribute is set.
!*/
Object Continous $Attribute 9 28-FEB-2012 08:50:33.38
Body SysBody 28-FEB-2012 08:50:33.38
Attr PgmName = "Continous"
Attr TypeRef = "pwrb:Type-YesNoEnum"
EndBody
EndObject
!/**
! @Summary Request to execute action defined by FunctionCode-attribute once.
! This attribute is only valid if Contious-attribute is set to 'No'.
!*/
Object SendOp $Attribute 10 28-FEB-2012 08:50:33.38
Body SysBody 28-FEB-2012 08:52:07.30
Attr PgmName = "SendOp"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 338 27-FEB-2012 11:15:14.21
Object IoCardInit $Method 339 27-FEB-2012 11:15:14.21
Body SysBody 27-FEB-2012 11:15:48.93
Attr MethodName = "Nodave_Transaction-IoCardInit"
EndBody
EndObject
Object IoCardClose $Method 340 27-FEB-2012 11:15:14.21
Body SysBody 27-FEB-2012 11:17:17.98
Attr MethodName = "Nodave_Transaction-IoCardClose"
EndBody
EndObject
Object IoCardRead $Method 341 27-FEB-2012 11:15:14.21
Body SysBody 27-FEB-2012 11:16:29.64
Attr MethodName = "Nodave_Transaction-IoCardRead"
EndBody
EndObject
Object IoCardWrite $Method 342 27-FEB-2012 11:15:14.21
Body SysBody 27-FEB-2012 11:16:37.61
Attr MethodName = "Nodave_Transaction-IoCardWrite"
EndBody
EndObject
EndObject
Object ConfiguratorPoson $Menu 343 27-FEB-2012 11:15:14.21
Object Pointed $Menu 344 27-FEB-2012 11:15:14.21
Object Connect $MenuButton 345 27-FEB-2012 11:15:14.21
Body SysBody 27-FEB-2012 11:15:14.21
Attr ButtonName = "Connect PlcThread"
Attr MethodName = "$Objid-Connect"
Attr MethodArguments[0] = "ThreadObject"
Attr MethodArguments[1] = "PlcThread"
Attr FilterName = "$Objid-IsOkConnect"
Attr FilterArguments[0] = "ThreadObject"
Attr FilterArguments[1] = "PlcThread"
EndBody
EndObject
EndObject
EndObject
Object PostCreate $DbCallBack 346 27-FEB-2012 11:15:14.21
Body SysBody 27-FEB-2012 11:15:14.21
Attr MethodName = "BaseIOCard-PostCreate"
EndBody
EndObject
Object Template Nodave_Transaction 2157412352 01-JAN-1970 01:00:00.00
Body RtBody 28-FEB-2012 08:51:43.87
Attr Process = 1
Attr Area = 132
Attr Continous = 1
EndBody
EndObject
EndObject
EndObject
EndVolume
......@@ -244,6 +244,7 @@ sub build_kernel # args: flavour
_build("lib","usbio_dummy","src","init lib");
_build("lib","usb_dummy","src","init lib");
_build("lib","cifx_dummy","src","init lib");
_build("lib","nodave_dummy","src","init lib");
merge();
_module("xtt");
build_all("exe", $flavour);
......@@ -354,6 +355,7 @@ sub ebuild # args: pass flavour
_build("lib","usbio_dummy","src","init lib");
_build("lib","usb_dummy","src","init lib");
_build("lib","cifx_dummy","src","init lib");
_build("lib","nodave_dummy","src","init lib");
merge();
_module("rt");
_build("exe", "rt*", "src", "all");
......
......@@ -389,6 +389,7 @@ else
pwre_config_check_include mq MQ 0 "/usr/local/dmq/include/p_entry.h"
pwre_config_check_include wmq WMQ 1 "/opt/mqm/inc/cmqc.h"
pwre_config_check_include cifx CIFX 1 "/usr/local/include/cifx/cifxlinux.h"
pwre_config_check_include nodave NODAVE 1 "/usr/include/nodave.h"
export pwre_conf_alsa=1
......@@ -410,7 +411,7 @@ else
echo "export pwre_conf_libpwrco=\"-lpwr_co\"" >> $cfile
echo "export pwre_conf_libpwrrt=\"-lpwr_rt -lpwr_co -lpwr_statussrv -lpwr_msg_dummy\"" >> $cfile
echo "export pwre_conf_libpwrdtt=\"-lpwr_dtt\"" >> $cfile
echo "export pwre_conf_libpwrotherio=\"-lpwr_usbio_dummy -lpwr_usb_dummy -lpwr_cifx_dummy\"" >> $cfile
echo "export pwre_conf_libpwrotherio=\"-lpwr_usbio_dummy -lpwr_usb_dummy -lpwr_cifx_dummy -lpwr_nodave_dummy\"" >> $cfile
echo "export pwre_conf_libpwrprofibus=\"-lpwr_pnak_dummy\"" >> $cfile
echo "export pwre_conf_libpwrxtt=\"-lpwr_xtt -lpwr_ge -lpwr_cow -lpwr_flow -lpwr_glow\"" >> $cfile
echo "export pwre_conf_libpwrxttgtk=\" -lpwr_xtt_gtk -lpwr_ge_gtk -lpwr_cow_gtk -lpwr_flow_gtk -lpwr_glow_gtk\"" >> $cfile
......
......@@ -151,6 +151,16 @@ SObject pwrb:Type
Attr Value = 524288
EndBody
EndObject
!/**
! Nodave archive.
!*/
Object Nodave $Bit
Body SysBody
Attr PgmName = "Nodave"
Attr Text = "Nodave"
Attr Value = 1048576
EndBody
EndObject
EndObject
EndSObject
......
......@@ -252,7 +252,9 @@ palette NavigatorPalette
class ChanAit
class ChanAo
class ChanBi
class ChanBiBlob
class ChanBo
class ChanBoBlob
class ChanCo
class ChanD
class ChanDi
......@@ -389,6 +391,11 @@ palette NavigatorPalette
class BaseIORack
}
}
menu Nodave
{
class Nodave_PLC
class Nodave_Transaction
}
}
menu Remote
{
......
......@@ -2093,6 +2093,11 @@ pwr_tStatus lfu_SaveDirectoryVolume(
else
sprintf( &str[strlen(str)], "-lpwr_usbio_dummy ");
if ( bop->SystemModules & pwr_mBuildOptionsMask_Nodave)
sprintf( &str[strlen(str)], "-lnodave ");
else
sprintf( &str[strlen(str)], "-lpwr_nodave_dummy ");
free( (char *)bop);
if ( os == pwr_mOpSys_CustomBuild)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment