Introduction
Computersimulation,alsoknownascomputersimulation,referstoacomputerprogramusedtosimulateanabstractmodelofaspecificsystem.
History
Thedevelopmentofcomputersimulationisinseparablefromtherapiddevelopmentofthecomputeritself.Itsfirstlarge-scaledevelopmentwasanimportantpartofthefamousManhattanProject.IntheSecondWorldWar,inordertosimulatetheprocessofanuclearexplosion,peopleappliedtheMonteCarlomethodtosimulatewith12hard-ballmodels.Computersimulationwasoriginallyusedasasupplementtootheraspectsofresearch,butwhenpeoplediscovereditsimportance,itwaswidelyusedasaseparatesubject.
Types
Usuallydividedintothefollowingcategories:
Discretesimulation
Analogoussimulation
Simulationbasedonprobeelement
Simulationofrandomprocessordeterministicmode
li>
Advantagesanddisadvantagesofcomputersimulation
Intheapplicationofcomputersimulationforriskanalysis,itshouldbepointedoutattheendthatthismethodrequiresinvestmentexpenditure,unitsales,andproductprices.,Theprobabilitydistributionofmanyvariablessuchasthepriceofinputfactors,thelifeofassets,etc.,andaconsiderableamountofprogrammingcostsandcomputeroperatingcostsneedtobespent.Therefore,full-scalesimulationisgenerallynotapplicable(exceptforlarge-scaleandexpensiveplanssuchasexpansionoflargefactoriesorproductionofnewproducts).Intheseexceptionalcases,whencompaniesaredecidingwhethertoimplementalarge-scaleplanthatwillcostmillionsofdollars,computersimulationscanhelpin-depthevaluationoftheadvantagesanddisadvantagesofthevariousalternatives.
Developmentprocess
Whenpeopledesignandconstructcomplexsystems,orstudythelongevolutionaryprocessinnature,humansociety,andthingsthatarenoteasytorepeatexperiments,ifyouTocarryouttheexperiment,consideringthefactorsoftime,manpower,materialresources,etc.,itwillbeexpensive,orevenimpossible.Therefore,amodelneedstobemanufacturedtoperformvarioustests.
Inordertosimulatethesystem,wemustfirstdetermineorexpressthesystemtobestudied.Mathematicalmodelscanbeusedtodetermineasystemmoreconvenientlyandfullyreflecttheexistingknowledgeofthesystemorhypothesesthatneedtobeverified,butitlacksintuitionandisnotconvenientforexperimentation.Onthebasisofthemathematicalmodel,aphysicalmodelcanbefurthermade,whichreflectsthenatureoftherealsystemrequiredbypeople,butdoesnothavetobecompletelyconsistentwiththerealsystemintermsofformandscale.Itismoreintuitiveandcredibletotestwithaphysicalmodel,butitisstillnoteconomicalandconvenient.
Aftertheemergenceofprogrammabledigitalcomputers,becauseofitsstrongmathematicaloperationsanddataprocessingcapabilities,mathematicalmodelscanbecompiledintocomputerprogramstoprovidenewanduniversaltestmethods.Computerscanalsobeusedtosimulateactivitiesrelatedtooperationsresearch,forexample,tosimulatethestepstakenbythetwopartiesparticipatinginthecompetitionandthefinaloutcome.Itsapplicationfieldsquicklyexpandedtovarioustypesofsystems,fromlarge-scalesystemstosmall-scalesystems.Themathematicaldescriptionofthesesystemsisoftenverycomplicated,anditisverydifficulttogiveacompleteanalyticalsolutionoranaccuratenumericalsolution.Throughtrialanderror,computersimulationhelpspeopleunderstandtheperformanceofthesystem,testexpectedhypotheses,andperformsystemanalysis,design,predictionorevaluation.Itcanalsoprovideaveryrealisticenvironmenttotrainandtrainpersonnel.Computersimulationhasbecomeapowerfultoolinmanyfieldssuchasengineeringresearchanddevelopment,naturalscienceresearch,economicandsocialproblemresearch,teachingandtrainingactivities,militaryresearch,organizationandmanagement.
Basicmethod
Computersimulationgenerallyrequiresmanystepsfromformingaproblemtoconfirmingthefinalmodel.①Formproblemsandclarifythepurposeandrequirementsofthesimulation.②Collectandprocesssystem-relateddataasmuchaspossible.③Formamathematicalmodel,findoutthevariouscomponentsthatmakeupthesystem,anddescribetherelevantvariables(generallyincludinginputvariables,statevariables,andoutputvariables)orparametersoftheirstateateachmoment;determinetherulesofinteractionandinfluencebetweenthecomponents,Thatis,thefunctionalrelationshipbetweenthesedescriptionvariables.Whenselectingparametersandvariables,itisalsonecessarytoconsiderwhethertheycanbeidentifiedorsolved,andwhetherthemodelissuitablefortestingbasedonthedataoftherealsystem.④Determineorestimatetheparametersinthemodelbasedonthecollecteddata,andselecttheinitialstateofthemodel.⑤Designtheflowchartoflogicorinformationuntilthecomputerprogramiscompiled.⑥Programverification,checkingtheconsistencybetweentheprogramandthemathematicalmodel,andthereasonablenessoftheinput.⑦Carryoutsimulationtest,executetheprogramonthecomputerforthegiveninput.⑧Analyzetheresultdata,collectandsortoutthetestresultsandmakeexplanations.Ifnecessary,theinputamountorpartofthemodelstructurecanbechanged,andtheexperimentcanbeperformedagain.⑨Modelconfirmation,tochecktheconsistencybetweentheresultsobtainedbythemodelandtheperformancedataoftherealsystem.Thisisakeyissuerelatedtotheeffectivenessofcomputersimulation.Itdependsontheleveloftestingtherealsystemitself,whethersufficientobservationdatacanbeobtained,andthecriteriaforjudgingconsistency.Theeffectivelevelofthemodelcanbedividedinto:effectivereproduction,thatis,themodelcanreproducetheperformanceoftherealsystem;effectiveprediction,thatis,themodelcaneffectivelypredictthefutureperformanceoftherealsystem;effective,thatis,themodelcanreflecttheinterioroftherealsystemStructure.Sincethesystemitselfchangeswithtimeorisrandom,thecomparisonbetweenrealsystemdataandmodeltestresultsoftenrequirestimeseriesanalysismethodsorstatisticalanalysismethods.
Simulationofthediscrete-timemodel
Thetimeinthediscrete-timemodelisexpressedasanintegersequence(representinganintegermultipleofacertaintimeunit),andonlythestatechangesofthesystematthesemomentsareconsidered.Atypicalsimulationprocedureofthismodelincludesthefollowingsteps:①SettheinitialvalueofthesimulationtimeTtot0.②Settheinitialvalueofthestatevariable.③Aftergivingthevalueoftheinputvariableatthecurrentsimulationtime,accordingtothestatetransitionfunctioninthemodel,determinethenexttimeT=t+hThevalueofthestatevariable.Thendeterminethevalueoftheoutputvariableatthatmomentaccordingtotheoutputfunctioninthemodel.④AdvancethesimulationtimeTbyoneunittimeh.⑤CheckwhetherthesimulationtimeThasreachedthepredeterminedendtime.Ifithasreached,stop;otherwise,gotostep③.
Simulationofthediscreteeventmodel
Inthediscreteeventmodel,thestatechangesofthesystemonlyappearatdiscretemoments,whicharecalleddiscreteevents.Takingthequeuingsystemasanexample,thebasicstepsandmethodsforestablishingthissimulationmodelare:①Determinealltherelevant"entities"andtheirattributesincludedinthesystem,all"events"thatchangethestateofthesystemandtheircausesandconsequences.Entitiesarethecomponentpartsofthesystem,andtheattributesofeachentityarerepresentedbynumericalvaluesrepresentingitsproperties,whichconstitutethestateofthesystem.Themostbasicentitiesinthequeuingsystemareacertainnumberof"servicestations"and"customers"whorequireservices.Theirattributesarethe"servicerate"ofthe"servicestation"andtheservicepriorityofthe"customer",andreachtheservicesystem.Themomenttowait.Basic"events"include:newentitiesenterthesystemorexistingentitiesleavethesystem,entityattributeschange,andscheduledschedulechanges.②Determinethemethodofsimulatingthepassageoftime.Ifthetimeisdividedintoequalintervalsandthesystemisexaminedinorderwhetheraneventoccursatthesemoments,itiscalledthefixedtimeintervalmethod;ifthelengthofeachtimelapseisbasedonthemomentwhenthenexteventoccurs,itiscalledthevariabletimeintervalmethodor"NextEvent"method.③Sincetheoccurrenceofeventsinthesystemisoftenrandomandobeysacertainprobabilitydistribution,itisnecessarytogeneraterandomnumbersofthesedistributionsonthecomputer.④Inordertorecordthestateofthesystemflexiblyandeffectively,scheduleevents,accumulaterelevantperformancedataandformreports,saveandautomaticallymanagefutureeventfiles,itisveryappropriatetousedatabasetechnologyinprogramdesign.
Continuoussystemsimulation
Asystemwhosestatechangescontinuouslyovertimeiscalledacontinuoussystem,andtherateofstatechangesatisfiesacertaindifferentialequation.Theestablishmentofthecorrespondingsimulationmodelonthecomputerdependsontheeffectivenumericalmethodofsolvingthedifferentialequation,anditiscompiledintoastandardsubroutinesothatvariousequationorders,coefficients,initialvalueconditionsorboundaryvalueconditionscanbeused.Thesimulationofsystemsinvolvingfeedbackandcontrolisatypicalexampleofthistype.
Simulationlanguage
Assemblylanguageandgeneralprogramminglanguages(suchasFORTRAN,ALGOL,etc.)canbeusedwhencompilingsimulationprograms.Varioussimulationlanguagescanalsobeused.Computersimulationlanguageisahigh-levelprogramminglanguagethatdescribesthesystemmodel.Itprovidesmodulesthatrepresentmanybasicunits,components,andschedulingoperationsinthesystemmodel.Theusercanuseittodeterminethebasicstructureofthemodelmoreconveniently,andonlyneedtoaddsomeauxiliaryprogramstocompileasimulationprogram.
Thesimulationlanguageisgenerallyestablishedonthebasisofothergeneral-purposeprogramminglanguages.Itneedsitsowncompilertopre-compile,convertthesimulationlanguageprogramintoageneral-purposeprogramminglanguageprogram,andthenundergoanothercompilationandconversion.Intoacomputerexecutableprogram.Thesimulationlanguagecanreducetheuser'sprogramwork,butitalsoinevitablybringssomerestrictionsandconsumesmorememoryandcomputingtime.
Simulationlanguagescanbedividedintodiscreteeventsimulationlanguages(suchasGPSSanditsvariousmodifications,SIMCRIPT,GASD,CSL,SIMULA,etc.)andcontinuoussystemsimulationlanguages(suchasDARE,ACSL,CSS,CSSL,etc.))Twotypes.Therearealsodedicatedsimulationlanguagesforvariousapplicationfields.
Computersimulationiscloselyrelatedtothedevelopmentofcomputerhardwareandsoftwaretechnology.Inordertofacilitatetheestablishmentofthemodelandtheeffectivenessofthemodel,peopletrytomakethesimulationmodelhaveacertaindegreeofsimilaritywiththerealsystemintimeandspace.Inthesimulationprocess,Ihopetobeabletoeasilychangetheparametersandevenchangethestructureofthemodel,andtooutputdataandchartsatanytimethroughkeyboardcommands.Therefore,computersimulationrequiresthecomputertohavestrongparallelprocessingcapabilities,highcomputingspeed,human-computerinteractioncapabilitiesandeasy-to-usesimulationlanguages.
Application
Thescaleofcomputersimulationcanbeeithermacroscopicormicroscopic.Onthemacroscale,theexperimentaldatabasecanbeusedtopredicttheprocessflow,operatingconditionsandsystemproperties,calculatethemechanicsandprocessingpropertiesofmaterials,andisgenerallyusedinchemicalprocesssimulation,mechanicalmanufacturingandotherfields.Onthemicroscopicscale,thestructureandpropertiesofmicroscopicparticlesplayanimportantrole,andaregenerallyusedforreactionmechanismresearchandmacroscopicpropertysimulation.
Example
Inordertoillustratethismethod,letusstudytheconstructionofatextilefactory.Theconstructioncostoftheplanthasnotbeenaccuratelycalculated,anditisestimatedtobeabout150millionU.S.dollars.Iftherearenodifficultiesintheconstructionprocess,thecostmaybeaslowas125millionU.S.dollars.Butitisalsopossiblethatduetovariousunforeseenevents-strikes,unexpectedpriceincreasesofrawmaterials,technicalproblems,etc.-theinvestmentexpenditurescanreachashighas$225million.
Thenewfactorywillbeabletooperateformanyyears,anditsproductsalesincomedependsonthepopulationandincomegrowthoftheregion,thedegreeofcompetitioninthesameindustry,theresearchanddevelopmentofsyntheticfibers,andtheimportquotaofforeigntextiles.Theoperatingcostwilldependontherisingandfallingtrendsofproductionefficiency,rawmaterialsandwagelevels,andsoon.Sincebothsalesrevenueandoperatingcostsareuncertainfactors,theannualprofitisalsouncertain.
Iftheprobabilitydistributioncanbecalculatedforeachmajorcostfactorandrevenuefactor,acomputerprogramcanbeestablishedtosimulatepossibleevents.Thecomputeractuallytakesanyvaluefromeachrelevantdistributionandcombinesitwithothervaluesselectedfromotherdistributionstoprovideanestimatedprofitandthenetpresentvalueoftheinvestment,thatis,theprofitrate.Thisspecificamountofprofitandrateofprofitareonlysuitableforthecombinationofspecificvaluesselectedinthisexperiment.Thecomputercontinuestoselectthevaluesoftheothergroups,anditispossibletocalculateotherprofitamountsandprofitratesforhundredsoftrials.Countandsavethenumberoftimesdifferentprofitratesarecalculated.Afterthecomputerisrunning,itcanbedrawnintoafrequencydistributionaccordingtothenumberoftimesthedifferentprofitratesappear.