How to Generate Code in simulink?

Hi.
After I designed a simple simulink model and typed 'Ctrl­-E', a "Configuration Parameter" dialog is popped up, and there is only the drop-down list for step 4 but I can't find where to select 'orocos' as step 3 showed in Simulink4Orocos.pdf.
would you please tell me how to complete the code generation procedure?

part of content in Simulink4Orocos.pdf:
1.Open a Simulink model designed as in the previous chapter.
2. Type 'Ctrl­E'
3. Select the 'orocos' target from the drop­down list
4. select any fixed step solver (not variable step) from the drop­down list
5. Click on 'Build"

ps: I installed simulink4orocos-1.1 within matlab 2006b on Windows.

Best Regards.
Jack Lee

How to Generate Code in simulink?

On Sun, Apr 26, 2009 at 3:43 PM, <snowbluff [..] ...> wrote:
> Hi.
> After I designed a simple simulink model and typed 'Ctrl­-E', a "Configuration Parameter" dialog is popped up, and there is only the drop-down list for step 4 but I can't find where to select 'orocos' as step 3 showed in Simulink4Orocos.pdf.
> would you please tell me how to complete the code generation procedure?
>
> part of content in Simulink4Orocos.pdf:
> 1.Open a Simulink model designed as in the previous chapter.
> 2. Type 'Ctrl­E'
> 3. Select the 'orocos' target from the drop­down list
> 4. select any fixed step solver (not variable step) from the drop­down list
> 5. Click on 'Build"
>
> ps: I installed simulink4orocos-1.1 within matlab 2006b on Windows.

Do you have a $MATLAB_ROOT/rtw/c/orocos directory?
What was the output when you ran the install.m script in matlab?

Klaas

How to Generate Code in simulink?

Thanks for your reply, Klass.
I have a directory E:\MATLAB\R2006b\rtw\c\orocos, and the message when I ran
install.m is showed below. Is it OK?
The attachment are a screenshot while I type ‘Ctrl-E’ and my simulink model.

Best Regards.
Jack

>> install
Orocos: setting path.
Orocos: done.
Orocos: configuring mex...
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? y

Select a compiler:
[1] Lcc C version 2.4.1 in E:\MATLAB\R2006b\sys\lcc
[2] Microsoft Visual C/C++ version 6.0 in D:\Program Files\Microsoft Visual
Studio

[0] None

Compiler: 1

Please verify your choices:

Compiler: Lcc C 2.4.1
Location: E:\MATLAB\R2006b\sys\lcc

Are these correct?([y]/n): y

Trying to update options file: C:\Documents and
Settings\Administrator\Application Data\MathWorks\MATLAB\R2006b\mexopts.bat
>From template: E:\MATLAB\R2006b\bin\win32\mexopts\lccopts.bat

Done . . .

Orocos: compiling blocks...
Orocos: install completed.

On Mon, Apr 27, 2009 at 3:34 PM, Klaas Gadeyne <klaas [dot] gadeyne [..] ...>wrote:

> On Sun, Apr 26, 2009 at 3:43 PM, <snowbluff [..] ...> wrote:
> > Hi.
> > After I designed a simple simulink model and typed 'Ctrl­-E', a
> "Configuration Parameter" dialog is popped up, and there is only the
> drop-down list for step 4 but I can't find where to select 'orocos' as step
> 3 showed in Simulink4Orocos.pdf.
> > would you please tell me how to complete the code generation procedure?
> >
> > part of content in Simulink4Orocos.pdf:
> > 1.Open a Simulink model designed as in the previous chapter.
> > 2. Type 'Ctrl­E'
> > 3. Select the 'orocos' target from the drop­down list
> > 4.
> select any fixed step solver (not variable step) from the drop­down list
> > 5. Click on 'Build"
> >
> > ps: I installed simulink4orocos-1.1 within matlab 2006b on Windows.
>
> Do you have a $MATLAB_ROOT/rtw/c/orocos directory?
> What was the output when you ran the install.m script in matlab?
>
> Klaas
>

How to Generate Code in simulink?

On Mon, 27 Apr 2009, cc.Lee wrote:

> Thanks for your reply, Klass.
> I have a directory E:\MATLAB\R2006b\rtw\c\orocos, and the message when I ran
> install.m is showed below. Is it OK?
> The attachment are a screenshot while I type ‘Ctrl-E’ and my simulink model.

Everything seems ok. However, you need to set the "target" under the "real-time workshop" entry (whereas now, "solver" is selected)

