Jump to content

Component: Electrical Machines (AllCode): Difference between revisions

From Flowcode Help
XML import
 
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{| style="width:50%"
 
{| width="50%"
|-
|-
| width="20%" style="color: gray;" | Author
| width="20%" style="color:gray;" | Author
| Matrix TSL
| Matrix TSL
|-
|-
| width="20%" style="color: gray;" | Version
| width="20%" style="color:gray;" | Version
| 2.0 (Release)
| 2.0
|-
|-
| width="20%" style="color: gray;" | Category
| width="20%" style="color:gray;" | Category
| AllCode
| AllCode
|}
|}




==Electrical Machines component==
A set of functions to communicate with the Matrix EM hardware.  Allows the functions to be easily standardised across all SCADA programs.


==[[File:Component Icon c3e5eb13_e03d_4ca6_be4d_1c63ad107a35.png|Image]] Electrical Machines component==
==Component Source Code==
A set of functions to communicate with the Matrix EM hardware.
Allows the functions to be easily standardised across all SCADA programs.


==Examples==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_EM_Functions.fcsx FC_Comp_Source_EM_Functions.fcsx]
''<span style="color:red;">No additional examples</span>''


Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EM_Functions.fcsx FC_Comp_Source_EM_Functions.fcsx]


==Downloadable macro reference==
==Detailed description==


''This component does not contain any downloadable macros''


==Simulation macro reference==


===<span style="font-weight: normal;"><u><tt>GetLogDataReady</tt></u></span>===
Checks to see if the logging is complete and ready to read.


'''Parameters'''


:''This macro has no parameters''




'''Return value'''


:[[Variable Types|BOOL]] : Returns true if the operation is a success, else false




===<span style="font-weight: normal;"><u><tt>GetRPM</tt></u></span>===
Reads the speed in RPM


'''Parameters'''


:''This macro has no parameters''




'''Return value'''


:[[Variable Types|UINT]]
''No detailed description exists yet for this component''


==Examples==


===<span style="font-weight: normal;"><u><tt>GetWeight</tt></u></span>===
Reads the voltage of a single channel


'''Parameters'''


:[[Variable Types|BYTE]] ''Scale''
::Range: 0-1 -  0=Weight, 1=Torque




'''Return value'''


:[[Variable Types|FLOAT]]




===<span style="font-weight: normal;"><u><tt>SetControlKP</tt></u></span>===
''<span style="color:red;">No additional information</span>''






'''Parameters'''


:[[Variable Types|FLOAT]] ''Value''




'''Return value'''


:''This call does not return a value''


''<span style="color:red;">No additional examples</span>''


===<span style="font-weight: normal;"><u><tt>SetControlSetpoint</tt></u></span>===
''<span style="color:red;">No additional information</span>''






'''Parameters'''


:[[Variable Types|FLOAT]] ''Value''




'''Return value'''


:''This call does not return a value''




===<span style="font-weight: normal;"><u><tt>GetAPIVersion</tt></u></span>===
Reads the API firmware version


'''Parameters'''


:''This macro has no parameters''
==Macro reference==


===Get3PhaseMode===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Get3PhaseMode'''
|-
| colspan="2" | Checks to see if the brushless mode is enabled&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:[[Variable Types|BYTE]]
===GetAPIVersion===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetAPIVersion'''
|-
| colspan="2" | Reads the API firmware version&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===<span style="font-weight: normal;"><u><tt>GetLogData</tt></u></span>===
===GetAbsPosition===
Gets a 64-byte packet of log data. 250 packets make up a single log.
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetAbsPosition'''
|-
| colspan="2" | Reads the absolute position of the encoder&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


Returns 0 if comms failed and 1 if comms OK


'''Parameters'''
===GetCommsOK===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetCommsOK'''
|-
| colspan="2" | Checks if comms are ok and stable&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|BYTE]] ''Buffer''
::Buffer to store the incoming log data


===GetControlFeedback===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetControlFeedback'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:[[Variable Types|BOOL]] : Returns true if the operation is a success, else false
===GetControlOutputs===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetControlOutputs'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Data
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===<span style="font-weight: normal;"><u><tt>GetDataArray</tt></u></span>===
===GetCurrent===
Collects a data array from the EM box full of control data.
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetCurrent'''
|-
| colspan="2" | Reads the current of a single channel&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-6 - 0=DC1, 1=DC2, 2=U, 3=V, 4=W, 5=Dyno, 6=I, 7=TotalDriver&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


Each set of data includes:


Setpoint, Feedback, Poutput, Ioutput, Doutput
===GetDataArray===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetDataArray'''
|-
| colspan="2" | Collects a data array from the EM box full of control data. Each set of data includes: Setpoint, Feedback, Poutput, Ioutput, Doutput Returns the number of complete data samples collected.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | data
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


