Hi @Sietse,
The resistance force you wish to implement is typically derived from various real-world factors such as aerodynamic drag, rolling resistance, and mechanical losses in the drivetrain. The formula F = P/v suggests that the force exerted can be calculated from power (P) divided by velocity (v). This means that as speed varies during the drive cycle, so too will the resistance force acting on the vehicle. My suggestion would be creating a MATLAB Function block or use a Simulink block to calculate the resistance force based on your drive cycle data. This block should take the power and current velocity as inputs and output the resistance force:
function F_resistance = calculateResistance(P, v) if v ~= 0 F_resistance = P / v; % Ensure division by zero is avoided else F_resistance = 0; % No velocity implies no resistance end end
Use the output from your resistance calculation block as an additional input to the tire model. Specifically, connect it to a suitable port in either the Tire (Friction Parameterized) or Tire (Magic Formula) blocks, depending on your choice.
https://www.mathworks.com/help/sdl/ref/tiremagicformula.html?s_tid=doc_ta
Ensure that this force acts in opposition to the direction of motion, thereby simulating realistic driving conditions. Run simulations using various drive cycles to observe how well your model's torque and speed correlate with real-world data. Adjust parameters such as friction coefficients or rolling resistance settings in your tire model if necessary.
Make sure to use accurate drive cycle data representative of real-world driving conditions (e.g., urban vs highway driving) to feed into your power calculations. Also, the fidelity of your model can be increased by incorporating other resistive forces like aerodynamic drag or adjusting tire parameters dynamically based on load and speed and keep an eye on simulation performance; increasing model complexity can lead to longer simulation times, especially if you're simulating HIL scenarios.
By following these steps, you can successfully integrate an external resistance force into your Simscape model, enhancing its accuracy in simulating real-world vehicle dynamics. Make sure to continuously validate your model against empirical data to ensure its reliability and accuracy over a range of operating conditions.
Hope this helps.