ps. Peter recently uploaded a 1.2 version which includes some bugfixes...

klaas

> Best Regards.
> Jack
>
>>> install
> Orocos: setting path.
> Orocos: done.
> Orocos: configuring mex...
> Please choose your compiler for building external interface (MEX) files:
>
> Would you like mex to locate installed compilers [y]/n? y
>
> Select a compiler:
> [1] Lcc C version 2.4.1 in E:\MATLAB\R2006b\sys\lcc
> [2] Microsoft Visual C/C++ version 6.0 in D:\Program Files\Microsoft Visual
> Studio
>
> [0] None
>
> Compiler: 1
>
> Please verify your choices:
>
> Compiler: Lcc C 2.4.1
> Location: E:\MATLAB\R2006b\sys\lcc
>
> Are these correct?([y]/n): y
>
> Trying to update options file: C:\Documents and
> Settings\Administrator\Application Data\MathWorks\MATLAB\R2006b\mexopts.bat
>> From template: E:\MATLAB\R2006b\bin\win32\mexopts\lccopts.bat
>
> Done . . .
>
> Orocos: compiling blocks...
> Orocos: install completed.
>
>
> On Mon, Apr 27, 2009 at 3:34 PM, Klaas Gadeyne <klaas [dot] gadeyne [..] ...>wrote:
>
>> On Sun, Apr 26, 2009 at 3:43 PM, <snowbluff [..] ...> wrote:
>>> Hi.
>>> After I designed a simple simulink model and typed 'Ctrl­-E', a
>> "Configuration Parameter" dialog is popped up, and there is only the
>> drop-down list for step 4 but I can't find where to select 'orocos' as step
>> 3 showed in Simulink4Orocos.pdf.
>>> would you please tell me how to complete the code generation procedure?
>>>
>>> part of content in Simulink4Orocos.pdf:
>>> 1.Open a Simulink model designed as in the previous chapter.
>>> 2. Type 'Ctrl­E'
>>> 3. Select the 'orocos' target from the drop­down list
>>> 4.
>> select any fixed step solver (not variable step) from the drop­down list
>>> 5. Click on 'Build"
>>>
>>> ps: I installed simulink4orocos-1.1 within matlab 2006b on Windows.
>>
>> Do you have a $MATLAB_ROOT/rtw/c/orocos directory?
>> What was the output when you ran the install.m script in matlab?
>>
>> Klaas
>>
>
>
>
>

How to Generate Code in simulink?

Thanks for your help.
I setted System target file to "orocos.tlc" under the "real-time workshop"
entry, and it is OK now.
Then another problem occurred, when I use DataPort<double> and the build
process is successful. But when I replace it with DataPort<int>, it has
error like this:

Error building Real-Time Workshop target for block diagram 'orocostest'.
MATLAB error message:
Error using ==> rtwgen
--> Error reported by S-function 'sfun_idataport' in <a
meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
Second parameter must be an integer value.
--> Error reported by S-function 'sfun_idataport' in <a
meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
Second parameter must be an integer value.

How should I use DataPort<int>?

Best Regards.
Jack

2009/4/27 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>