Returns the number of complete data samples collected.


'''Parameters'''
===GetErrorStatus===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetErrorStatus'''
|-
| colspan="2" | Gets the current error status. Error status will automatically resolve itself once the causing condition has been removed. 0 = No Error 1 = Error - likely over current or brownout&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|FLOAT]] ''data''


===GetLogData===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetLogData'''
|-
| colspan="2" | Gets a 64-byte packet of log data. 250 packets make up a single log. Returns 0 if comms failed and 1 if comms OK&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Buffer
|-
| colspan="2" | Buffer to store the incoming log data&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:[[Variable Types|BYTE]]
===GetLogDataReady===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetLogDataReady'''
|-
| colspan="2" | Checks to see if the logging is complete and ready to read.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===<span style="font-weight: normal;"><u><tt>GetSafetySwitch</tt></u></span>===
===GetLogStartAngle===
Reads the safety switch
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetLogStartAngle'''
|-
| colspan="2" | Collects the U Phase angle at the start of logging.  Used to calculate and re-create the 3Phase voltage data.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Parameters'''


:''This macro has no parameters''
===GetMotorDirection===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetMotorDirection'''
|-
| colspan="2" | Reads the motor direction&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Return value'''
===GetRPM===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetRPM'''
|-
| colspan="2" | Reads the speed in RPM&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|UINT]]


===GetSafetySwitch===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetSafetySwitch'''
|-
| colspan="2" | Reads the safety switch&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


===<span style="font-weight: normal;"><u><tt>SetControlKI</tt></u></span>===
''<span style="color:red;">No additional information</span>''


===GetVoltage===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetVoltage'''
|-
| colspan="2" | Reads the voltage of a single channel&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0-5 -  0=DC1, 1=DC2, 2=U, 3=V, 4=W, 5=VEXT&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Parameters'''
===GetWeight===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetWeight'''
|-
| colspan="2" | Reads the voltage of a single channel&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Scale
|-
| colspan="2" | Range: 0-1 -  0=Weight, 1=Torque&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|FLOAT]] ''Value''


===Initialise===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
| colspan="2" | Returns 1 if the connection is ok and communications have been established&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MotorType
|-
| colspan="2" | 0=DC, 1=1Phase, 2=3Phase, 3=AngleControl&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:''This call does not return a value''
===SetAbsPosition===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetAbsPosition'''
|-
| colspan="2" | Resets the absolute motor position to 0&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===<span style="font-weight: normal;"><u><tt>ZeroLoadCell</tt></u></span>===
===SetActive===
''<span style="color:red;">No additional information</span>''
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetActive'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Active
|-
| colspan="2" | 0=Off, 1=On&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===SetCapacitorBank===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetCapacitorBank'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Cap
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Parameters'''


:''This macro has no parameters''
===SetControlKD===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetControlKD'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Return value'''
===SetControlKI===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetControlKI'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:''This call does not return a value''


===SetControlKP===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetControlKP'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


===<span style="font-weight: normal;"><u><tt>SetControlMaxDrivePercentage</tt></u></span>===
''<span style="color:red;">No additional information</span>''


===SetControlMaxDrivePercentage===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetControlMaxDrivePercentage'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | Range 0.0-1.0&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Parameters'''
===SetControlSetpoint===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetControlSetpoint'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|FLOAT]] ''Value''
::Range 0.0-1.0


===SetDriveMode===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetDriveMode'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Mode
|-
| colspan="2" | 0=PWM, 1=On/Off/Float&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:''This call does not return a value''
===SetDynoLoad===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetDynoLoad'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Load
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===<span style="font-weight: normal;"><u><tt>SetMotorType</tt></u></span>===
===SetFan===
''<span style="color:red;">No additional information</span>''
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetFan'''
|-
| colspan="2" | |Sets the speed of the FAN from 0 (MIN)  to 3000 (MAX)&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Speed
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===SetFrequency===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetFrequency'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Frequency
|-
| colspan="2" | Frequency of sine wave in Hz&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Parameters'''


