<jupyter_start><jupyter_text>Current voltage curvesThis example shows how the Thales I/E software package can be controlled with Python.The [I/E manual](http://zahner.de/pdf/IE.pdf) provides further explanation of this method and explains the settings.<jupyter_code>import sys
from thales_remote.connection import ThalesRemoteConnection
from thales_remote.script_wrapper import ThalesRemoteScriptWrapper

from jupyter_utils import executionInNotebook, notebookCodeToPython<jupyter_output><empty_output><jupyter_text>Establish and initialize The Term software must be started before the script is executed to be able to connect.<jupyter_code>if __name__ == "__main__":
    zenniumConnection = ThalesRemoteConnection()
    connectionSuccessful = zenniumConnection.connectToTerm("localhost", "ScriptRemote")
    if connectionSuccessful:
        print("connection successfull")
    else:
        print("connection not possible")
        sys.exit()
        
    zahnerZennium = ThalesRemoteScriptWrapper(zenniumConnection)
    zahnerZennium.forceThalesIntoRemoteScript()<jupyter_output>connection successfull<jupyter_text>I/E output file setupThe first step is to set where the measurement data is to be saved. The path must exist otherwise you will get an error.<jupyter_code>zahnerZennium.setIEOutputPath(r"C:\THALES\temp\ie")<jupyter_output><empty_output><jupyter_text>Then it is set that the measurements should be numbered and the numbering starts with 1.  In the further process, the other two naming types are also configured as examples.<jupyter_code>zahnerZennium.setIENaming("counter")
    zahnerZennium.setIECounter(1)<jupyter_output><empty_output><jupyter_text>I/E measurement parametersIn the next step, the actual parameters for the measurement method are set.  Alternatively, a rule file could be loaded which sets the parameters for the measurement.The methods are named after the parameters they set. Additional information can be found in the [API documentation](http://zahner.de/documentation/thales_remote/script_wrapper.html).<jupyter_code>zahnerZennium.setIEFirstEdgePotential(1)
    zahnerZennium.setIEFirstEdgePotentialRelation("absolute")
    zahnerZennium.setIESecondEdgePotential(1.1)
    zahnerZennium.setIESecondEdgePotentialRelation("absolute")
    zahnerZennium.setIEThirdEdgePotential(0.9)
    zahnerZennium.setIEThirdEdgePotentialRelation("absolute")
    zahnerZennium.setIEFourthEdgePotential(1)
    zahnerZennium.setIEFourthEdgePotentialRelation("absolute")
    
    zahnerZennium.setIEPotentialResolution(0.02)
    zahnerZennium.setIEMinimumWaitingTime(1)
    zahnerZennium.setIEMaximumWaitingTime(15)
    zahnerZennium.setIERelativeTolerance(0.01)  #1 %
    zahnerZennium.setIEAbsoluteTolerance(0.001) #1 mA
    zahnerZennium.setIEOhmicDrop(0)
    
    zahnerZennium.setIEScanRate(0.05)
    zahnerZennium.setIEMaximumCurrent(0.01)
    zahnerZennium.setIEMinimumCurrent(-0.01)<jupyter_output><empty_output><jupyter_text>Execute the measurementIn the following, the three different types of I/E are executed one after the other.It also adjusts the file name before each measurement and changes the naming of the files.The [IE manual](http://zahner.de/pdf/IE.pdf) explains the individual types. Steady State<jupyter_code>zahnerZennium.setIESweepMode("steady state")
    zahnerZennium.setIEOutputFileName("ie_steady")<jupyter_output><empty_output><jupyter_text>After checking whether the parameters have been set correctly, the measurement is started.<jupyter_code>zahnerZennium.checkIESetup()
    print(zahnerZennium.readIESetup())
    
    zahnerZennium.measureIE()<jupyter_output>OK;IESETUP;IE_EckPot1=1.0000e+00;IE_EckPot2=1.1000e+00;IE_EckPot3=9.0000e-01;IE_EckPot4=1.0000e+00;IE_EckPot1rel=0;IE_EckPot2rel=0;IE_EckPot3rel=0;IE_EckPot4rel=0;IE_Resolution=2.0000e-02;IE_WZmin=1.0;IE_WZmax=15;IE_Torel=1.0000e-02;IE_Toabs=1.0000e-03;IE_Odrop=0.0000e+00;IE_SweepMode=0;IE_Srate=5.0000e-02;IE_Imi=-1.0000e-02;IE_Ima=1.0000e-02;ENDSETUP<jupyter_text>Dynamic ScanThe names of the measurement results are extended with date and time.<jupyter_code>zahnerZennium.setIESweepMode("dynamic scan")
    zahnerZennium.setIENaming("dateTime")
    zahnerZennium.setIEOutputFileName("ie_dynamic")
    
    zahnerZennium.checkIESetup()
    print(zahnerZennium.readIESetup())
    
    zahnerZennium.measureIE()<jupyter_output>OK;IESETUP;IE_EckPot1=1.0000e+00;IE_EckPot2=1.1000e+00;IE_EckPot3=9.0000e-01;IE_EckPot4=1.0000e+00;IE_EckPot1rel=0;IE_EckPot2rel=0;IE_EckPot3rel=0;IE_EckPot4rel=0;IE_Resolution=2.0000e-02;IE_WZmin=1.0;IE_WZmax=15;IE_Torel=1.0000e-02;IE_Toabs=1.0000e-03;IE_Odrop=0.0000e+00;IE_SweepMode=0;IE_Srate=5.0000e-02;IE_Imi=-1.0000e-02;IE_Ima=1.0000e-02;ENDSETUP<jupyter_text>Fixed SamplingThe names of the measurement results are extended with date and time.<jupyter_code>zahnerZennium.setIESweepMode("fixed sampling")
    zahnerZennium.setIEOutputFileName("ie_fixed")
    
    zahnerZennium.checkIESetup()
    print(zahnerZennium.readIESetup())
    
    zahnerZennium.measureIE()<jupyter_output>OK;IESETUP;IE_EckPot1=1.0000e+00;IE_EckPot2=1.1000e+00;IE_EckPot3=9.0000e-01;IE_EckPot4=1.0000e+00;IE_EckPot1rel=0;IE_EckPot2rel=0;IE_EckPot3rel=0;IE_EckPot4rel=0;IE_Resolution=2.0000e-02;IE_WZmin=1.0;IE_WZmax=15;IE_Torel=1.0000e-02;IE_Toabs=1.0000e-03;IE_Odrop=0.0000e+00;IE_SweepMode=0;IE_Srate=5.0000e-02;IE_Imi=-1.0000e-02;IE_Ima=1.0000e-02;ENDSETUP<jupyter_text>Disconnect<jupyter_code>zenniumConnection.disconnectFromTerm()
    print("finish")<jupyter_output>finish<jupyter_text>Deployment of the source code**The following instruction is not needed by the user.**It automatically extracts the pure python code from the jupyter notebook to provide it to the user. Thus the user does not need jupyter itself and does not have to copy the code manually.The source code is saved in a .py file with the same name as the notebook.<jupyter_code>if executionInNotebook() == True:
        notebookCodeToPython("CurrentVoltageCurve.ipynb")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09144001334890706, 'fraction_numerical': 0.05256132154179877, 'mean_word_length': 7.045637583892617, 'pattern_counts': {'":': 1, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '588162', 'license': 'MIT', 'n_tokens_mistral': 2388, 'n_tokens_neox': 2207, 'n_words': 354, 'path': 'Examples/CurrentVoltageCurve/CurrentVoltageCurve.ipynb', 'repo_name': 'Zahner-elektrik/Thales-Remote-Python', 'size': '5993'}