> On Mon, 27 Apr 2009, cc.Lee wrote:
>
> Thanks for your reply, Klass.
>> I have a directory E:\MATLAB\R2006b\rtw\c\orocos, and the message when I
>> ran
>> install.m is showed below. Is it OK?
>> The attachment are a screenshot while I type 'Ctrl-E' and my simulink
>> model.
>>
>
> Everything seems ok. However, you need to set the "target" under the
> "real-time workshop" entry (whereas now, "solver" is selected)
>
> ps. Peter recently uploaded a 1.2 version which includes some bugfixes...
>
> klaas
>
>
> Best Regards.
>> Jack
>>
>> install
>>>>
>>> Orocos: setting path.
>> Orocos: done.
>> Orocos: configuring mex...
>> Please choose your compiler for building external interface (MEX) files:
>>
>> Would you like mex to locate installed compilers [y]/n? y
>>
>> Select a compiler:
>> [1] Lcc C version 2.4.1 in E:\MATLAB\R2006b\sys\lcc
>> [2] Microsoft Visual C/C++ version 6.0 in D:\Program Files\Microsoft
>> Visual
>> Studio
>>
>> [0] None
>>
>> Compiler: 1
>>
>> Please verify your choices:
>>
>> Compiler: Lcc C 2.4.1
>> Location: E:\MATLAB\R2006b\sys\lcc
>>
>> Are these correct?([y]/n): y
>>
>> Trying to update options file: C:\Documents and
>> Settings\Administrator\Application
>> Data\MathWorks\MATLAB\R2006b\mexopts.bat
>>
>>> From template:
>>> E:\MATLAB\R2006b\bin\win32\mexopts\lccopts.bat
>>>
>>
>> Done . . .
>>
>> Orocos: compiling blocks...
>> Orocos: install completed.
>>
>>
>> On Mon, Apr 27, 2009 at 3:34 PM, Klaas Gadeyne <klaas [dot] gadeyne [..] ...
>> >wrote:
>>
>> On Sun, Apr 26, 2009 at 3:43 PM, <snowbluff [..] ...> wrote:
>>>
>>>> Hi.
>>>> After I designed a simple simulink model and typed 'Ctrl--E', a
>>>>
>>> "Configuration Parameter" dialog is popped up, and there is only the
>>> drop-down list for step 4 but I can't find where to select 'orocos' as
>>> step
>>> 3 showed in Simulink4Orocos.pdf.
>>>
>>>> would you please tell me how to complete the code generation procedure?
>>>>
>>>> part of content in Simulink4Orocos.pdf:
>>>> 1.Open a Simulink model designed as in the previous chapter.
>>>> 2. Type 'Ctrl-E'
>>>> 3. Select the 'orocos' target from the drop-down list
>>>> 4.
>>>>
>>> select any fixed step solver (not variable step) from the drop-down list
>>>
>>>> 5. Click on 'Build"
>>>>
>>>> ps: I installed simulink4orocos-1.1 within matlab 2006b on Windows.
>>>>
>>>
>>> Do you have a $MATLAB_ROOT/rtw/c/orocos directory?
>>> What was the output when you ran the install.m script in matlab?
>>>
>>> Klaas
>>>
>>>
>>
>>
>>

How to Generate Code in simulink?

2009/4/27 cc.Lee <snowbluff [..] ...>:
> Thanks for your help.

In return, please don't top quote :-)

> I setted System target file to "orocos.tlc" under the "real-time workshop"
> entry, and it is OK now.
> Then another problem occurred, when I use DataPort<double> and the build
> process is successful. But when I replace it with DataPort<int>, it has
> error like this:
>
> Error building Real-Time Workshop target for block diagram 'orocostest'.
> MATLAB error message:
> Error using ==> rtwgen
> --> Error reported by S-function 'sfun_idataport' in <a
> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
> Second parameter must be an integer value.
> --> Error reported by S-function 'sfun_idataport' in <a
> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
> Second parameter must be an integer value.
>
> How should I use DataPort<int>?

Can you send me a demo model so I can check this if I find some time?

TIA,

Klaas

How to Generate Code in simulink?

2009/4/28 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>

> 2009/4/27 cc.Lee <snowbluff [..] ...>:
> > Thanks for your help.
>
> In return, please don't top quote :-)
>
> > I setted System target file to "orocos.tlc" under the "real-time
> workshop"
> > entry, and it is OK now.
> > Then another problem occurred, when I use DataPort<double> and the build
> > process is successful. But when I replace it with DataPort<int>, it has
> > error like this:
> >
> > Error building Real-Time Workshop target for block diagram 'orocostest'.
> > MATLAB error message:
> > Error using ==> rtwgen
> > --> Error reported by S-function 'sfun_idataport' in <a
> >
> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
> > Second parameter must be an integer value.
> > --> Error reported by S-function 'sfun_idataport' in <a
> >
> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
> > Second parameter must be an integer value.
> >
> > How should I use DataPort<int>?
>
> Can you send me a demo model so I can check this if I find some time?
>
> TIA,
>
> Klaas
>

Yeah, please see the attachments for my simulink model. OrocosTestDouble.mdl
is OK, and OrocosTestInt.mdl has some errors. ps: after generate code, is it
need to modify the *.mk file to complie the code within linux?

How to Generate Code in simulink?