:[[Variable Types|BYTE]] ''MotorType''
===SetLoadCellCalibration===
::0=DC, 1=1 Phase, 2=3 Phase
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetLoadCellCalibration'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Return value'''
===SetMotorDirection===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetMotorDirection'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MotorDirection
|-
| colspan="2" | 0=FW, 1=BW&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:''This call does not return a value''


===SetMotorType===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetMotorType'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MotorType
|-
| colspan="2" | 0=DC, 1=1 Phase, 2=3 Phase&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


===<span style="font-weight: normal;"><u><tt>SetLoadCellCalibration</tt></u></span>===
''<span style="color:red;">No additional information</span>''


===SetTCPProps===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetTCPProps'''
|-
| colspan="2" | Sets the TCP IP address and Port&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP0
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP1
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP2
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP3
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Parameters'''
===SetThreePhaseDriveMode===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetThreePhaseDriveMode'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Mode
|-
| colspan="2" | 0=Simple, 1=Accurate&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|FLOAT]] ''Value''


 
===SetVoltage===
'''Return value'''
{| class="mtx-class-macrotable wikitable"
 
|-
:''This call does not return a value''
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
 
| width="90%" class="mtx-class-macrohead" | '''SetVoltage'''
 
|-
===<span style="font-weight: normal;"><u><tt>GetVoltage</tt></u></span>===
| colspan="2" | Sets the DC Voltage from 0 to 24V&nbsp;
Reads the voltage of a single channel
|-
 
|-
'''Parameters'''
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | Voltage
:[[Variable Types|BYTE]] ''Channel''
|-
::Range: 0-5 - 0=DC1, 1=DC2, 2=U, 3=V, 4=W, 5=VEXT
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
'''Return value'''
| width="90%" | Index
 
|-
:[[Variable Types|FLOAT]]
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
===<span style="font-weight: normal;"><u><tt>GetControlFeedback</tt></u></span>===
| width="90%" style="border-top: 2px solid #000;" | ''Return''
''<span style="color:red;">No additional information</span>''
|}
 
 
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|FLOAT]]
 
 
===<span style="font-weight: normal;"><u><tt>SetControlKD</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|FLOAT]] ''Value''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetCapacitorBank</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Cap''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>GetCommsOK</tt></u></span>===
Checks if comms are ok and stable
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|BOOL]] : Returns true if the operation is a success, else false
 
 
===<span style="font-weight: normal;"><u><tt>GetLogStartAngle</tt></u></span>===
Collects the U Phase angle at the start of logging.
 
Used to calculate and re-create the 3Phase voltage data.
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>SetVoltage</tt></u></span>===
Sets the DC Voltage from 0 to 24V
 
'''Parameters'''
 
:[[Variable Types|FLOAT]] ''Voltage''
 
:[[Variable Types|BYTE]] ''Index''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>Get3PhaseMode</tt></u></span>===
Checks to see if the brushless mode is enabled
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|BOOL]] : Returns true if the operation is a success, else false
 
 
===<span style="font-weight: normal;"><u><tt>GetAbsPosition</tt></u></span>===
Reads the absolute position of the encoder
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|ULONG]]
 
 
===<span style="font-weight: normal;"><u><tt>SetFan</tt></u></span>===
|Sets the speed of the FAN from 0 (MIN)  to 3000 (MAX)
 
'''Parameters'''
 
:[[Variable Types|UINT]] ''Speed''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetMotorDirection</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|BOOL]] ''MotorDirection''
::0=FW, 1=BW
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>GetMotorDirection</tt></u></span>===
Reads the motor direction
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|UINT]]
 
 
===<span style="font-weight: normal;"><u><tt>SetThreePhaseDriveMode</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|BOOL]] ''Mode''
::0=Simple, 1=Accurate
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>GetCurrent</tt></u></span>===
Reads the current of a single channel
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Range: 0-6 - 0=DC1, 1=DC2, 2=U, 3=V, 4=W, 5=Dyno, 6=I, 7=TotalDriver
 
 
'''Return value'''
 
:[[Variable Types|FLOAT]]
 
 
===<span style="font-weight: normal;"><u><tt>SetFrequency</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|UINT]] ''Frequency''
::Frequency of sine wave in Hz
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetDynoLoad</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|FLOAT]] ''Load''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>GetErrorStatus</tt></u></span>===
Gets the current error status.
 
Error status will automatically resolve itself once the causing condition has been removed.
 
0 = No Error
 
