Skip to content

Instantly share code, notes, and snippets.

@yonta
Last active May 23, 2023 07:56
Show Gist options
  • Save yonta/322d95892ca54ba1e091c7a0c0e7e7a9 to your computer and use it in GitHub Desktop.
Save yonta/322d95892ca54ba1e091c7a0c0e7e7a9 to your computer and use it in GitHub Desktop.
電気・ガス代の比較
chubudenki_base_price = 1144
chubudenki1(x) = (x < 0) ? NaN : ((x <= 120) ? 21.4 * x + chubudenki_base_price : NaN)
chubudenki2(x) = (x <= 120) ? chubudenki1(x) : ((x <= 300) ? 25.51 * (x - 120) + chubudenki1(120) : NaN)
chubudenki3(x) = (x <= 300) ? chubudenki2(x) : 28.46 * (x - 300) + chubudenki2(300)
tohodenki_base_price = 936
tohodenki1(x) = (x < 0) ? NaN : ((x <= 120) ? 21.02 * x + tohodenki_base_price : NaN)
tohodenki2(x) = (x <= 120) ? tohodenki1(x) : ((x <= 200) ? 25.46 * (x - 120) + tohodenki1(120) : NaN)
tohodenki3(x) = (x <= 200) ? tohodenki2(x) : ((x <= 250) ? 25.48 * (x - 200) + tohodenki2(200) : NaN)
tohodenki4(x) = (x <= 250) ? tohodenki3(x) : ((x <= 300) ? 25.50 * (x - 250) + tohodenki3(250) : NaN)
tohodenki5(x) = (x <= 300) ? tohodenki4(x) : ((x <= 350) ? 26.43 * (x - 300) + tohodenki4(300) : NaN)
tohodenki6(x) = (x <= 350) ? tohodenki5(x) : ((x <= 400) ? 26.96 * (x - 350) + tohodenki5(350) : NaN)
aidenki_impl(x) = 26.30 * x
aidenki_min = 231 * 4
aidenki(x) = (aidenki_impl(x) <= aidenki_min) ? aidenki_min : aidenki_impl(x)
ast1(x) = 21.8 * x + 1000
ast2(x) = (x <= 120) ? ast1(x) : 23.2 * (x - 120) + ast1(120)
ast3(x) = (x <= 300) ? ast2(x) : 25.3 * (x - 300) + ast2(300)
rakuten(x) = 26.5 * x
set xrange[100:500]
set yrange[0:600]
plot (chubudenki3(x) - rakuten(x))
# # plot chubudenki3(x)
# # replot tohodenki6(x)
# # replot aidenki(x)
# plot (chubudenki3(x) - tohodenki6(x))
chubugass1(x) = (x < 0) ? NaN : ((x < 20) ? 204.52 * x + 759 : NaN)
chubugass2(x) = (x <= 20) ? chubugass1(x) : ((x <= 50) ? 156.29 * x + 1616.39 : NaN)
chubugass(x) = chubugass2(x) * 0.98
tohogass1(x) = (x < 0) ? NaN : ((x < 20) ? 204.51 * x + 759 : NaN)
tohogass2(x) = (x <= 20) ? tohogass1(x) : ((x <= 50) ? 164.55 * x + 1558.33 : NaN)
set xrange [0:50]
set yrange [0:600]
# plot chubugass(x)
# replot tohogass2(x)
plot (tohogass2(x) - chubugass(x))
# 基本料金と従量料金による価格比較
# 燃料費調整額は計算に含んでいないが、ほぼどの会社も一緒の前提としている
# 契約の前提は以下
# - 40A
# - 使用量は月によるが200〜500W
set xrange[0:500]
##### 中部
# 中部電力ミライズ
# chubudenki_base_price = 1144
# chubudenki1(x) = (x < 0) ? NaN : ((x <= 120) ? 21.4 * x + chubudenki_base_price : NaN)
# chubudenki2(x) = (x <= 120) ? chubudenki1(x) : ((x <= 300) ? 25.51 * (x - 120) + chubudenki1(120) : NaN)
# chubudenki3(x) = (x <= 300) ? chubudenki2(x) : 28.46 * (x - 300) + chubudenki2(300)
# chubudenki(x) = chubudenki3(x) - 153 - (4900 - 4500) / 12
# 楽天電気
# rakuten(x) = 26.5 * x
# plot chubudenki(x)
# replot rakuten(x)
##### 関東
# 東京電力TECPO スタンダードS
tepco_base = 286 * 4
tepco_usage(x) = (x < 0) ? NaN : \
(x <= 120) ? 19.91 * x : \
(x <= 300) ? 26.49 * (x - 120) + 19.91 * 120 : \
30.60 * (x - 300) + 26.49 * 180 + 19.91 * 120
tepco(x) = tepco_usage(x) + tepco_base
# CDエナジーダイレクト ベーシックでんきB
cd_basicb_base = 1070.64
cd_basicb_usage(x) = (x < 0) ? NaN : \
(x <= 120) ? 19.78 * x : \
(x <= 300) ? 25.47 * (x - 120) + 19.78 * 120 : \
26.38 * (x - 300) + 25.47 * 180 + 19.78 * 120
cd_basicb(x) = cd_basicb_usage(x) + cd_basicb_base
# CDエナジーダイレクト ファミリーでんき
cd_family_base = 1070.64
cd_family_usage(x) = (x < 0) ? NaN : \
(x <= 300) ? 7049.16 : \
25.47 * (x - 300) + 7049.16
cd_family(x) = cd_family_usage(x) + cd_family_base
plot tepco(x)
replot cd_basicb(x)
replot cd_family(x)
# 差額計算
# set yrange[0:]
#
# plot (chubudenki(x) - rakuten(x))
pause -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment