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.
Solved! Go to Solution.
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:
Let me know how it goes!
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.
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!
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.
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.
Check these, and let me know if your problem is solved.
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.
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 🙂