How to read "Temp_Winding_Max" variable values.
Answers
-
Hi Naveen, I don't understand what the question you're asking is. Could you elaborate a bit more in your question?
0 -
I wants to change the fluid flow in Motorcad Thermal module with respect to an output variable "Temp_Winding_Max".
For example, if the output winding temperature is less than 100deg, the inlet fluid flow should be 8, otherwise it should be 6.
However when Im trying to call the output variable in the script, the written variable is not working.
Would like to know whether we can call an output variable value in script.
related to PyMotorCAD | VB Script.
0 -
Hi @James Derrick as described above, any suggestion from PyMotorCAD Team...!!
0 -
@Naveen Kumar Begari Have a look into documenation. you will probably have to change the function name.
0 -
@Rajesh Meena said:
@Naveen Kumar Begari Have a look into documenation. you will probably have to change the function name.Thanks @Rajesh Meena , I vll check with this.
0 -
@Rajesh Meena said:
@Naveen Kumar Begari Have a look into documenation. you will probably have to change the function name.Hi @Rajesh Meena, That was good enough to proceed, but the provided script was executing and displaying incorrect data on the graph.
0 -
Hi @AKD-Scripting-Team , any solutions of this front.?
0 -
@James Derrick and @AKD-Scripting-Team . Any suggestions for this query.?
0 -
Hi @Naveen Kumar Begari can you share a bit more regarding the new problem? Ideally we need to be able to recreate it ourselves to help. We understand that you probably can't share the exact code with us for security reasons, however, if you could make a minimal verifiable reproducible example, like one would on Stack Overflow that demonstrates the problem, we should be able to get to the heart of the issue faster.
0 -
Sure @James Derrick , I vll share it
0 -
Hi @James Derrick Here is the VB Script
`
Function MainFunction(Title)Dim mcad Dim WindingTemp #Create MotorCAD application object Set mcad = CreateObject("motorcad.appautomation") #Avoid immediate updates Call mcad.AvoidImmediateUpdate(True) #Disable error messages Call mcad.SetVariable("ERROR_MESSAGES_DISABLED", 1) #Get the winding temperature variable Call mcad.GetVariable("Temp_Winding_Max", WindingTemp) #Check if WindingTemp is in the range (0, 100) If WindingTemp > 0 And WindingTemp < 100 Then #Set the fluid volume flow rate Dim flowRate flowRate = 8 / 60000 Call mcad.SetVariable("WJ_Fluid_Volume_Flow_Rate", flowRate) #Show the message Call mcad.showmessage("WJ_Fluid_Volume_Flow_Rate = " + CStr(flowRate)) Else #Set the fluid volume flow rate to 0 Call mcad.SetVariable("WJ_Fluid_Volume_Flow_Rate", 0) #Show the message Call mcad.showmessage("WJ_Fluid_Volume_Flow_Rate = " + CStr(0)) End If
End Function
`I wants to change the fluid flow in Motorcad Thermal module with respect to an output variable "Temp_Winding_Max".
For example, if the output winding temperature is less than 100deg, the inlet fluid flow should be 8, otherwise it should be 6.
However when Im trying to call the output variable in the script, the written variable is not working.
Would like to know whether we can call an output variable value in script.related to PyMotorCAD | VB Script.
0 -
`I wants to change the fluid flow in Motorcad Thermal module with respect to an output variable "Temp_Winding_Max".
For example, if the output winding temperature is less than 100deg, the inlet fluid flow should be 8, otherwise it should be 6.
However when Im trying to call the output variable in the script, the written variable is not working.
Would like to know whether we can call an output variable value in script.
related to PyMotorCAD | VB Script.`
0 -
`Function MainFunction(Title)
Dim mcad Dim WindingTemp #Create MotorCAD application object Set mcad = CreateObject("motorcad.appautomation") #Avoid immediate updates Call mcad.AvoidImmediateUpdate(True) #Disable error messages Call mcad.SetVariable("ERROR_MESSAGES_DISABLED", 1) #Get the winding temperature variable Call mcad.GetVariable("Temp_Winding_Max", WindingTemp) #Check if WindingTemp is in the range (0, 100) If WindingTemp > 0 And WindingTemp < 100 Then #Set the fluid volume flow rate Dim flowRate flowRate = 8 / 60000 Call mcad.SetVariable("WJ_Fluid_Volume_Flow_Rate", flowRate) #Show the message Call mcad.showmessage("WJ_Fluid_Volume_Flow_Rate = " + CStr(flowRate)) Else #Set the fluid volume flow rate to 0 Call mcad.SetVariable("WJ_Fluid_Volume_Flow_Rate", 0) #Show the message Call mcad.showmessage("WJ_Fluid_Volume_Flow_Rate = " + CStr(0)) End If
End Function`
0 -
Function MainFunction(Title)
Dim mcad Dim WindingTemp #Create MotorCAD application object Set mcad = CreateObject("motorcad.appautomation") #Avoid immediate updates Call mcad.AvoidImmediateUpdate(True) #Disable error messages Call mcad.SetVariable("ERROR_MESSAGES_DISABLED", 1) #Get the winding temperature variable Call mcad.GetVariable("Temp_Winding_Max", WindingTemp) #Check if WindingTemp is in the range (0, 100) If WindingTemp > 0 And WindingTemp < 100 Then #Set the fluid volume flow rate Dim flowRate flowRate = 8 / 60000 Call mcad.SetVariable("WJ_Fluid_Volume_Flow_Rate", flowRate) #Show the message Call mcad.showmessage("WJ_Fluid_Volume_Flow_Rate = " + CStr(flowRate)) Else #Set the fluid volume flow rate to 0 Call mcad.SetVariable("WJ_Fluid_Volume_Flow_Rate", 0) #Show the message Call mcad.showmessage("WJ_Fluid_Volume_Flow_Rate = " + CStr(0)) End If
End Function
For Better Understanding, this is the complete code.
0 -
@PyMotorCAD-Team may be able to help
0 -
Hi @""Naveen Kumar Begari". This output variable should be accessible with your script. Can I ask if you are seeing an error or any unexpected behaviour? If you try the below script, it should display the max winding temperature in the pop-up. Please let me know if this works as expected.
Dim mcad Dim WindingTemp ' Create MotorCAD application object Set mcad = CreateObject("motorcad.appautomation") ' Get the winding temperature variable Call mcad.GetVariable("Temp_Winding_Max", WindingTemp) Call mcad.showmessage("Temp Winding Max = " + CStr(WindingTemp))``
Do you have more than one Motor-CAD window open? Sometimes ActiveX communication can struggle with more than one instance open. We recommend using Python scripting instead of VBScript, as this uses JSON-RPC communication, which is more stable than ActiveX. Also, with Python, you would have the advantage of having more options to run a script during analysis.
0 -
Hi @PyMotorCAD-Team , Thanks for providing this solution. Hope this information is good enough.
We are opening only one motorCAD window.
Sure team, Python scripting vll be used in further jobs.
Thank you so much @James Derrick
0