On Tue, 28 Apr 2009, cc.Lee wrote:
> 2009/4/28 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>
>
>> 2009/4/27 cc.Lee <snowbluff [..] ...>:
>>> Thanks for your help.
>>
>> In return, please don't top quote :-)
>>
>>> I setted System target file to "orocos.tlc" under the "real-time
>> workshop"
>>> entry, and it is OK now.
>>> Then another problem occurred, when I use DataPort<double> and the build
>>> process is successful. But when I replace it with DataPort<int>, it has
>>> error like this:
>>>
>>> Error building Real-Time Workshop target for block diagram 'orocostest'.
>>> MATLAB error message:
>>> Error using ==> rtwgen
>>> --> Error reported by S-function 'sfun_idataport' in <a
>>>
>> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
>>> Second parameter must be an integer value.
>>> --> Error reported by S-function 'sfun_idataport' in <a
>>>
>> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
>>> Second parameter must be an integer value.
>>>
>>> How should I use DataPort<int>?
>>
>> Can you send me a demo model so I can check this if I find some time?
>>
>> TIA,
>>
>> Klaas
>>
>
>
> Yeah, please see the attachments for my simulink model. OrocosTestDouble.mdl
> is OK, and OrocosTestInt.mdl has some errors.

Confirmed. Can you put this information (including the model as attachment) in bugzilla? TIA

> ps: after generate code, is it
> need to modify the *.mk file to complie the code within linux?

It shouldn't.

Klaas

How to Generate Code in simulink?

2009/5/4 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>

> On Tue, 28 Apr 2009, cc.Lee wrote:
>
>> 2009/4/28 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>
>>
>> 2009/4/27 cc.Lee <snowbluff [..] ...>:
>>>
>>>> Thanks for your help.
>>>>
>>>
>>> In return, please don't top quote :-)
>>>
>>> I setted System target file to "orocos.tlc" under the "real-time
>>>>
>>> workshop"
>>>
>>>> entry, and it is OK now.
>>>> Then another problem occurred, when I use DataPort<double> and the build
>>>> process is successful. But when I replace it with DataPort<int>, it has
>>>> error like this:
>>>>
>>>> Error building Real-Time Workshop target for block diagram 'orocostest'.
>>>> MATLAB error message:
>>>> Error using ==> rtwgen
>>>> --> Error reported by S-function 'sfun_idataport' in <a
>>>>
>>>>
>>> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
>>>
>>>> Second parameter must be an integer value.
>>>> --> Error reported by S-function 'sfun_idataport' in <a
>>>>
>>>>
>>> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
>>>
>>>> Second parameter must be an integer value.
>>>>
>>>> How should I use DataPort<int>?
>>>>
>>>
>>> Can you send me a demo model so I can check this if I find some time?
>>>
>>> TIA,
>>>
>>> Klaas
>>>
>>>
>>
>> Yeah, please see the attachments for my simulink model.
>> OrocosTestDouble.mdl
>> is OK, and OrocosTestInt.mdl has some errors.
>>
>
> Confirmed. Can you put this information (including the model as
> attachment) in bugzilla? TIA
>
> ps: after generate code, is it
>> need to modify the *.mk file to complie the code within linux?
>>
>
> It shouldn't.
>
> Klaas

I've reported it in bugzilla.

How to Generate Code in simulink?

2009/5/4 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>:
> On Tue, 28 Apr 2009, cc.Lee wrote:
>>
>> 2009/4/28 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>
>>
>>> 2009/4/27 cc.Lee <snowbluff [..] ...>:
>>>>
>>>> Thanks for your help.
>>>
>>> In return, please don't top quote :-)
>>>
>>>> I setted System target file to "orocos.tlc" under the "real-time
>>>
>>> workshop"
>>>>
>>>> entry, and it is OK now.
>>>> Then another problem occurred, when I use DataPort<double> and the build
>>>> process is successful. But when I replace it with DataPort<int>, it has
>>>> error like this:
>>>>
>>>> Error building Real-Time Workshop target for block diagram 'orocostest'.
>>>> MATLAB error message:
>>>> Error using ==> rtwgen
>>>> --> Error reported by S-function 'sfun_idataport' in <a
>>>>
>>>
>>> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
>>>>
>>>> Second parameter must be an integer value.
>>>> --> Error reported by S-function 'sfun_idataport' in <a
>>>>
>>>
>>> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
>>>>
>>>> Second parameter must be an integer value.
>>>>
>>>> How should I use DataPort<int>?
>>>
>>> Can you send me a demo model so I can check this if I find some time?
>>>
>>> TIA,
>>>
>>> Klaas
>>>
>>
>>
>> Yeah, please see the attachments for my simulink model.
>> OrocosTestDouble.mdl
>> is OK, and OrocosTestInt.mdl has some errors.
>
> Confirmed. Can you put this information (including the model as attachment)
> in bugzilla? TIA