1 = Error - likely over current or brownout
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>GetControlOutputs</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|FLOAT]] ''Data''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetActive</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|BOOL]] ''Active''
::0=Off, 1=On
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetDriveMode</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Mode''
::0=PWM, 1=On/Off/Float
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetTCPProps</tt></u></span>===
Sets the TCP IP address and Port
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''IP0''
 
:[[Variable Types|BYTE]] ''IP1''
 
:[[Variable Types|BYTE]] ''IP2''
 
:[[Variable Types|BYTE]] ''IP3''
 
:[[Variable Types|UINT]] ''Port''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>SetAbsPosition</tt></u></span>===
Resets the absolute motor position to 0
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
Returns 1 if the connection is ok and communications have been established
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''MotorType''
::0=DC, 1=1Phase, 2=3Phase, 3=AngleControl
 
 
'''Return value'''
 
:[[Variable Types|BOOL]] : Returns true if the operation is a success, else false




===ZeroLoadCell===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''ZeroLoadCell'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




==Property reference==
==Property reference==
<span style="font-weight: normal;"><u>Comms Mode</u></span>


This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''CommsMode''.
{| class="mtx-class-macrotable wikitable"
 
|-
''<span style="color:red;">No additional information</span>''
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
 
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
 
|-
 
|-
<span style="font-weight: normal;"><u>Stop On Error</u></span>
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
 
| width="90%" class="mtx-class-propfolder" | Communications
This property is of type ''True or false'' and can be referenced with the variable name ''StopOnError''.
|-
 
|-
Automatically allows the runtime to stop if there is a communications error.
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Comms Mode
<span style="font-weight: normal;"><u>Autodetect Port</u></span>
|-
 
| colspan="2" | &nbsp;
This property is of type ''True or false'' and can be referenced with the variable name ''AutoDetect''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
''<span style="color:red;">No additional information</span>''
| width="90%" | Stop On Error
 
|-
 
| colspan="2" | Automatically allows the runtime to stop if there is a communications error.&nbsp;
 
|-
<span style="font-weight: normal;"><u>Network Interface</u></span>
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
 
| width="90%" class="mtx-class-propfolder" | USB Communications
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''NetworkComms1::NetworkInterface''.
|-
 
|-
Some computers may have several network interfaces such as ethernet ports and wifi access.
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Autodetect Port
Select the correct network interface for the network you wish to connect to.
|-
 
| colspan="2" | &nbsp;
Use the IP address to confirm you are connected to the right network.
|-
 
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>IP Address</u></span>
| width="90%" class="mtx-class-propfolder" | Runtime Statistics
 
|-
This property is of type ''Line of text'' and can be referenced with the variable name ''NetworkComms1::IPAddress''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
IP Address of the selected network interface.
| width="90%" | Console Data
 
|-
<span style="font-weight: normal;"><u>EM Box IP Address</u></span>
| colspan="2" | Allow console data to be generated showing the high level EM communications and returns&nbsp;
 
|}
This property is of type ''Line of text'' and can be referenced with the variable name ''BoxIP''.
 
''<span style="color:red;">No additional information</span>''
 
 
 
<span style="font-weight: normal;"><u>EM Box Port</u></span>
 
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''BoxPort''.
 
''<span style="color:red;">No additional information</span>''
 
 
 
<span style="font-weight: normal;"><u>Console Data</u></span>
 
This property is of type ''True or false'' and can be referenced with the variable name ''ConsoleData''.
 
Allow console data to be generated showing the high level EM communications and returns

Latest revision as of 14:36, 13 July 2026

Author Matrix TSL
Version 2.0
Category AllCode


Electrical Machines component

A set of functions to communicate with the Matrix EM hardware. Allows the functions to be easily standardised across all SCADA programs.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_EM_Functions.fcsx

Please click here to view the component source code (Beta): FC_Comp_Source_EM_Functions.fcsx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

Get3PhaseMode

Get3PhaseMode
Checks to see if the brushless mode is enabled 
- BOOL Return


GetAPIVersion

GetAPIVersion
Reads the API firmware version 
- BYTE Return


GetAbsPosition

GetAbsPosition
Reads the absolute position of the encoder 
- ULONG Return


GetCommsOK

GetCommsOK
Checks if comms are ok and stable 
- BOOL Return


GetControlFeedback

GetControlFeedback
 
- FLOAT Return


GetControlOutputs

GetControlOutputs
 
- FLOAT Data
 
- VOID Return


GetCurrent

GetCurrent
Reads the current of a single channel 
- BYTE Channel
Range: 0-6 - 0=DC1, 1=DC2, 2=U, 3=V, 4=W, 5=Dyno, 6=I, 7=TotalDriver 
- FLOAT Return


