1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Pythonで学ぶ鉄道模型工学の概算

Last updated at Posted at 2025-04-03

はじめに

本記事では、鉄道模型工学の概念を解説するためのPythonコードを紹介します。

参考リンクまとめ

Pythonコード

import numpy as np
import matplotlib.pyplot as plt

# 定数
a = 30.05
b = -39.213

# 電圧の範囲(仮定)
voltages = np.linspace(0, 5, 100)  # 電圧を0Vから5Vの範囲で100点生成

# 車速(km/h)を計算
speeds_kmh = a * voltages + b

# 車速を秒速(m/s)に変換
speeds_ms = speeds_kmh / 3.6  # 1 km/h = 1/3.6 m/s

# プロット
plt.figure(figsize=(8, 6))
plt.plot(voltages, speeds_ms, label='Speed (m/s)', color='b')
plt.title('Speed vs Voltage')
plt.xlabel('Voltage (V)')
plt.ylabel('Speed (m/s)')
plt.grid(True)
plt.legend()
plt.show()


結果
image.png

import numpy as np

# 仮定するパラメータ設定(それらしい値を使用)
w1 = 12  # 駆動輪の軸荷重 (N)
w2 = 8   # 従動輪の軸荷重 (N)
theta_deg = 5  # 傾斜角度 (度)
theta_rad = np.deg2rad(theta_deg)  # ラジアンに変換

# 全車両重量
W0 = w1 + w2

# レールからの抗力
f1 = w1 * np.cos(theta_rad)
f2 = w2 * np.cos(theta_rad)

# 出力(プリント風)
print("===== 鉄道模型工学 計算プリント =====")
print(f"駆動輪の軸荷重 w1 = {w1} N")
print(f"従動輪の軸荷重 w2 = {w2} N")
print(f"傾斜角 θ = {theta_deg}")
print("-----------------------------------")
print(f"(1) 全車両重量 W0 = w1 + w2 = {W0:.2f} N")
print(f"(2) レールからの抗力 f1 = w1 * cosθ = {f1:.2f} N")
print(f"(3) レールからの抗力 f2 = w2 * cosθ = {f2:.2f} N")
print("===================================")


結果

===== 鉄道模型工学 計算プリント =====
駆動輪の軸荷重 w1 = 12 N
従動輪の軸荷重 w2 = 8 N
傾斜角 θ = 5 度

(1) 全車両重量 W0 = w1 + w2 = 20.00 N
(2) レールからの抗力 f1 = w1 * cosθ = 11.95 N
(3) レールからの抗力 f2 = w2 * cosθ = 7.97 N

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?