VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink model in Veristand

Solved!
Go to solution

I am trying to control a Simulink model on veristand 2018 SP1 with the python API. I am not getting any errors but I have no control over the inports. I tried to upload the model in the engine demo project as I was able to run it using python. But still no output and no control over the inport. Is there something wrong with my model? Am I forgetting some settings that are necessary when importing models? Thanks in advance.

 

Code: https://controlc.com/7a2936ca

0 Kudos
Message 1 of 9
(3,499 Views)

Hey buddy,

I have checked your code, but I believe that here the issue is not necessary in your model. Did you compile your simulink module correctly in order to make it compatible with veristand module framwork? If no, follow this link to compile it before using it:

 

https://www.ni.com/documentation/en/veristand/latest/manual/select-compiler/

 

Let me know how it goes!

0 Kudos
Message 2 of 9
(3,456 Views)

Hi,

Thanks for your reply. I did build the model properly. Now I am able to control the model but only if I upload it in the same project as the engine demo. Also I edited the demo code to include my model. I think I am having issues with the code. And I can't find any other examples online to see what I'm doing wrong.

0 Kudos
Message 3 of 9
(3,439 Views)

It was really good to hear that you are able to control the model! What kind of issues are you having with the code?

Share some screenshots and let me help you with it!

cheers!

0 Kudos
Message 4 of 9
(3,427 Views)

Hi,

Thank you for your reply, I am trying to pass values to the input of the model (Variable: In1) through an excel sheet. I'm using openpyxl to do this, but when I use it inside the function, it asks me to initialize the variables with a valid Veristand datatype. Can you tell me what I'm doing wrong? I have added my code and the error screenshots.

Thank you.

Download All
0 Kudos
Message 5 of 9
(3,401 Views)
Solution
Accepted by siddheshk

Hello,

I hope you're doing good!

Thank you for sharing the screenshots, it helped me better understand the issue.

First let's fix the translate error stating: "Variables must be initialized with a valid VeriStand data type". here.

This booklet that may greatly help you. More, you can find some example codes here.

 

Check these, and let me know if your problem is solved.

regards,

Message 6 of 9
(3,362 Views)

Hi,

Thank you for your reply, I have solved the data type error by referring to the Restrictions section of the API documentation. I have a problem passing values to the initialized DoubleValueArray. I have created a new post for the same, link: https://forums.ni.com/t5/NI-VeriStand/How-to-pass-values-to-a-DoubleValueArray-in-python/m-p/4119483

 

I am trying to pass test cases from an excel sheet, because I can only use certain data types inside the veristand functions I tried to copy the sheet values to a list and then tried to copy the values to the initialised variable (DoubleValueArray), is there something that can be done for this? Thanks in advance! Regards.

Message 7 of 9
(3,350 Views)

Okay cool, I saw your new post I will get back to you with possible solution.

In the mean time, since the previous message solved the data type error by referring to the Restrictions section of the API documentation, mark it as a solution to help future users 🙂

Best regards.

0 Kudos
Message 8 of 9
(3,344 Views)

Done! Thank you so much.

0 Kudos
Message 9 of 9
(3,329 Views)