GetDataArray

GetDataArray
Collects a data array from the EM box full of control data. Each set of data includes: Setpoint, Feedback, Poutput, Ioutput, Doutput Returns the number of complete data samples collected. 
- FLOAT data
 
- BYTE Return


GetErrorStatus

GetErrorStatus
Gets the current error status. Error status will automatically resolve itself once the causing condition has been removed. 0 = No Error 1 = Error - likely over current or brownout 
- BYTE Return


GetLogData

GetLogData
Gets a 64-byte packet of log data. 250 packets make up a single log. Returns 0 if comms failed and 1 if comms OK 
- BYTE Buffer
Buffer to store the incoming log data 
- BOOL Return


GetLogDataReady

GetLogDataReady
Checks to see if the logging is complete and ready to read. 
- BOOL Return


GetLogStartAngle

GetLogStartAngle
Collects the U Phase angle at the start of logging. Used to calculate and re-create the 3Phase voltage data. 
- BYTE Return


GetMotorDirection

GetMotorDirection
Reads the motor direction 
- UINT Return


GetRPM

GetRPM
Reads the speed in RPM 
- UINT Return


GetSafetySwitch

GetSafetySwitch
Reads the safety switch 
- UINT Return


GetVoltage

GetVoltage
Reads the voltage of a single channel 
- BYTE Channel
Range: 0-5 - 0=DC1, 1=DC2, 2=U, 3=V, 4=W, 5=VEXT 
- FLOAT Return


GetWeight

GetWeight
Reads the voltage of a single channel 
- BYTE Scale
Range: 0-1 - 0=Weight, 1=Torque 
- FLOAT Return


Initialise

Initialise
Returns 1 if the connection is ok and communications have been established 
- BYTE MotorType
0=DC, 1=1Phase, 2=3Phase, 3=AngleControl 
- BOOL Return


SetAbsPosition

SetAbsPosition
Resets the absolute motor position to 0 
- VOID Return


SetActive

SetActive
 
- BOOL Active
0=Off, 1=On 
- VOID Return


SetCapacitorBank

SetCapacitorBank
 
- BYTE Cap
 
- VOID Return


SetControlKD

SetControlKD
 
- FLOAT Value
 
- VOID Return


SetControlKI

SetControlKI
 
- FLOAT Value
 
- VOID Return


SetControlKP

SetControlKP
 
- FLOAT Value
 
- VOID Return


SetControlMaxDrivePercentage

SetControlMaxDrivePercentage
 
- FLOAT Value
Range 0.0-1.0 
- VOID Return


SetControlSetpoint

SetControlSetpoint
 
- FLOAT Value
 
- VOID Return


SetDriveMode

SetDriveMode
 
- BYTE Mode
0=PWM, 1=On/Off/Float 
- VOID Return


SetDynoLoad

SetDynoLoad
 
- FLOAT Load
 
- VOID Return


SetFan

SetFan
|Sets the speed of the FAN from 0 (MIN) to 3000 (MAX) 
- UINT Speed
 
- VOID Return


SetFrequency

SetFrequency
 
- UINT Frequency
Frequency of sine wave in Hz 
- VOID Return


SetLoadCellCalibration

SetLoadCellCalibration
 
- FLOAT Value
 
- VOID Return


SetMotorDirection

SetMotorDirection
 
- BOOL MotorDirection
0=FW, 1=BW 
- VOID Return


SetMotorType

SetMotorType
 
- BYTE MotorType
0=DC, 1=1 Phase, 2=3 Phase 
- VOID Return


SetTCPProps

SetTCPProps
Sets the TCP IP address and Port 
- BYTE IP0
 
- BYTE IP1
 
- BYTE IP2
 
- BYTE IP3
 
- UINT Port
 
- VOID Return


SetThreePhaseDriveMode

SetThreePhaseDriveMode
 
- BOOL Mode
0=Simple, 1=Accurate 
- VOID Return


SetVoltage

SetVoltage
Sets the DC Voltage from 0 to 24V 
- FLOAT Voltage
 
- BYTE Index
 
- VOID Return


ZeroLoadCell

ZeroLoadCell
 
- VOID Return


Property reference

Properties
Communications
Comms Mode
 
Stop On Error
Automatically allows the runtime to stop if there is a communications error. 
USB Communications
Autodetect Port
 
Runtime Statistics
Console Data
Allow console data to be generated showing the high level EM communications and returns