0

I don't know if you hear about isystems tools but I'm working with these, TestIdea/WinIdea. I wrote a scripts in Python, to change the value of a sensor ( 30 times ) and I need to monitor how it is his behavior. I put a test point, with the execution of my function on the line that I need. But the value of that variable still remain 0 if I only use the script but If I assign a value manually of that variable it's working. So I think the function and the line of his are good but I don't know what it's wrong. This is the code and is good because I have output:

def SawTooth(self):

    Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement = 0
    for i in range(31):
        if Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement < 4.5:
            Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement = Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement + 0.5
        else:
            Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement = 0.5


        print(i,Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement)

https://i.stack.imgur.com/sB45U.png

And if I put the same line in which to execute the test point and finish the test, it enters a fine loop and the program goes continuously without stopping.

I don't know If anybody can help me without the source code but I said to try my luck :)

Alex Alexe
  • 19
  • 4

1 Answers1

1

If I understand correctly, you would like to change the value of a variable that resides in your target application. These target variables can be accessed with an instance of isystem.connect class CTestCaseController. Use modify() to assign new values and evaluate() to read the current value of your variable.

Assuming that your target variable is named identical to the one in your script:

    def SawTooth(self):
    if self.testCtrl == None:
        self.testCtrl = ic.CTestCaseController(self.connectionMgr, self._isys_testCaseHandle)
        
    Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement = 0
    for i in range(31):
        if Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement < 4.5:
            Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement = Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement + 0.5
        else:
            Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement = 0.5
            
        self.testCtrl.modify('Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement', str(Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement))
        
        eval_value = self.testCtrl.evaluate("Rte_IoHwAb_IoHwAbSRSendSpoolSenseADCPort_IoHwAbDataElement,d")
        print(f"{i},{eval_value}")

I hope this will help you further. Best regards, Pim (iSystem Support)

PG_root
  • 11
  • 1
  • Yes, I do it. But to problem now is I give that 30 times values but the calculation is only made at the end of the the tast case and I want to do it for all 30 variables, how to do it? – Alex Alexe Oct 04 '22 at 11:46