🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

OML Custom Block - API's

User: "João Marabisa"
Altair Employee
Updated by João Marabisa

Hello techs,

 

I'm facing some challenges using 'OML Custom Block' and that is why I've decided to post here because maybe someone has already had the same questions. I've done a little example to illustrate this (below). :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

 

1. First of all I'd like to understand if there are differences (or maybe improvements) between somes commands of the API's like:  'vssGetInputData' 'vssGetInPortData' and 'vssSetOutputData' / 'vssSetOutPortData'. I've done some tests and I have obtained the same results... There is no description on the help regarding these commands (API's in general) and if possible would be nice to add them.

 

2. Use a Initial Condition on OML Block by the Integrator: I've set a initial condition on the Integrator block and I'd like that these conditions would be read on my Oml Block in the first step. As you could see, it is not being read exactly as a initial condition, it looks like that has already integrated:

 

 <?xml version="1.0" encoding="UTF-8"?>icond.thumb.png.8a6976df049f46b4669e232dc6123854.png

 

I've tried to set this on Oml block Parameters as well and it did not work. If it is not clear, I just would like to use de Initial condition (first step) of the integrator as my first 'X array' (used on Oml block) and then continue to integrate. My 'U array' is being read correctly.

 

Thanks.

Find more posts tagged with

Sort by:
1 - 6 of 61
    User: "L Moretti"
    New Altair Community Member
    Updated by L Moretti

    Hello Joao,

     

    I could not reproduce your issue. Can you post your .scm model as well?

     

    Thanks,

     

    Lorenzo

    User: "Fady Nassif_21652"
    Altair Employee
    Updated by Fady Nassif_21652

    Hello Joao,

    To answer your first question, the APIs to be used are vssGetInputData and vssGetOutputData. The others are aliases. 

    For your second question, as Lorenzo proposed, would you please share the model.

     

    Thanks

    Fady

    User: "João Marabisa"
    Altair Employee
    OP
    Updated by João Marabisa

    Hello everyone,

    Firstly, thanks for your effort (both Lorenzo and Fady)! For sure I can share with you (attached). :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

    There are a few calculates in the model (which I commented) but I think that I'm having problem with the first step, reading the input (I am using 'disp' the show the input vector to debug it), as you could see, the array input is not equal than my integral initial condition:

     

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.e9f2f22e701502a4665d43ef9be68078.png 

     

    Regarding the aliases, to be honest I had some doubts because on the demos with 'OML Custom Block' different types of API function are used and I was trying to understand the differences between them like 'vssSetOutPortData(block,1,med,vssGetOutputDataType(block,1))' so actually are they all aliases?

     

    Regards.

    Unable to find an attachment - read this blog

    User: "robertavarela"
    New Altair Community Member
    Updated by robertavarela

    It's necessary to add these APIs after getting the input data:

     nevprt=vssGetEventCode(block); if flag == vssBlockInitializeFlag  elseif flag == vssBlockReinitializeFlag  elseif flag == vssBlockTerminateFlag  elseif flag == vssBlockOutputUpdateFlag

    And before the end of the function:

     vssSetOutputData(block,1,y1,vssGetOutputDataType(block,1));          end

    Kudos to Patrick Goulding who solved the problem (he is in the forum but I'm not sure about his username)!

     

    Regards,

     

    Roberta

    User: "João Marabisa"
    Altair Employee
    OP
    Updated by João Marabisa

    Just to comment, with those API's mentioned by Roberta (which Patrick suggested us to use) the issue was solved in fact, anyway, it is not clear yet when these API's at the beginning should be used, once in some models (including in demo) just using vssGetInputData directly we can calculate it...

     

    Thanks for you all. :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

    User: "robertavarela"
    New Altair Community Member
    Updated by robertavarela