BioSTEAMDevelopmentGroup / Bioindustrial-Park

BioSTEAM's Premier Repository for Biorefinery Models and Results
MIT License
36 stars 17 forks source link

Request for error resolution on creating stream #59

Closed zasddsgg closed 1 year ago

zasddsgg commented 1 year ago

Hello, I encountered an error when creating a stream: SyntaxError: positional argument follows keyword argument, which should be caused by the sodium chloride I added, but I repeatedly adjusted the position of sodium chloride=700 in the bst.Stream, and the error was still reported. May I trouble you for this error code. Thank you very much. Wish you a good day.

The original code is as follows: import biosteam as bst bst.nbtutorial() bst.main_flowsheet.set_flowsheet('corn stover_ethanol') from biorefineries import cellulosic cs = cellulosic.Biorefinery('corn stover ethanol') chemicals_cs = cs.chemicals NaCl = bst.Chemical('sodium chloride') chemicals = bst.Chemicals([]) chemicals.extend(bst.Chemicals([chemicals_cs.Water, chemicals_cs.H2SO4, chemicals_cs.Glucan, chemicals_cs.Xylan, chemicals_cs.Xylitol, chemicals_cs.Cellobiose, chemicals_cs.CSL, chemicals_cs.DenaturedEnzyme, chemicals_cs.Arabinan, chemicals_cs.Mannan, chemicals_cs.Galactan, chemicals_cs.WWTsludge, chemicals_cs.Cellulase, NaCl])) bst.settings.set_thermo(chemicals) a = bst.Stream( ID='a', price=0.0516,
units='kg/hr', Water=500, H2SO4=600, sodium chloride=700, )

yoelcortes commented 1 year ago

@zasddsgg, syntax errors are Python errors unrelated to BioSTEAM, I encourage you to search online why these occur. Here are a couple of options:

Use a dictionary

a = bst.Stream(
ID='a',
price=0.0516,
units='kg/hr',
Water=500,
H2SO4=600,
**{'sodium chloride': 700}
)

Define an alias without a space:

chemicals.set_alias('sodium chloride', 'NaOH')
a = bst.Stream(
ID='a',
price=0.0516,
units='kg/hr',
Water=500,
H2SO4=600,
NaOH=700,
)

Thanks,

zasddsgg commented 1 year ago

Thank you very much for help in solving this problem. I got it. Wish you a good day.


发件人: Yoel @.> 发送时间: 2023年2月22日 11:34 收件人: BioSTEAMDevelopmentGroup/Bioindustrial-Park @.> 抄送: Dexin ZHANG 张德鑫 @.>; Mention @.> 主题: Re: [BioSTEAMDevelopmentGroup/Bioindustrial-Park] Request for error resolution on creating stream (Issue #59)

@zasddsgghttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzasddsgg&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7C30fa9d1caaef45a58c6b08db1485b5af%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126336729281947%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sXFQz7sSvFM2BdZhZkhtO4%2BIguPm%2FIlEKPGh3NPOXd4%3D&reserved=0, syntax errors are Python errors unrelated to BioSTEAM, I encourage you to search online why these occur. Here are a couple of options:

Use a dictionary

a = bst.Stream( ID='a', price=0.0516, units='kg/hr', Water=500, H2SO4=600, **{'sodium chloride': 700} )

Define an alias without a space:

chemicals.set_alias('sodium chloride', 'NaOH') a = bst.Stream( ID='a', price=0.0516, units='kg/hr', Water=500, H2SO4=600, NaOH=700, )

Thanks,

― Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBioSTEAMDevelopmentGroup%2FBioindustrial-Park%2Fissues%2F59%23issuecomment-1439392067&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7C30fa9d1caaef45a58c6b08db1485b5af%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126336729281947%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jMgUFvmpLWPmVnGQHcES5rJlZ7x6L%2FY9223L%2BLSjpF0%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA57G2ROJ52L6VKOP2AHH6EDWYWCMHANCNFSM6AAAAAAVDZJUHA&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7C30fa9d1caaef45a58c6b08db1485b5af%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126336729281947%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2MJm9Rca3jRXAdx%2F%2BYyAwO%2BRdksc%2Fgy9mZHuz1zKxqs%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

yoelcortes commented 1 year ago

@zasddsgg, no problem! If you find BioSTEAM useful, don't forget to "star" the repositories (thermosteam, biosteam, bioindustrial-park)! It would help a lot for greater adoption and recognition.

image

zasddsgg commented 1 year ago

Of course, BioSTEAM is very useful. I have stared the repositories (thermosteam, biosteam, bioindustrial-park). Thanks a lot.


发件人: Yoel @.> 发送时间: 2023年2月22日 12:21 收件人: BioSTEAMDevelopmentGroup/Bioindustrial-Park @.> 抄送: Dexin ZHANG 张德鑫 @.>; Mention @.> 主题: Re: [BioSTEAMDevelopmentGroup/Bioindustrial-Park] Request for error resolution on creating stream (Issue #59)

@zasddsgghttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzasddsgg&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7Ce2578acce5594f552f8d08db148c39a1%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126364709999805%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NMPErosdrnAjtRfoxGfNc7Y0207PaGQecUerFI3bgh4%3D&reserved=0, no problem! If you find BioSTEAM useful, could you "star" the repositories (thermosteam, biosteam, bioindustrial-park? It would help a lot for greater adoption and recognition.

[image]https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F29529649%2F220521008-1638266f-2c16-4776-8328-52aac2c7bade.png&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7Ce2578acce5594f552f8d08db148c39a1%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126364709999805%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VSzLm63Im%2Bcz0ofqQmumw%2FFDyszY2GT41ZGPIx45luI%3D&reserved=0

― Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBioSTEAMDevelopmentGroup%2FBioindustrial-Park%2Fissues%2F59%23issuecomment-1439418106&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7Ce2578acce5594f552f8d08db148c39a1%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126364709999805%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=n59%2BPqmbaHhIqMHRSQa3R%2Bsc%2FUsDE%2FcagjIr4oz8wc4%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA57G2RK33JF2VSDNB3ICGPTWYWH3HANCNFSM6AAAAAAVDZJUHA&data=05%7C01%7Czhangdexin%40westlake.edu.cn%7Ce2578acce5594f552f8d08db148c39a1%7C7e82de2f7ef644169b9644c1457be81b%7C1%7C0%7C638126364709999805%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ee11rYP7xJDFJKm7Gm0liW0c3rKWJ7mmCsZJh7QPLuU%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>