Second question: Can you
1/ open $MATLAB_ROOT/rtw/c/orocos/taskcontext/orocos_taskcontext.mdl,
2/ unlock the library (Menu: Edit -> Unlock Library)
3/ double click on the DataPort<int> block and
4/ change the "initial value" from '0' to 'int32(0)'

And check wether it's working fine now?

Thanks,

Klaas

How to Generate Code in simulink?

2009/5/4 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>

> 2009/5/4 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>:
> > On Tue, 28 Apr 2009, cc.Lee wrote:
> >>
> >> 2009/4/28 Klaas Gadeyne <klaas [dot] gadeyne [..] ...>
> >>
> >>> 2009/4/27 cc.Lee <snowbluff [..] ...>:
> >>>>
> >>>> Thanks for your help.
> >>>
> >>> In return, please don't top quote :-)
> >>>
> >>>> I setted System target file to "orocos.tlc" under the "real-time
> >>>
> >>> workshop"
> >>>>
> >>>> entry, and it is OK now.
> >>>> Then another problem occurred, when I use DataPort<double> and the
> build
> >>>> process is successful. But when I replace it with DataPort<int>, it
> has
> >>>> error like this:
> >>>>
> >>>> Error building Real-Time Workshop target for block diagram
> 'orocostest'.
> >>>> MATLAB error message:
> >>>> Error using ==> rtwgen
> >>>> --> Error reported by S-function 'sfun_idataport' in <a
> >>>>
> >>>
> >>>
> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>')">'orocostest/DataPort<int>'</a>:
> >>>>
> >>>> Second parameter must be an integer value.
> >>>> --> Error reported by S-function 'sfun_idataport' in <a
> >>>>
> >>>
> >>>
> meval="das_dv_hyperlink('mdl','orocostest/DataPort<int>1')">'orocostest/DataPort<int>1'</a>:
> >>>>
> >>>> Second parameter must be an integer value.
> >>>>
> >>>> How should I use DataPort<int>?
> >>>
> >>> Can you send me a demo model so I can check this if I find some time?
> >>>
> >>> TIA,
> >>>
> >>> Klaas
> >>>
> >>
> >>
> >> Yeah, please see the attachments for my simulink model.
> >> OrocosTestDouble.mdl
> >> is OK, and OrocosTestInt.mdl has some errors.
> >
> > Confirmed. Can you put this information (including the model as
> attachment)
> > in bugzilla? TIA
>
> Second question: Can you
> 1/ open $MATLAB_ROOT/rtw/c/orocos/taskcontext/orocos_taskcontext.mdl,
> 2/ unlock the library (Menu: Edit -> Unlock Library)
> 3/ double click on the DataPort<int> block and
> 4/ change the "initial value" from '0' to 'int32(0)'
>
> And check wether it's working fine now?
>
> Thanks,
>
> Klaas
>

I followed the steps above, and it still doesn't work.
The error message is as below:
Error building Real-Time Workshop target for block diagram 'OrocosTestInt'.
MATLAB error message:
Error using ==> rtwgen
S-function <a
meval="das_dv_hyperlink('mdl','OrocosTestInt/DataPort<int>2')">'OrocosTestInt/DataPort<int>2'</a>
parameters must be of type double or char for Real-Time Workshop if the
S-function does not have TLC.

The attachment is the new model.

Thank you for answering my questions patiently.

How to Generate Code in simulink?

On Tue, 5 May 2009, cc.Lee wrote:
[...]
>> Second question: Can you
>> 1/ open $MATLAB_ROOT/rtw/c/orocos/taskcontext/orocos_taskcontext.mdl,
>> 2/ unlock the library (Menu: Edit -> Unlock Library)
>> 3/ double click on the DataPort<int> block and
>> 4/ change the "initial value" from '0' to 'int32(0)'
>>
>> And check wether it's working fine now?
>
> I followed the steps above, and it still doesn't work.
> The error message is as below:
> Error building Real-Time Workshop target for block diagram 'OrocosTestInt'.
> MATLAB error message:
> Error using ==> rtwgen
> S-function <a
> meval="das_dv_hyperlink('mdl','OrocosTestInt/DataPort<int>2')">'OrocosTestInt/DataPort<int>2'</a>
> parameters must be of type double or char for Real-Time Workshop if the
> S-function does not have TLC.

For the record: follow-up via bugzilla (reported on orocos-dev only).

Klaas