image thumbnail

Using Model-Based Design for Vehicle Electronics Applications

by

 

29 Aug 2006 (Updated )

This ZIP-file contains the presentation and power window model that was used in the MathWorks webina

mech_interface_blocks_update(blockH)
function mech_interface_blocks_update(blockH)

jactH = find_system(blockH,'LookUnderMasks','on','FollowLinks','on','Classname','JointActuator');
jsenH = find_system(blockH,'LookUnderMasks','on','FollowLinks','on','Classname','JointSensor');

ps_input = find_system(blockH,'LookUnderMasks','on','FollowLinks','on','SubClassname','ps_input');
ps_output = find_system(blockH,'LookUnderMasks','on','FollowLinks','on','SubClassname','ps_output');

prim = get(blockH,'Primitive');
if(~isempty(prim) && ~strcmpi(prim,'<empty>') && ~strcmpi(prim,''))
    % Primitive has been selected (or default selected) in the interface
    % block. So need to push the chosen primitive to the joint sensor and
    % actuator
    set(jactH,'Primitive',prim);
    set(jsenH,'Primitive',prim);
end

switch(get(blockH,'ClassName'))
    case 'PrismaticTranslationalInterface'
        set(jactH,'ActuationStyle','Force','ForceUnits','N');
        set(jsenH,'Velocity','on','VelocityUnits','m/s','Angle','off','ArcVelocity', ... 
            'off','ArcAcceleration','off','CoordPosition','off','Acceleration','off','Quaternion','off', ...
            'QuaternionDT','off','QuaternionDDT','off','Force','off','Torque','off','ReactionForce','off', ...
            'ReactionMoment','off');
        set(ps_input,'Unit','m/s');
        set(ps_output,'Unit','N');

    case 'RevoluteRotationalInterface'
        set(jactH,'ActuationStyle','Force','TorqueUnits','N*m');
        set(jsenH,'Velocity','off','Angle','off','ArcVelocity','on','ArcVelocityUnits', ... 
            'rad/s','ArcAcceleration','off','CoordPosition','off','Acceleration','off','Quaternion','off', ...
            'QuaternionDT','off','QuaternionDDT','off','Force','off','Torque','off','ReactionForce','off', ...
            'ReactionMoment','off');
        set(ps_input,'Unit','rad/s');
        set(ps_output,'Unit','N*m');
end

Contact us