24.01.2015 Views

CoDeSys on CCP XS for Bromma Conquip - Research

CoDeSys on CCP XS for Bromma Conquip - Research

CoDeSys on CCP XS for Bromma Conquip - Research

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Student<br />

Joel Ek<br />

Supervisor at CC-Systems<br />

Fredrik Löwenhielm<br />

Dok Nr<br />

1.0<br />

Date<br />

2006-08-08<br />

Rev<br />

PA1<br />

Säk klass<br />

F<br />

Filname<br />

Thesis.doc<br />

CODESYS ON <strong>CCP</strong> <strong>XS</strong> FOR BROMMA CONQUIP<br />

Figure 23:<br />

Shoving the idée with declaring a POU to set the internal variables of a<br />

comp<strong>on</strong>ent.<br />

According to figure 23 you can now change the values in the input boxes (far to the left), the<br />

parameter POU will then read all inputs, put it in a structure that finally the comp<strong>on</strong>ent APS<br />

through the setParam input can read.<br />

This is not a standard way <strong>for</strong> initiating parameters in <str<strong>on</strong>g>CoDeSys</str<strong>on</strong>g> and the initiati<strong>on</strong> will not take<br />

place be<strong>for</strong>e the program is in running mode. Because of this a c<strong>on</strong>trol can be made hindering the<br />

program to initiate the comp<strong>on</strong>ent with the same value every cycle.<br />

5.1.5 Change number of in/out- puts<br />

The method we have adopted is that we when possible use the <str<strong>on</strong>g>CoDeSys</str<strong>on</strong>g> provided functi<strong>on</strong>s that<br />

have inbuilt ability to change number of ports.<br />

For the rest, meaning the most of the comp<strong>on</strong>ents, the soluti<strong>on</strong> will be to declare the comp<strong>on</strong>ents<br />

<strong>for</strong> all possible number of in- and out-puts as own Functi<strong>on</strong> Blocks<br />

This means that they will all have an own structure, init-functi<strong>on</strong> and processing functi<strong>on</strong>. (See<br />

figure 20, secti<strong>on</strong> 5.1.3.2)<br />

For complex Comp<strong>on</strong>ents this will lead to large amounts of code if they all would have<br />

individual code <strong>for</strong> the processing. The code that we are porting is the same <strong>for</strong> all possible<br />

interfaces <strong>for</strong> a comp<strong>on</strong>ent and is something we aim to keep.<br />

The problem is that all variants of the comp<strong>on</strong>ent will be represented with an own Struct in ANSI<br />

C code and holding an extra input will lead to a larger Struct. But he ANSI C functi<strong>on</strong> receiving<br />

a Struct as an input parameter expects it to be of a certain size.<br />

The soluti<strong>on</strong> is to make a general structure that hold all possible interfaces <strong>for</strong> a comp<strong>on</strong>ent and<br />

then have <strong>on</strong>ly <strong>on</strong>e code part <strong>for</strong> the processing with this general structure as input. When a<br />

Comp<strong>on</strong>ent with a specific port collecti<strong>on</strong> is processed it has to be copied to this general<br />

structure and in that way access the code.<br />

5.1.6 Retain variables<br />

During the porting of the <strong>Bromma</strong> specific comp<strong>on</strong>ent APS another questi<strong>on</strong> arose. The<br />

Automatic Positi<strong>on</strong>ing System (APS) is used to teach the spreader a number of stop-positi<strong>on</strong>s.<br />

36 (55)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!